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

BAPI return messages

Hi,

I am writing a custom BAPI in which i am calling XD01 transaction. I want to trap the error message into the BAPI return. How do I do this ?

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Oct 10, 2005 at 06:55 PM

    It is your custom BAPI, so this should not be a problem at all. I hope you are doing the call transaction with the option 'messages into <bdc_mesages_itab>'. Once you add this option, your bdc_messages_itab will contain the error messages from the call transaction. Then all you have to do is to loop at this and fill your BAPI_RETURN structure.

    data: begin of i_bdcmsgcoll occurs 0.
            include structure bdcmsgcoll.
    data: end of i_bdcmsgcoll.
    
    CALL TRANSACTION 'XD01'
               USING BDCDATA
       MESSAGES INTO I_BDCMSGCOLL.
    
    LOOP AT I_BDCMSGCOLL.
      MOVE: I_BDCMSGCOLL-MSGTYP  TO RETURN-TYPE
            I_BDCMSGCOLL-MSGID   TO RETURN-ID
            I_BDCMSGCOLL-MSGNR   TO RETURN-NUMBER
            I_BDCMSGCOLL-MSGV1   TO RETURN-MESSAGE_V1
            I_BDCMSGCOLL-MSGV2   TO RETURN-MESSAGE_V2
            I_BDCMSGCOLL-MSGV3   TO RETURN-MESSAGE_V3
            I_BDCMSGCOLL-MSGV4   TO RETURN-MESSAGE_V4.
      APPEND RETURN.
      CLEAR RETURN.
    ENDLOOP.
    

    Srinivas

    Message was edited by: Srinivas Adavi

    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.