BDC - How to handle error log file to upload the data in call transaction method

A common question asked is : How to display the error log

      DATA:  tmess_mtab TYPE TABLE OF BDCMSGCOLL OCCURS 10 WITH HEADER LINE

     ****For error Messages
     TYPES : BEGIN OF type_mtab,
        matnr   LIKE mara-matnr,
        msgtyp  LIKE bdcmsgcoll-msgtyp,
        msgid   LIKE bdcmsgcoll-msgid,
        msgnr   LIKE bdcmsgcoll-msgnr,
        text(100) TYPE c,
        END OF type_mtab. 

       DATA :   t_mtab TYPE STANDARD TABLE OF type_mtab,

                      wa_mtab LIKE LINE OF t_mtab,

      LOOP AT tmess_mtab .
      l_cnt =  l_cnt + 1.
      READ TABLE t_item INTO wa_item INDEX l_cnt .
 
      CALL FUNCTION 'MASS_MESSAGE_GET' "To get the Message Text
           EXPORTING
                arbgb             = tmess_mtab-msgid
                msgnr             = tmess_mtab-msgnr
                msgv1             = tmess_mtab-msgv1
                msgv2             = tmess_mtab-msgv2
                msgv3             = tmess_mtab-msgv3
                msgv4           !   = tmess_mtab-msgv4
           IMPORTING
                msgtext           = wa_mtab-text
           EXCEPTIONS
                message_not_found = 1
                OTHERS            = 2.
      IF sy-subrc <> 0.
*        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      wa_mtab-matnr   = wa_item-matnr.
      wa_mtab-msgtyp  = tmess_mtab-msgtyp.
      wa_mtab-msgid   = tmess_mtab-msgid.
      wa_mtab-msgnr   = tmess_mtab-msgnr.
      APPEND wa_mtab TO t_mtab.
      CLEAR wa_mtab-text.
      CLEAR wa_item.
    ENDLOOP.

LOOP AT t_mtab INTO wa_mtab.

write:/ wa_mtab-matnr, wa_mtab-msgtyp, wa_mtab-msgid, wa_mtab-msgnr .

ENDLOOP.

w to handle error log file in call transaction method after updation of data. (or ) If an error file occurs while using  call transaction method to upload the data from legacy system to SAP system,how to handle the  error file.

In a typical BDC call transaction scenario, You can get the errors which occur in the transaction by doing the following :

After your BDCDATA has been populated :

CALL TRANSACTION <TCODE> USING BDCDATA OPTIONS FROM  <CTU_PARAMS> MESSAGES INTO MESSTAB. LOOP AT MESSTAB.	IF messtab-msgtyp = 'E'.	Append the current record into error table.	ENDIF.  ENDLOOP.

The structure of MESSTAB internal table must be of type BDCMSGCOLL.

           
 

Labels

displaying displaying Delete
the the Delete
error error Delete
log log Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.