SAP调用Webservice地址

2023-10-13 18:43:27 浏览数 (1)

接口调用过程

代码语言:javascript复制
"定义
 DATA logical_port_name TYPE prx_logical_port_name.

  DATA lo_mode_date_service_p TYPE REF TO zsd_oac_co_mode_date_service_p.
  DATA:ls_input TYPE  zsd_oac_get_all_mode_data_lis1.
  DATA:ls_output TYPE zsd_oac_get_all_mode_data_list.

  DATA: lo_system_fault      TYPE REF TO cx_ai_system_fault,       "通信错误异常类
        lo_application_fault TYPE REF TO cx_ai_application_fault.  "应用程序错误异常类

"数据准备


"链接地址
 TRY.
      CREATE OBJECT lo_mode_date_service_p
        EXPORTING
          logical_port_name = 'OA4'.  "定义好的逻辑端口
    CATCH cx_ai_system_fault INTO lo_system_fault. "通信错误.

     "错误消息
      CALL METHOD lo_system_fault->if_message~get_text
        RECEIVING
          result = l_result.
      es_return-msgty = 'E'.
      es_return-msgtx = l_result.
  ENDTRY.
  
  
"传输

 TRY.
      CALL METHOD lo_mode_date_service_p->get_all_mode_data_list
        EXPORTING
          get_all_mode_data_list_request = ls_input
        IMPORTING
          get_all_mode_data_list_respons = ls_output.

    CATCH cx_ai_system_fault.
   "通信错误消息

      CALL METHOD lo_system_fault->if_message~get_text
        RECEIVING
          result = l_result.
      es_return-msgty = 'E'.
      es_return-msgtx = l_result.

    CATCH cx_ai_application_fault INTO lo_application_fault.  "应用程序错误

   "应用程序错误消息
      CALL METHOD lo_application_fault->if_message~get_text
        RECEIVING
          result = l_result.
      es_return-msgty = 'E'.
      es_return-msgtx = l_result.

  ENDTRY.

0 人点赞