CALL TRANSACTION syntax for SAP ABAP

Basic form

CALL TRANSACTION tcod.

Additions


1. ... AND SKIP FIRST SCREEN
2. ... USING itab
2a. ... MODE mode
2b. ... UPDATE upd
2c. ... MESSAGES INTO messtab

Effect

Calls the SAP Transaction tcod ; tcod can be a literal or a variable. To return from the called transaction, you use the key word LEAVE PROGRAM .

Example

 
CALL TRANSACTION 'SP01'.
 

Addition 1

... AND SKIP FIRST SCREEN

Effect

Skips the first screen in the transaction (provided all the required fields have been assigned values by the SPA/GPA process).

Addition 2

... USING itab

Effect

Calls the Transaction tcod and passes the internal table itab , which contains one or several screens in batch input format.
If necessary, one of the messages output by the Transaction is returned to the fields SY-MSGID , SY-MSGTY SY-MSGNO , SY-MSGV1 , ..., SY-MSGV4 .

The return code value is set as follows:


SY-SUBRC = 0 Processing was successful.
SY-SUBRC <> 0 Transaction ended with an error.

Note

A called Transaction ends successfully for the following reasons:
COMMIT WORK Next screen = 0
LEAVE TO TRANSACTION ' '

Addition 2a

... MODE mode

Effect

The specified processing mode can accept the following values:

'A' Display screen
'E' Display screen only if an error occurs
'N' No display

If the addition MODE is not specified, the processing mode is set to 'A' .

Addition 2b

... UPDATE upd

Effect

The specified update mode upd defines the update type. This can have one of the following values:

'A' Asynchronous update
'S' Synchronous update

If the addition UPDATE is not specified, the processing mode is set to 'A' .

Addition 2c

... MESSAGES INTO messtab

Effect

The specified internal table contains all system messages that occur during CALL TRANSACTION USING ... . The internal table messtab must have the structure BDCMSGCOLL .

Example



DATA BEGIN OF BDCDATA OCCURS 100.
       INCLUDE STRUCTURE BDCDATA.
DATA END OF BDCDATA.
 
DATA BEGIN OF MESSTAB OCCURS 10.
       INCLUDE STRUCTURE BDCMSGCOLL.
DATA END OF MESSTAB.
 
DATA REPORT(8).
 
BDCDATA-PROGRAM  = 'SAPMS38M'.
BDCDATA-DYNPRO   = '0100'.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
CLEAR BDCDATA.
BDCDATA-FNAM     = 'RS38M-PROGRAMM'.
BDCDATA-FVAL     = REPORT.
APPEND BDCDATA.
...
CALL TRANSACTION 'SE38'  USING BDCDATA  MODE 'N'
                         MESSAGES INTO MESSTAB.
Run time errors
  • CALL_TRANSACTION_NOT_FOUND : Transaction is unknown.
  • CALL_TRANSACTION_IS_MENU : Transaction is a menu.
CALL_TRANSACTION_USING_NESTED : Recursive CALL TRANSACTION USING



RELATED POST

2 comments :

  1. Hi,

    I have a problem while using call transaction. Though the BDCDATA is populated correctly it is only processing the 1st iteration only. After the 1st change it does not continue.

    SELECT bname
    FROM usr02
    INTO TABLE t_data
    WHERE bname IN so_bname.

    refresh i_bdcdata.

    LOOP AT t_data.

    PERFORM sub1 USING 'SAPLSUU5' '0050'.
    PERFORM sub2 USING 'BDC_CURSOR' 'USR02-BNAME'.
    PERFORM sub2 USING 'BDC_OKCODE' '=PASS'.
    PERFORM sub2 USING 'USR02-BNAME' t_data-bname.

    PERFORM sub1 USING 'SAPLSUU5' '0400'.
    PERFORM sub2 USING 'BDC_CURSOR' 'G_PASSWORD2'.
    PERFORM sub2 USING 'BDC_OKCODE' '=PASS'.
    PERFORM sub2 USING 'G_PASSWORD1' pa_pass.
    PERFORM sub2 USING 'G_PASSWORD2' pa_pass.

    ENDLOOP.

    *call transaction
    CALL TRANSACTION 'SU01'
    USING i_bdcdata
    MODE 'N'
    UPDATE 'A'
    MESSAGES INTO messtab.

    *messages if any
    LOOP AT messtab.
    SELECT SINGLE * FROM t100 INTO jtab_wa WHERE sprsl = messtab-msgspra
    AND arbgb = messtab-msgid
    AND msgnr = messtab-msgnr.

    WRITE:/ jtab_wa-sprsl, jtab_wa-text.
    ENDLOOP.




    *&---------------------------------------------------------------------*
    *& Form sub1
    *&---------------------------------------------------------------------*
    FORM sub1 USING a b.
    CLEAR wa_bdcdata.
    wa_bdcdata-program = a.
    wa_bdcdata-dynpro = b.
    wa_bdcdata-dynbegin = 'X'.
    APPEND wa_bdcdata to i_bdcdata.
    ENDFORM. "sub1

    *&---------------------------------------------------------------------*
    *& Form sub2
    *&---------------------------------------------------------------------*
    FORM sub2 USING c d.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam = c.
    wa_bdcdata-fval = d.
    APPEND wa_bdcdata to i_bdcdata.
    ENDFORM. "sub2

    ReplyDelete
  2. LOOP AT t_data.

    PERFORM sub1 USING 'SAPLSUU5' '0050'.
    PERFORM sub2 USING 'BDC_CURSOR' 'USR02-BNAME'.
    PERFORM sub2 USING 'BDC_OKCODE' '=PASS'.
    PERFORM sub2 USING 'USR02-BNAME' t_data-bname.

    PERFORM sub1 USING 'SAPLSUU5' '0400'.
    PERFORM sub2 USING 'BDC_CURSOR' 'G_PASSWORD2'.
    PERFORM sub2 USING 'BDC_OKCODE' '=PASS'.
    PERFORM sub2 USING 'G_PASSWORD1' pa_pass.
    PERFORM sub2 USING 'G_PASSWORD2' pa_pass.
    PERFORM bdc_transaction USING 'IE02'.

    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    tcode = tcode
    TABLES
    dynprotab = ti_bdc.

    refresh t_data.

    ENDLOOP.

    ReplyDelete