04-16-2009 9:43 AM
Hi experts,
I need to change goods receipt storage location, work centers and component storage location in production order, if some specific user status is maintained.
So I'm using BADI WORKORDR_UPDATE, method BEFORE_UPDATE, where I call some function in update task.
This function has delayed start (V2) and change all required things using BAPI_ALM_ORDER_MAINTAIN.
Problem is, that wen I run it, I got message 'Update was terminated' with reason COMMIT_IN_POSTING.
I have check the code and didn't find any commit work statement.
Could someone help me?
Thanks®ards,
jirka
04-16-2009 9:49 AM
Hi,
Since you are doing changes in update task,the system will COMMIT the changes.
If u want to see this in Debugger,You have to switch on system debugger through settings (UPDATE Debugger).
More over this issue is the temporary only.I think once you logged off and re logon issue will be resolved.
Thanks,
Pradeep
04-16-2009 9:50 AM
Hi
U should post the code where the dump occurs, it seems somthing calls a COMMIT in a process in update tusk.
Max
04-16-2009 10:18 AM
FUNCTION Z_PP_PREPLANOVANI.
*"----
-
""Aktualizaení funkení modul:
*"
""Lokální rozhraní:
*" IMPORTING
*" VALUE(P_AUFNR) TYPE CO_AUFNR
*"----
-
DATA: lt_jest TYPE TABLE OF jest,
ls_jest TYPE jest,
lv_objnr TYPE j_objnr,
lv_prctr TYPE caufvd-prctr,
lv_lgort TYPE afpo-lgort,
lv_lgort_test type afpo-lgort,
ls_s022 TYPE s022,
lt_s022 TYPE TABLE OF s022,
lt_s022_new TYPE TABLE OF s022,
ls_resb TYPE resb,
lt_resb TYPE TABLE OF resb,
ls_order TYPE bapi_pp_order_change,
ls_orderx TYPE bapi_pp_order_changex,
ls_return TYPE bapiret2,
lt_return type table of bapiret2,
lv_operace TYPE i.
DATA: lt_operace TYPE TABLE OF bapi_order_operation1,
ls_operace TYPE bapi_order_operation1,
lt_komponenty TYPE TABLE OF bapi_order_component,
ls_komponenty TYPE bapi_order_component.
data: lt_methods type table of BAPI_ALM_ORDER_METHOD,
ls_methods type BAPI_ALM_ORDER_METHOD,
lt_oper1 type table of BAPI_ALM_ORDER_OPERATION,
ls_oper1 type BAPI_ALM_ORDER_OPERATION,
lt_komp1 type tABLE of BAPI_ALM_ORDER_COMPONENT,
ls_komp1 type BAPI_ALM_ORDER_COMPONENT,
ls_kompx type BAPI_ALM_ORDER_COMPONENT_UP,
lt_kompx type table of BAPI_ALM_ORDER_COMPONENT_UP,
ls_operx type BAPI_ALM_ORDER_OPERATION_UP,
lt_operx type table of BAPI_ALM_ORDER_OPERATION_UP.
CONSTANTS: lc_bolatice TYPE i VALUE 1,
lc_vitkov TYPE i VALUE 2.
FIELD-SYMBOLS: TYPE s022.
CONCATENATE 'OR' p_aufnr INTO lv_objnr.
kontrola statusu OTEV
select single * into ls_jest
from jest
where objnr = lv_objnr
and inact = ''
and stat = 'I0001'.
check sy-subrc = 0.
*precteni uzivatelskeho statusu
SELECT SINGLE * INTO ls_jest
FROM jest WHERE objnr = lv_objnr
AND inact = ''
AND stat >= 'E0009'
AND stat <= 'E0012'.
CHECK sy-subrc = 0.
CASE ls_jest-stat.
WHEN 'E0009' OR 'E0011'.
lv_lgort = '1V47'.
lv_prctr = 'CZ101600'.
lv_operace = lc_bolatice.
WHEN 'E0010' OR 'E0012'.
lv_lgort = '2V49'.
lv_prctr = 'CZ101602'.
lv_operace = lc_vitkov.
ENDCASE.
CLEAR ls_order.
CLEAR ls_orderx.
ls_order-storage_location = lv_lgort.
ls_order-profit_center = lv_prctr.
ls_orderx-storage_location = 'X'.
ls_orderx-profit_center = 'X'.
zmena profit centra a skladu
CALL FUNCTION 'BAPI_PRODORD_CHANGE'
EXPORTING
number = p_aufnr
orderdata = ls_order
orderdatax = ls_orderx
IMPORTING
return = ls_return
.
check ls_return-type NE 'E'.
CLEAR ls_return.
*zmena pracoviste u operaci
CALL FUNCTION 'BAPI_PRODORD_GET_DETAIL'
EXPORTING
number = p_aufnr
order_objects = ' XX '
IMPORTING
return = ls_return
TABLES
operation = lt_operace
component = lt_komponenty.
CHECK ls_return-type NE 'E'.
REFRESH: LT_METHODS,
lt_oper1,
lt_komp1,
lt_kompx,
lt_operx.
LOOP AT LT_OPERACE INTO LS_OPERACE.
clear ls_methods.
ls_methods-refnumber = sy-tabix.
ls_methods-objecttype = 'OPERATION'.
ls_methods-method = 'CHANGE'.
concatenate p_aufnr ls_operace-operation_number into ls_methods-objectkey.
append ls_methods to lt_methods.
clear ls_oper1.
ls_oper1-activity = ls_operace-operation_number.
ls_oper1-work_cntr = ls_operace-work_center.
if lv_operace = lc_bolatice.
ls_oper1-work_cntr(2) = '47'.
elseif lv_operace = lc_vitkov.
ls_oper1-work_cntr(2) = '49'.
endif.
append ls_oper1 to lt_oper1.
clear ls_operx.
ls_operx-WORK_CNTR = 'X'.
append ls_operx to lt_operx.
ENDLOOP.
loop at lt_komponenty into ls_komponenty.
clear ls_methods.
ls_methods-refnumber = sy-tabix.
ls_methods-objecttype = 'COMPONENT'.
ls_methods-method = 'CHANGE'.
concatenate p_aufnr ls_komponenty-operation ls_komponenty-ITEM_NUMBER into ls_methods-objectkey.
append ls_methods to lt_methods.
clear ls_komp1.
ls_komp1-reserv_no = ls_komponenty-RESERVATION_NUMBER.
ls_komp1-RES_ITEM = ls_komponenty-RESERVATION_ITEM.
ls_komp1-activity = ls_komponenty-operation.
ls_komp1-STGE_LOC = lv_lgort.
append ls_komp1 to lt_komp1.
clear ls_kompx.
ls_kompx-STGE_LOC = 'X'.
append ls_kompx to lt_kompx.
endloop.
clear ls_methods.
ls_methods-method = 'SAVE'.
append ls_methods to lt_methods.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = lt_methods
IT_OPERATION = lt_oper1
IT_OPERATION_UP = lt_operx
IT_COMPONENT = lt_komp1
IT_COMPONENT_UP = lt_kompx
RETURN = lt_return .
read table lt_return into ls_return with key type = 'E'.
check sy-subrc ne 0.
ENDFUNCTION.
04-16-2009 10:23 AM
Hi
Probably is the bapi BAPI_ALM_ORDER_MAINTAIN calls the COMMIT:
Try to delete the call of that BAPI and then run the trx
Max
04-16-2009 12:42 PM
Hi,
so I delete all BAPI`s, which caused commit and did reading data manualy directly from database. Now, I got error MESSAGE_TYPE_X. If I go to SM13 and debbug, everything goes OK, but no changes are made in database and status of proces in sm13 is this:
1 Z_PP_PREPLANOVANI V2 Initial
2 CO_VB_ORDER_POST V1 Processed
3 MCF_STATISTICS_UPD_V2 V2 Initial
4 MCF_MCKALK_VERSION_UPD_V1 V1 Processed
5 MCF_VERSION_UPD_V1 V1 Processed
header status is Error in V2 part.
So what is the problem now?
Thanks®ards,
Jirka
04-16-2009 1:05 PM