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

After Delivery save trigger event BAPI_GOODSMVT_CREATE how error handling

Former Member
0 Likes
833

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

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

2 REPLIES 2
Read only

Former Member
0 Likes
681

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.


Read only

0 Likes
681

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