Code: Alles auswählen.
* Konfig-Struktur für Batchinput
DATA OPT TYPE CTU_PARAMS.
*Batch-Input-Mappe erstellen --> BDCDATA
...
* Parameter für Batchinput setzen
...
" verhindern, daß der Transaktionsaufruf nach einem COMMIT endet
opt-racommit = 'X'.
CALL TRANSACTION 'PFCG' USING bdcdata options from opt.
Folgende Benutzer bedankten sich beim Autor Alexander D. für den Beitrag:
Adalan
Code: Alles auswählen.
REPORT zrollen_neu NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE bdcrecx1.
START-OF-SELECTION.
PERFORM open_group.
PERFORM bdc_dynpro USING 'SAPLPRGN_TREE' '0121'.
PERFORM bdc_field USING 'BDC_CURSOR'
'AGR_NAME_NEU'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=COPY'.
PERFORM bdc_field USING 'AGR_NAME_NEU'
'BAG:1:FIAR:45XX:DIS_DEBI_ALL'. "QUELL-ROLLE !!
PERFORM bdc_dynpro USING 'SAPLPRGN_COPY_COLL' '0500'.
PERFORM bdc_field USING 'BDC_CURSOR'
'P_DEST'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ALL'.
PERFORM bdc_field USING 'P_SOURCE'
'BAG:1:FIAR:45XX:DIS_DEBI_ALL'. "QUELL-ROLLE !!
PERFORM bdc_field USING 'P_DEST'
'BAG:1:FIAR:33XX:DIS_DEBI_ALL-b'. "ZIEL-ROLLE !!
PERFORM zbdc_transaction USING 'PFCG'.
PERFORM close_group.
*----------------------------------------------------------------------*
* Start new transaction according to parameters *
*----------------------------------------------------------------------*
FORM zbdc_transaction USING tcode.
DATA: l_mstring(480).
DATA: l_subrc LIKE sy-subrc.
DATA opt TYPE ctu_params.
opt-racommit = 'X'.
opt-dismode = ctumode.
opt-updmode = cupdate.
* batch input session
IF session = 'X'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
TABLES
dynprotab = bdcdata.
IF smalllog <> 'X'.
WRITE: / 'BDC_INSERT'(i03),
tcode,
'returncode:'(i05),
sy-subrc,
'RECORD:',
sy-index.
ENDIF.
* call transaction using
ELSE.
REFRESH messtab.
CALL TRANSACTION tcode USING bdcdata
* mode ctumode
* update cupdate
OPTIONS FROM opt
MESSAGES INTO messtab.
l_subrc = sy-subrc.
IF smalllog <> 'X'.
WRITE: / 'CALL_TRANSACTION',
tcode,
'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.
ENDIF.
** Erzeugen fehlermappe ************************************************
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 = e_user
keep = e_keep
holddate = e_hdate.
e_group_opened = 'X'.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
TABLES
dynprotab = bdcdata.
ENDIF.
ENDIF.
REFRESH bdcdata.
ENDFORM. "zbdc_transaction