Skip to Content

After Delivery save trigger event BAPI_GOODSMVT_CREATE how error handling

Hi Gurus,

I created an Event which is been triggered after creating of delivery.

In this Event some goods movement is been done(BAPI_GOODSMVT_CREATE)-This is working.

I now want to implement some error processing.

I want that if the delivery is saved and the BAPI_GOODSMVMT_CREATE is executed

and if there error occur in BAPI_GOODSMVT_CREATE user should be informed somehow.

But the delivery should stay untouched. So only for BAPI_GOODSMVT_CREATE should come

some error message or anything.

Please help how you would implement the error processing?

Thanks+Regards

Dieter

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 16, 2014 at 10:50 AM

    hi,

    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
    GOODSMVT_HEADER = head
    GOODSMVT_CODE = code
    * TESTRUN = ' '
    * GOODSMVT_REF_EWM =
    IMPORTING
    GOODSMVT_HEADRET = output
    * MATERIALDOCUMENT =
    * MATDOCUMENTYEAR =
    TABLES
    GOODSMVT_ITEM = item
    * GOODSMVT_SERIALNUMBER =
    RETURN = ret
    * GOODSMVT_SERV_PART_DATA =
    * EXTENSIONIN =
    .

    if ret is INITIAL.

    WRITE:/ 'MATERIAL DOCUMENT POSTED:' , OUTPUT-MAT_DOC , OUTPUT-DOC_YEAR , 'FOR MATERIAL' ,TA_FLATFILE-MATNR.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'.

    ELSE.

    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

    LOOP AT RET.
    CONCATENATE
    RET-TYPE
    RET-ID
    RET-MESSAGE
    RET-LOG_NO
    RET-log_msg_no
    RET-message_v1
    RET-message_v2
    RET-message_v3
    RET-message_v4
    'FOR MATERIAL'
    TA_FLATFILE-MATNR
    INTO STR SEPARATED BY SPACE.

    WRITE:/ 'ERROR WHILE POSTING MATERIAL DOCUMENT:' , STR.

    ENDLOOP.

    ENDIF.


    Add a comment
    10|10000 characters needed characters exceeded

    • Hi

      For catching Error U can use Function module 'Format Massage'

      Please go through below code

      IF SY-SUBRC <> 0.

      CALL FUNCTION 'FORMAT_MESSAGE'

      EXPORTING

      ID = SY-MSGID

      NO = SY-MSGNO

      V1 = SY-MSGV1

      V2 = SY-MSGV2

      IMPORTING

      MSG = E_MSGOUT.

      ENDIF.

      Regards

      Ashraf Usmani

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.