当前位置: 首页 > 工具软件 > sproxy > 使用案例 >

SPROXY MESSAGE ID

叶卓君
2023-12-01

DATA: ls_srm001 TYPE REF TO zco_si_sap_srm001_req,
lc_cx_fault TYPE REF TO cx_ai_system_fault,
lc_ap_fault TYPE REF TO cx_ai_application_fault,
lr_proto_msg_id TYPE REF TO if_wsprotocol_message_id,
ls_output TYPE zmt_srm001_req,
ls_input TYPE zmt_srm001_resp,
lv_msg TYPE string,

"* 取得Msg Guid (Outbound)
TRY.
    lr_proto_msg_id ?=
    ls_srm001->get_protocol( if_wsprotocol=>message_id ).
    lv_msgguid = lr_proto_msg_id->get_message_id( ).
  CATCH cx_ai_system_fault INTO lc_cx_fault.
    MESSAGE  lc_cx_fault->get_text( ) TYPE 'E'.   " Exception handling logic

INBOUND

DATA: lo_protocol TYPE REF TO if_wsprotocol_message_id,
lo_server_context TYPE REF TO if_ws_server_context.

TRY.
lo_server_context = cl_proxy_access=>get_server_context( ).
lo_protocol ?= lo_server_context->get_protocol( if_wsprotocol=>message_id ).
DATA(lv_pi_msgid_out_raw) = lo_protocol->get_message_id( ).
CATCH cx_ai_system_fault.
ENDTRY.

完整实例:

DATA: lo_protocol TYPE REF TO if_wsprotocol_message_id,
lo_server_context TYPE REF TO if_ws_server_context.

DATA : lc_cx_fault2 TYPE REF TO cx_ai_system_fault,
lc_ap_fault TYPE REF TO cx_ai_application_fault,
lv_msgguid2 TYPE sxmsmguid,
lr_proxy_basis TYPE REF TO if_proxy_basis,
lr_wsprotocol TYPE REF TO if_wsprotocol,
lr_proto_msg_id2 TYPE REF TO if_wsprotocol_message_id,
lr_proto_msg_id TYPE REF TO if_wsprotocol_message_id.

IF iv_sproxy IS NOT BOUND .
TRY.
lo_server_context = cl_proxy_access=>get_server_context( ).
lo_protocol ?= lo_server_context->get_protocol( if_wsprotocol=>message_id ).
DATA(lv_msgguid) = lo_protocol->get_message_id( ).

    IF  iv_record_id IS NOT INITIAL  AND lv_msgguid IS NOT INITIAL  .
      UPDATE   table 
       SET msgguid  =  lv_msgguid
      WHERE record_id = iv_record_id   .
      COMMIT WORK.
    ENDIF.

  CATCH cx_ai_system_fault  INTO DATA(lc_cx_fault) .
    DATA(lv_strs) =  lc_cx_fault->get_text( ) .
ENDTRY.

ELSE .

TRY.
    CLear : lv_msgguid .
    CALL METHOD iv_sproxy->('GET_PROTOCOL')
      EXPORTING
        protocol_name = if_wsprotocol=>message_id
      RECEIVING
        protocol      = lr_wsprotocol.

    lr_proto_msg_id ?= lr_wsprotocol .
    lv_msgguid   = lr_proto_msg_id->get_message_id( ) .

    lr_proxy_basis    ?=  iv_sproxy .
    lr_proto_msg_id2  ?=  lr_proxy_basis->get_protocol( if_wsprotocol=>message_id ).
    lv_msgguid2        =   lr_proto_msg_id2->get_message_id( ).
    IF lv_msgguid IS NOT INITIAL   .
      UPDATE  table  
        SET msgguid  =  lv_msgguid
       WHERE record_id = iv_record_id  .
      COMMIT WORK.
    ENDIF.
  CATCH cx_ai_system_fault INTO lc_cx_fault.
    lv_strs   =  lc_cx_fault->get_text( ) .
ENDTRY .

ENDIF.

 类似资料:

相关阅读

相关文章

相关问答