Skip to Content
author's profile photo Former Member
Former Member

hi

hi all,

pls help me how to handle error handling in session and call transaction method?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Nov 24, 2007 at 06:40 AM

    For session you can use the Session Log.

    For the call transaction you can use the MESSAGES INTO MESS_TAB.

    CALL TRANSACTION 'MM01' USING BDCDATA MESSAGES INTO MESS_TAB.
    
    READ TABLE MESS_tAB WITH MSGID = 'XX'  " << MESSAGE ID FOR SUCCFUL GENERATED MESSAGE
    MSGNR = '123'.  " << NUMBER
    IF SY-SUBRC = 0.
    * DOCUMENT WAS CREATED SUCCESSFULLY
    ELSE.
    * ERROR 
    ENDIF.

    Regards,

    Naimesh Patel

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2007 at 12:23 PM

    Hi,

    please check out this eg. code.

    ****/ data declaration
    DATA : IT_T100 LIKE T100 OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF IMSG  OCCURS 0.
            INCLUDE STRUCTURE  BDCMSGCOLL.
    DATA : END OF IMSG .
    
    DATA : PTF_FILENAME TYPE STRING,
           U_MODE(1),
           L_MSTRING TYPE STRING.
    
    ****/ calling transaction with messages.
        CALL TRANSACTION  'MD61' USING  BDCTAB
                                  MODE  U_MODE
                                UPDATE  C_UPDATE
                              MESSAGES  INTO IMSG.
        PERFORM ALL_MESSAGES .
    
    *****/ form of above perform...
    *&---------------------------------------------------------------------*
    *&      Form  ALL_MESSAGES
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM ALL_MESSAGES .
      LOOP AT IMSG.
        SELECT SINGLE * FROM T100 INTO IT_T100
                                 WHERE SPRSL = IMSG-MSGSPRA
                                   AND ARBGB = IMSG-MSGID
                                   AND MSGNR = IMSG-MSGNR.
        IF SY-SUBRC IS INITIAL.
          L_MSTRING = IT_T100-TEXT.
          IF L_MSTRING CS '&1'.
            REPLACE '&1' WITH IMSG-MSGV1 INTO L_MSTRING.
            REPLACE '&2' WITH IMSG-MSGV2 INTO L_MSTRING.
            REPLACE '&3' WITH IMSG-MSGV3 INTO L_MSTRING.
            REPLACE '&4' WITH IMSG-MSGV4 INTO L_MSTRING.
          ELSE.
            REPLACE '&' WITH IMSG-MSGV1 INTO L_MSTRING.
            REPLACE '&' WITH IMSG-MSGV2 INTO L_MSTRING.
            REPLACE '&' WITH IMSG-MSGV3 INTO L_MSTRING.
            REPLACE '&' WITH IMSG-MSGV4 INTO L_MSTRING.
          ENDIF.
          CONDENSE L_MSTRING.
          WRITE : /5 IMSG-MSGTYP,  L_MSTRING .
        ELSE.
          WRITE : /5 IMSG.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " ALL_MESSAGES

    This code will help you to handle the messages/errors...

    rewards Points.

    Cheers

    SAGUN DESAI...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2007 at 05:50 PM

    Hi Lakshmi,

    In session method the process log is automatically created in sm35, when we process the session. Analyse the log see the transaction what are all have errors. correct those and process the session again.

    In call transaction method we have to explicitly handle the errors. for error handling declare an internal table it_messages like bdcmsgcoll.use the extension messages in to it_messages in the call transaction. The call transaction statement will return sy-subrc. If sy-subrc <> 0, then that transaction is errored transaction. After the call transaction check the sy-subrc. If sy-subrc <> 0. call function format_message. This function is called to store the message given by system and to display it along with the record. Append it to the internal table. display the record and message.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.