Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

'BAPI_PRODORDCONF_CANCEL" for cancelling confirmation

Hi,

We are using customized report for Production order confirmation . Below are steps

1. Goods issue

2. Calling transaction Co11 for confirmation (BDC)

3 Goods receipt using BAPI_GOODSMVT_CREATE

while running the program , it throws the "Order processed by RFC_USER" . We have tried enquque, dequeue , wait  but error pops up randomly.

We have carried out few steps but still we are getting error sometimes.

The issue is that goods issue & confirmation is happening but not goods receipt hence we are  are now trying to revert the goods issue & confirmation through "BAPI_PRODORDCONF_CANCEL" .  i have pasted my code , please  suggest if by using "BAPI_PRODORDCONF_CANCEL"

will it  revert goods issue & confirmation .

*****************************************************************************************************************************

SELECT RUECK RMZHL

   from AFRU

   INTO IT_AFRU

  WHERE   AUFNR = zaufnr

AND ERNAM = Sy-uname

AND ERSDA = sy-datum


SORT IT_AFRU descending RUECK RMZHL.

 

   DO N Times.                                                                                                    " N=2

               CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

                 EXPORTING

                   goodsmvt_header  = ls_goodsmvt_header

                   goodsmvt_code    = ls_goodsmvt_code"'02' "ls_goodsmvt_code

                 IMPORTING

                   goodsmvt_headret = ls_goodsmvt_headret

                   materialdocument = lv_materialdocument1

                 TABLES

                   goodsmvt_item    = lt_goodsmvt_item1

                   return           = lt_return.

*

               CLEAR : IT_ENQ, IT_ENQ[],wa_enq.                

               READ TABLE lt_return INTO lwa_return WITH KEY type = 'E'.

               If sy-subrc  = .

                 Count = Count + 1.

                 IF Count < N .

                   CLEAR : ls_goodsmvt_headret,lv_materialdocument2.

                   CLEAR : lt_return, lt_return[].

                 ELSE.

  

   READ TABLE IT_AFRU into WA_AFRU index 1.

              

                  CALL FUNCTION 'BAPI_PRODORDCONF_CANCEL'

                    EXPORTING

                      CONFIRMATION              = WA_AFRU-RUECK

                      CONFIRMATIONCOUNTER       = WA_AFRU-RMZHL

*                    POSTG_DATE                =

*                    CONF_TEXT                 =

                   IMPORTING

                     RETURN                    =   ZRETURN

                     LOCKED                    ZLOCKED

                     CREATED_CONF_NO           ZCREATED_CONF_NO

                     CREATED_CONF_COUNT        ZCREATED_CONF_COUNT

  

              

                   

                ENDIF.

               

               else .

                 EXIT.

               ENDIF.

*              READ TABLE lt_return INTO lwa_return WITH KEY type = 'E'.

*              If sy-subrc  NE 0  .

*                EXIT.

*              ENDIF.

             ENDDO.

Former Member
Former Member replied


Just wanted to update you all before closing this discussion that we had resolved this issue by looping through "BAPI_GOODSMVT_CREATE.  if it gets error during  first iteration then wait for 20 secs. when it goes through loop for second time , doesnt throw error "order processed by RFC_USER".


Thank you all for your suggestions.




0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question