on 04-02-2015 3:36 AM
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 = 0 .
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.
while doing confirmation through Co11, goods issue used to happen but during goods receipt we used to get error " Order processed by RFC_USER" .
We resolved this issue by using wait statement for longer duration during error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
POST_WRONG_ENTRIES is commented inside " BAPI_PRODORDCONF_CANCEL"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Rechel,
The POST_WRONG_ENTRIES parameter controls which confirmations are transferred into the error pool.
You can correct and re-post the error pool entries via the post-processing of confirmations.
Value range
0: No confirmations
1: Only incorrect confirmations
2: Incorrect confirmations and confirmations that cannot be processed due to a lock situation.
Best Regards,
R.Brahmankar
I am getting error while cancelling the confirmation "Order Processed by RFC_USER"
But it goes to BAPI_TRANSACTION commit but the problem is confirmation is not cancelled(commit does not happen) .
when i try putting breakpoint in bapi_transaction_commit , may be while debugging it gets more time and
then confirmation is cancelled only during debugging . Please help me with below code to cancel confirmation
CALL FUNCTION 'BAPI_PRODORDCONF_CANCEL'
EXPORTING
CONFIRMATION = WA_AFRU-RUECK
CONFIRMATIONCOUNTER = WA_AFRU-RMZHL
POSTG_DATE = sy-datum
* CONF_TEXT =
IMPORTING
RETURN = ZRETURN
LOCKED = ZLOCKED
CREATED_CONF_NO = ZCREATED_CONF_NO
CREATED_CONF_COUNT = ZCREATED_CONF_COUNT.
If SY-SUBRC = 0 .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have carried out below steps
Call function modules ENQUEUE_ESORDER (with parameter AUFNR) and ENQUEUE_EMRKPF (with parameter RSNUM) before calling the BAPI's to check for locks on the order header and the reservation header, respectively
Looping through BAPI_GOODSMVT_CREATE and using wait statement . In case of error ,then cancelling of goods issue & confirmation using BAPI_PRODORDCONF_CANCEL.
But still getting RFC error hence I am not able to rollback goods issue.
I want to know if there is any tcode incase of error i can ask user to run tcode for goods receipt.
Is there way to automate goods receipt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
call function modules ENQUEUE_ESORDER (with parameter AUFNR) and ENQUEUE_EMRKPF (with parameter RSNUM) before calling the BAPI's to check for locks on the order header and the reservation header, respectively
Looping through BAPI_GOODSMVT_CREATE and using wait statement . In case of error ,then cancelling of goods issue & confirmation using BAPI_PRODORDCONF_CANCEL.
But still i am getting RFC error hence I am not able to rollback goods issue.
I want to know if there is any tcode incase of error i user to run tcode for goods receipt.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
I have looped the above BAPI , Incase if i get error for second time i have used
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.
If SY-SUBRC = 0 .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
Please suggest if this will work ,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Rechel
The goods movements in the BAPI are mainly posted in the update program,
It is recommended to set the WAIT parameter in the BAPI - BAPI_TRANSACTION_COMMIT or to use the statement 'COMMIT WORK AND WAIT'
in your own customer program.
Please refer SAP OSS consulting note 744403
Best Regards,
R.Brahmankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
If you are posting the goods receipt using BAPI_GOODSMVT_CREATE, it would not be cancelled by BAPI_PRODORDCONF_CANCEL because you did not post the goods movement during the confirmation.
You can use the control key PP03 on your operation, so that the goods receipt is posted during the confirmation. This way it can be cancelled by BAPI_PRODORDCONF_CANCEL .
Otherwise, you will have to cancel the goods movement individually using BAPI_GOODSMVT_CANCEL.
BR
Caetano
Hello Rachel,
Yes this perform goods movement and confirmation cancellation both. You can try with SE37 and put there test sequence with BAPI_PRODORDCONF_CANCEL & BAPI_TRANSACTION_COMMIT. Now run and check the result.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.