Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

capture an error while creating a purchase requisition (BAPI_PR_CREATE)

Former Member
0 Likes
517

Hi All,

I am using FM BAPI_PR_CREATE to create purchase requesition, Now my problem is that i have various items for single material now i wan to capture the error if any item has ?

Please let me know how to do so?

Thanks & Regards,

Ruchi Tiwari

3 REPLIES 3
Read only

Former Member
0 Likes
441

Hi,

Use parameter RETURN in BAPI which Contains all system messages issued during processing.

Now if you report is running in background then uplad a Error log file in application server.

Thanks & regards,

ShreeMohan

Read only

Former Member
0 Likes
441

Hi,

To get the error messages after the BAPI_PR_CREATE is called,

loop at the return table which will contain the system messages and call the following FM


CALL FUNCTION 'FORMAT_MESSAGE'
        EXPORTING
          ID        = LS_MESSAGES-MSGID
          LANG      = '-D'
          NO        = LS_MESSAGES-MSGNR
          V1        = LS_MESSAGES-MSGV1
          V2        = LS_MESSAGES-MSGV2
          V3        = LS_MESSAGES-MSGV3
          V4        = LS_MESSAGES-MSGV4
        IMPORTING
          MSG       = LV_MESSAGE
        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.

Read only

Former Member
0 Likes
441

self solved