View previous topic :: View next topic
Author
Message
admin Администратор Joined: 01 Sep 2007 Posts: 1640
Posted: Sat Nov 17, 2007 6:14 pm Post subject: Parallel execution of a given transaction in many systems
Parallel execution of a given transaction in many systems from 1 calling system - report + remote function module
Code: REPORT YPARALL .
* This program issues a system message in all listed systems
*@ ZZZ ZZZ_010
*@ XXX local
DATA: HEAD(2), SYSTEM(3), CN_STR(7), RC LIKE SY-SUBRC.
DATA: PROGRAM LIKE SY-REPID,
BEGIN OF T OCCURS 500,
LINE(72),
END OF T.
DATA: BEGIN OF BDC_TAB OCCURS 5.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDC_TAB.
* Retrieve remote system data
PROGRAM = SY-REPID.
READ REPORT PROGRAM INTO T.
LOOP AT T.
HEAD = T.
IF HEAD <> '*@'. DELETE T. ENDIF.
ENDLOOP.
SKIP.
CLEAR T.
LOOP AT T.
SYSTEM = T+3(3).
CN_STR = T+7(7).
WRITE: / 'SYSTEM: ', SYSTEM, ' CONNECT_STRING: ', CN_STR.
CLEAR BDC_TAB.
REFRESH BDC_TAB.
BDC_TAB-PROGRAM = 'SAPMSSY0'.
BDC_TAB-DYNPRO = '0120'.
BDC_TAB-DYNBEGIN = 'X'.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = 'BDC_OKCODE'.
BDC_TAB-FVAL = '/5'.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = 'SAPMSEM1'.
BDC_TAB-DYNPRO = '4400'.
BDC_TAB-DYNBEGIN = 'X'.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = 'EMLINE1'.
BDC_TAB-FVAL = 'THIS IS A REAL NICE ABAP.'.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = 'EMLINE2'.
BDC_TAB-FVAL = 'EXECUTED PARALLEL IN ALL OUR SYSTEMS!!!!'.
APPEND BDC_TAB.
CLEAR BDC_TAB.
* bdc_tab-fnam = 'TEMSG-APPLSERVER'.
* bdc_tab-fval = 'dino_C11_00'.
* append bdc_tab.
* clear bdc_tab.
* bdc_tab-fnam = 'TEMSG-DATDEL'.
* bdc_tab-fval = datum.
* append bdc_tab.
* clear bdc_tab.
* bdc_tab-fnam = 'TEMSG-TIMDEL'.
* bdc_tab-fval = time.
* append bdc_tab.
* clear bdc_tab.
BDC_TAB-PROGRAM = 'SAPMSYST'.
BDC_TAB-DYNPRO = '0040'.
BDC_TAB-DYNBEGIN = 'X'.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = 'BDC_OKCODE'.
BDC_TAB-FVAL = '/3'.
APPEND BDC_TAB.
CLEAR BDC_TAB.
* if sy-sysid = system.
* call transaction 'SM02' using bdc_tab mode 'N'.
* endif.
IF SY-SYSID = SYSTEM.
CALL FUNCTION 'Y_PARALLEL_EXEC'
EXPORTING
TRANSACTION_NAME = 'SM02'
TABLES
BDC_TAB = BDC_TAB.
ELSE.
CALL FUNCTION 'Y_PARALLEL_EXEC' DESTINATION CN_STR
EXPORTING
TRANSACTION_NAME = 'SM02'
TABLES
BDC_TAB = BDC_TAB.
ENDIF.
ENDLOOP.
The remote function module:
FUNCTION Y_PARALLEL_EXEC.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(TRANSACTION_NAME) LIKE USR02-BNAME
*" TABLES
*" BDC_TAB STRUCTURE BDCDATA
*"----------------------------------------------------------------------
CALL TRANSACTION TRANSACTION_NAME USING BDC_TAB MODE 'N'.
ENDFUNCTION.
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.