Skip to Content
avatar image
Former Member

error handling in call transaction... have ur points..

Hi all,

How to handle errors in call transcation method. pleas help me with simple and complete example..

Have ur points...

Regards,

pradeep.phogat@gmail.com

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Aug 21, 2007 at 05:25 AM
    CALL TRANSACTION 'VD51' USING it_bdc MODE 'A' UPDATE 'S' 
                            MESSAGES INTO it_messages.
    IF NOT it_messages[] IS INITIAL.
      PERFORM format_message.
    ENDIF.
    
    *---------------------------------------------------------------------*
    *       FORM FORMAT_MESSAGE                                           *
    *---------------------------------------------------------------------*
    *       ........                                                      *
    *---------------------------------------------------------------------*
    FORM format_message.
      DATA: l_msg(100).
      LOOP AT it_messages.
        READ TABLE it_customer INDEX l_index.
    
        CALL FUNCTION 'FORMAT_MESSAGE'
             EXPORTING
                  id        = it_messages-msgid
                  lang      = sy-langu
                  no        = it_messages-msgnr
                  v1        = it_messages-msgv1
                  v2        = it_messages-msgv2
                  v3        = it_messages-msgv3
                  v4        = it_messages-msgv4
             IMPORTING
                  msg       = l_msg
             EXCEPTIONS
                  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.
        WRITE:/ l_msg.
      ENDLOOP.
    
    
    ENDFORM. " FORMAT_MESSAGE
    

    Regards

    Gopi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 05:26 AM

    DATA : BEGIN OF IT_MESSAGES OCCURS0.

    INCLUDE STRUCTURE BDCMSGCOL.

    DATA : END OF IT_MESSAGES.

    CALL TRANSACTION 'XK01' USING IT_BDC MODE 'A' UPDATE 'S'

    MESSAGES INTO IT_MESSAGES.

    IF NOT IT_MESSAGES[] IS INITIAL.

    PERFORM FORMAT_MESSAGE.

    ENDIF.

    FORM FORMAT_MESSAGE.

    DATA: L_MSG(100).

    LOOP AT IT_MESSAGES.

    READ TABLE IT_VENDOR INDEX L_INDEX.

    CALL FUNCTION 'FORMAT_MESSAGE'

    EXPORTING

    ID = IT_MESSAGES-MSGID

    LANG = SY-LANGU

    NO = IT_MESSAGES-MSGNR

    V1 = IT_MESSAGES-MSGV1

    V2 = IT_MESSAGES-MSGV2

    V3 = IT_MESSAGES-MSGV3

    V4 = IT_MESSAGES-MSGV4

    IMPORTING

    MSG = L_MSG

    EXCEPTIONS

    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.

      write:/ l_msg.

      ENDLOOP.

      ENDFORM. " FORMAT_MESSAGE

      reward if u find use ful

      regards

      Nagesh.Paruchuri.

      Add comment
      10|10000 characters needed characters exceeded

    • avatar image
      Former Member
      Aug 21, 2007 at 05:26 AM

      hi,

      go thro this link...

      it has a code example for error handling in call transaction...

      http://sap.ittoolbox.com/groups/technical-functional/sap-dev/fw-error-handling-in-bdc-182852>

      regards,

      viji

      Add comment
      10|10000 characters needed characters exceeded

      • Former Member

        call transaction 'MI01' using itab_bdcdata mode 'A' MESSAGES INTO

        ITAB_msg.

        where itab_msg is of type BDCMSGCOLL.

        You can loop into itab_msg and code according to your requirement for E or S messages...:)

        regards

        Message was edited by:

        Madan Gopal Sharma