Call Transaction of a Batch Input
There are some cases where the CALL TRANSACTION works well and the Batch-Input doesn't.(i.e. LT06 that in BI jumps to a LT04 and in CALL TRANS. works)
If you want to execute a BI in CALL TRANSACTION you need this program
and a Queue-Id.
You enter in SE11 table APQI and you see the contents, you select the BI and get the QID. You must do the same in APQD with this QID to be sure this is the BI you want.
In SE38 you can execute the programa with this QID.
The program will call (only) the transaction that are wrong, in CALL TRANSACTION mode and with these that fails will generate another BI.
WARNING: This is a very dangerous program, there is no comprobation, and there is no modification of the original BI (And you can launch twice a transaction of the BI).
Excuse my bad English.
REPORT Z_CALL_BI . PARAMETERS: QUEUE_ID LIKE APQD-QID. PARAMETERS: E_GROUP(12) DEFAULT 'MMWM-OUT'. DATA: L_MSTRING(480). DATA: L_SUBRC LIKE SY-SUBRC. DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE. DATA: TABLA LIKE BDCDATA OCCURS 0 WITH HEADER LINE. DATA: E_GROUP_OPENED. DATA: FNAM(20). TABLES: T100, APQI, TSTC. START-OF-SELECTION. SELECT SINGLE * FROM APQI WHERE QID = QUEUE_ID. IF SY-SUBRC NE 0. EXIT. ENDIF. DO APQI-PUTTRANS TIMES. CALL FUNCTION 'BDC_OBJECT_READ' EXPORTING QUEUE_ID = QUEUE_ID * DATATYPE = '%BDC' TRANS = SY-INDEX TABLES DYNPROTAB = TABLA . IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. REFRESH MESSTAB. LOOP AT TABLA WHERE DYNBEGIN = 'T'. FNAM = TABLA-FNAM. DELETE TABLA. ENDLOOP. SELECT SINGLE * FROM TSTC WHERE TCODE = FNAM. IF SY-SUBRC = 0. " This transaction has been executed with rc ne 0. CALL TRANSACTION FNAM USING TABLA MODE 'E' UPDATE 'S' MESSAGES INTO MESSTAB. L_SUBRC = SY-SUBRC. WRITE: / 'CALL_TRANSACTION', 'returncode:'(I05), L_SUBRC, 'RECORD:', SY-INDEX. LOOP AT MESSTAB. SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA AND ARBGB = MESSTAB-MSGID AND MSGNR = MESSTAB-MSGNR. IF SY-SUBRC = 0. L_MSTRING = T100-TEXT. IF L_MSTRING CS '&1'. REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING. REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING. REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING. REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING. ELSE. REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING. REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING. REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING. REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING. ENDIF. CONDENSE L_MSTRING. WRITE: / MESSTAB-MSGTYP, L_MSTRING(250). ELSE. WRITE: / MESSTAB. ENDIF. ENDLOOP. SKIP. IF L_SUBRC <> 0 AND E_GROUP <> SPACE. IF E_GROUP_OPENED = ' '. CALL FUNCTION 'BDC_OPEN_GROUP' EXPORTING CLIENT = SY-MANDT GROUP = E_GROUP USER = 'DI013' KEEP = 'X' . E_GROUP_OPENED = 'X'. ENDIF. CALL FUNCTION 'BDC_INSERT' EXPORTING TCODE = FNAM TABLES DYNPROTAB = TABLA. ENDIF. ENDIF. REFRESH TABLA. ENDDO. CALL FUNCTION 'BDC_CLOSE_GROUP'.