FUNCTION z_syn_st.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(PARAM_ST) LIKE SY-LISEL
*" EXPORTING
*" REFERENCE(RET_MSG) LIKE SY-LISEL
*" REFERENCE(IN_MSG) LIKE SY-LISEL
*"----------------------------------------------------------------------
*PARAMETERS: requtext LIKE sy-lisel.
DATA: echotext LIKE sy-lisel,
resptext LIKE sy-lisel,
rfctest TYPE TABLE OF rfctest,
wa_rfctest TYPE rfctest,
gw LIKE gwy_struct-gwserv,
actgwhost LIKE gwy_struct-gwhost,
n TYPE i.
DATA: BEGIN OF gwsys2 OCCURS 0.
INCLUDE STRUCTURE gwy_syste2.
DATA: END OF gwsys2.
MOVE '外部程序没有运行' TO ret_msg.
PERFORM write_log USING param_st.
MOVE 'sapgw01' TO gw.
MOVE sy-host TO actgwhost.
CALL FUNCTION 'GWY_READ_CONNECTED_SYSTEMS2'
* EXPORTING
* gwhost = actgwhost
* gwserv = gw
TABLES
connected_systems = gwsys2
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 .
PERFORM write_log USING 'GWY_READ_CONNECTED_SYSTEMS2 error'.
EXIT.
ENDIF.
DELETE gwsys2 WHERE tpname NE 'JCOSERVE'.
DESCRIBE TABLE gwsys2 LINES n.
IF n < 1 .
PERFORM write_log USING '外部程序没有运行'.
EXIT.
ENDIF.
* CATCH SYSTEM-EXCEPTIONS others = 5.
wa_rfctest-rfcdata1 = param_st.
wa_rfctest-rfcdata2 = 'synchronization'.
APPEND wa_rfctest TO rfctest.
* CALL FUNCTION 'RFC_PING'
* DESTINATION 'SYN_ST'.
CALL FUNCTION 'STFC_CONNECTION'
DESTINATION 'SYN_ST'
EXPORTING
requtext = param_st
IMPORTING
echotext = echotext
resptext = resptext
TABLES
rfctest = rfctest.
MOVE resptext TO ret_msg.
MOVE echotext TO in_msg.
* ENDCATCH.
*
* IF sy-subrc = 5.
* ret_msg = '调用错误 5'.
* ENDIF.
ENDFUNCTION.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(PARAM_ST) LIKE SY-LISEL
*" EXPORTING
*" REFERENCE(RET_MSG) LIKE SY-LISEL
*" REFERENCE(IN_MSG) LIKE SY-LISEL
*"----------------------------------------------------------------------
*PARAMETERS: requtext LIKE sy-lisel.
DATA: echotext LIKE sy-lisel,
resptext LIKE sy-lisel,
rfctest TYPE TABLE OF rfctest,
wa_rfctest TYPE rfctest,
gw LIKE gwy_struct-gwserv,
actgwhost LIKE gwy_struct-gwhost,
n TYPE i.
DATA: BEGIN OF gwsys2 OCCURS 0.
INCLUDE STRUCTURE gwy_syste2.
DATA: END OF gwsys2.
MOVE '外部程序没有运行' TO ret_msg.
PERFORM write_log USING param_st.
MOVE 'sapgw01' TO gw.
MOVE sy-host TO actgwhost.
CALL FUNCTION 'GWY_READ_CONNECTED_SYSTEMS2'
* EXPORTING
* gwhost = actgwhost
* gwserv = gw
TABLES
connected_systems = gwsys2
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 .
PERFORM write_log USING 'GWY_READ_CONNECTED_SYSTEMS2 error'.
EXIT.
ENDIF.
DELETE gwsys2 WHERE tpname NE 'JCOSERVE'.
DESCRIBE TABLE gwsys2 LINES n.
IF n < 1 .
PERFORM write_log USING '外部程序没有运行'.
EXIT.
ENDIF.
* CATCH SYSTEM-EXCEPTIONS others = 5.
wa_rfctest-rfcdata1 = param_st.
wa_rfctest-rfcdata2 = 'synchronization'.
APPEND wa_rfctest TO rfctest.
* CALL FUNCTION 'RFC_PING'
* DESTINATION 'SYN_ST'.
CALL FUNCTION 'STFC_CONNECTION'
DESTINATION 'SYN_ST'
EXPORTING
requtext = param_st
IMPORTING
echotext = echotext
resptext = resptext
TABLES
rfctest = rfctest.
MOVE resptext TO ret_msg.
MOVE echotext TO in_msg.
* ENDCATCH.
*
* IF sy-subrc = 5.
* ret_msg = '调用错误 5'.
* ENDIF.
ENDFUNCTION.