11-21-2007 9:15 AM
Hi Experts,
I need some advice about prod. ord. confirmation using bapi BAPI_PRODORDCONF_CREATE_TT in SAP R/3 7.00.
This works fine 99'9% of time, but sometimes I get OK from the bapi but still remaining errors in CO1P, wich prevents furter operation in this order (I need to settle the order trough batch input in KO88 and cancel notification through BAPI_PRODORDCONF_CANCEL in case KO88 fails)
I've tried all combinations of parameter POST_WRONG_ENTRIES with same results, BAPI always returns OK but confirmation still incomplete and order blocked for further processing until somebody resolves CO1P/COGI manually.
The error in CO1P usually has a "Backflush" message.
Is there any way to force a bapi failure in case something goes wrong in confirmation, avoiding CO1P/COGI? Or is it posible to catch an process such errors before KO88 or BAPI_PRODORDCONF_CANCEL?
I've searched forum and wiki and nobody seems to have trouble with this issue (maybe there's an OSS note wich solves it)
thanks and regards,
F. Blay
12-18-2007 3:41 PM
Done!
I'll explain becaus sb could have the same problem.
We can check if confirmation has finished completely using BAPI_PRODORDCONF_GETDETAIL which indicates if goods movements are already done.
Sample code:
FUNCTION ZCHECKLOCKOF.
*"----------------------------------------------------------------------
*"*"Interfase local
*" IMPORTING
*" REFERENCE(I_RUECK) TYPE CO_RUECK
*" REFERENCE(I_RMZHL) TYPE CO_RMZHL
*" REFERENCE(I_TRIES) TYPE I DEFAULT 3
*" EXCEPTIONS
*" BLOCKED
*" MOVERROR
*"----------------------------------------------------------------------
DATA tp_tries TYPE sy-tabix.
DATA wa_return TYPE BAPIRET1.
DATA wa_conf_detail TYPE BAPI_PP_CONFIRM.
DATA ta_gdgoodsmovements TYPE TABLE OF BAPI2017_GM_ITEM_SHOW.
DATA ta_failedgmoves TYPE TABLE OF BAPI_CORU_FGM.
DATA wa_failedgmoves TYPE BAPI_CORU_FGM.
tp_tries = 1.
*"Infinite loop
WHILE 0 = 0.
CLEAR sy-subrc.
CLEAR wa_return.
CLEAR wa_conf_detail.
REFRESH ta_gdgoodsmovements.
REFRESH ta_failedgmoves.
CALL FUNCTION 'BAPI_PRODORDCONF_GETDETAIL'
EXPORTING
confirmation = i_rueck
confirmationcounter = i_rmzhl
IMPORTING
RETURN = wa_return
CONF_DETAIL = wa_conf_detail
TABLES
GOODSMOVEMENTS = ta_gdgoodsmovements
FAILEDGMOVES = ta_failedgmoves.
IF sy-subrc <> 0 OR ta_failedgmoves[] IS NOT INITIAL.
*" Some goods movements not yet done
READ TABLE ta_failedgmoves INTO wa_failedgmoves WITH KEY MSG_TYPE = 'E'.
IF sy-subrc = 0.
*" Some goods movement has an error so exit
RAISE MOVERROR.
ENDIF.
*" ORDER blocked
IF tp_tries GE i_tries.
*" Limit of tries reached
RAISE BLOCKED.
ENDIF.
ELSE.
*" ORDER not blocked
EXIT.
ENDIF.
*" Wait 1 sec. and increment tries
WAIT UP TO 1 SECONDS.
tp_tries = tp_tries + 1.
ENDWHILE. " 0 = 0?
ENDFUNCTION.
regards
Edited by: Francisco Blay on Jul 9, 2009 7:21 PM
12-18-2007 3:41 PM
Done!
I'll explain becaus sb could have the same problem.
We can check if confirmation has finished completely using BAPI_PRODORDCONF_GETDETAIL which indicates if goods movements are already done.
Sample code:
FUNCTION ZCHECKLOCKOF.
*"----------------------------------------------------------------------
*"*"Interfase local
*" IMPORTING
*" REFERENCE(I_RUECK) TYPE CO_RUECK
*" REFERENCE(I_RMZHL) TYPE CO_RMZHL
*" REFERENCE(I_TRIES) TYPE I DEFAULT 3
*" EXCEPTIONS
*" BLOCKED
*" MOVERROR
*"----------------------------------------------------------------------
DATA tp_tries TYPE sy-tabix.
DATA wa_return TYPE BAPIRET1.
DATA wa_conf_detail TYPE BAPI_PP_CONFIRM.
DATA ta_gdgoodsmovements TYPE TABLE OF BAPI2017_GM_ITEM_SHOW.
DATA ta_failedgmoves TYPE TABLE OF BAPI_CORU_FGM.
DATA wa_failedgmoves TYPE BAPI_CORU_FGM.
tp_tries = 1.
*"Infinite loop
WHILE 0 = 0.
CLEAR sy-subrc.
CLEAR wa_return.
CLEAR wa_conf_detail.
REFRESH ta_gdgoodsmovements.
REFRESH ta_failedgmoves.
CALL FUNCTION 'BAPI_PRODORDCONF_GETDETAIL'
EXPORTING
confirmation = i_rueck
confirmationcounter = i_rmzhl
IMPORTING
RETURN = wa_return
CONF_DETAIL = wa_conf_detail
TABLES
GOODSMOVEMENTS = ta_gdgoodsmovements
FAILEDGMOVES = ta_failedgmoves.
IF sy-subrc <> 0 OR ta_failedgmoves[] IS NOT INITIAL.
*" Some goods movements not yet done
READ TABLE ta_failedgmoves INTO wa_failedgmoves WITH KEY MSG_TYPE = 'E'.
IF sy-subrc = 0.
*" Some goods movement has an error so exit
RAISE MOVERROR.
ENDIF.
*" ORDER blocked
IF tp_tries GE i_tries.
*" Limit of tries reached
RAISE BLOCKED.
ENDIF.
ELSE.
*" ORDER not blocked
EXIT.
ENDIF.
*" Wait 1 sec. and increment tries
WAIT UP TO 1 SECONDS.
tp_tries = tp_tries + 1.
ENDWHILE. " 0 = 0?
ENDFUNCTION.
regards
Edited by: Francisco Blay on Jul 9, 2009 7:21 PM
10-24-2019 4:10 AM