Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8150

'BAPI_PRODORDCONF_CANCEL" for cancelling confirmation

$
0
0

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.


Viewing all articles
Browse latest Browse all 8150

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>