[ABAP] RFC-Aufruf einer Transaktion

DATA: it_error TYPE STANDARD TABLE OF bdcmsgcoll.

DATA: lv_rc TYPE sy-subrc.

* Batch
DATA(it_batch) = VALUE bdcdata_tab( ( dynbegin = 'T' fnam = 'FD03' )
                                    ( program = 'SAPMF02D' dynpro = '0106' dynbegin = 'X' )
                                    ( fnam = 'RF02D-KUNNR' fval = '40000' )
                                    ( fnam = 'RF02D-BUKRS' fval = '' )
                                    ( fnam = 'RF02D-D0110' fval = abap_true )
                                    ( fnam = 'RF02D-D0120' fval = abap_true )
                                    ( fnam = 'BDC_OKCODE'  fval = '/00' ) ).

* RFC-Aufruf
CALL FUNCTION 'RFC_CALL_TRANSACTION_USING'
  DESTINATION 'XYZ'
  EXPORTING
    tcode                   = 'FD03'
    mode                    = 'E'
  IMPORTING
    subrc                   = lv_rc
  TABLES
    bt_data                 = it_batch
    l_errors                = it_error
  EXCEPTIONS
    authority_not_available = 1
    OTHERS                  = 2.

* Datenausgabe
WRITE: / sy-subrc.
WRITE: / lv_rc.

LOOP AT it_batch ASSIGNING FIELD-SYMBOL(<b>).
  WRITE: / <b>-program, <b>-dynpro, <b>-dynbegin, <b>-fnam, <b>-fval.
ENDLOOP.

LOOP AT it_error ASSIGNING FIELD-SYMBOL(<e>).
  WRITE: / <e>-tcode, <e>-dyname, <e>-dynumb, <e>-msgtyp, <e>-msgspra, <e>-msgid, <e>-msgnr, <e>-msgv1, <e>-msgv2, <e>-msgv3, <e>-msgv4, <e>-env, <e>-fldname.
ENDLOOP.