2014 Jan 21 12:35 PM
Hello Experts,
I have requirement to incorporate certain logic by creating an implementation in BADI "workorder_update" . I have coded the logic but i get a runtime error stating that "Invalid COMMIT WORK in an update function module." When i explored further I found that this error is arising from function module " BAPI_MATERIAL_PLANNING " for which I have coded as below ,
CALL FUNCTION 'BAPI_MATERIAL_PLANNING'
EXPORTING
material = it1-matnr
plant = it1-werks
* MRP_AREA =
* PLAN_SCENARIO =
MRP_PLAN_PARAM = it_mrp_list
* MATERIAL_EVG =
IMPORTING
* MRP_STATISTIC =
return = t_return
* TABLES
* mrp_lists = iit_mrp_list
* EXTENSIONOUT =
.
*checking if return result from BAPI_MATERIAL_PLANNING was success.
IF l1_return-type = 'S'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
IMPORTING
RETURN = t_return
.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN = t_return
.
endif.
Thanks & regards ,
Prakrita Kapoor.
2014 Feb 06 9:46 AM
Hi all ,
I could find the solution for the above problem . I created a function module and called it in IN_UPDATE method as follow .
CALL FUNCTION 'Zxxxxx' STARTING NEW TASK 'UPDATE'.
Inside it , I added the above mentioned code and it worked without the commit work error.
Thank you all for the replies .
Hope I will get your support in my future discussions .
Thanks & regards ,
Prakrita Kapoor.
2014 Jan 21 12:44 PM
Hi Prakrita,
Please ask your basis team to refresh the system, since the code is from standard FM.
This have worked in certain cases.
Also try removing the badis that you have used for rollback and commit statements. This will work.
Thanks,
Satish
2014 Jan 21 1:19 PM
Hi Prakrita,
Go through the function module documentation which clearly states
For the single- and multi-level planning, the planning results are posted by
materials. The COMMIT WORK command is executed after every planned
material.
This means there is no need to explicility to do another commit by
'BAPI_TRANSACTION_COMMIT'
So remove the commit and rollback statements.
Hope this helps.
Thanks,
Tooshar Bendale
2014 Feb 02 11:45 AM
Hi Tooshar,
Inspite of removing the commit and rollback statements ,still I am getting the same runtime error. Could you please let me know where I am going wrong or if there is any alternative ways of doing it ?
Thanks & regards,
Prakrita Kapoor.
2014 Jan 21 1:28 PM
Yes I agree with Tushar.
We can see there is in an implicit COMMIT WORK done by the system.
SAP Notes in the Function Module Documentation:
COMMIT control
For the single- and multi-level planning, the planning results are posted by materials. The COMMIT WORK command is executed after every planned material.
Regards,
Tanmoy
2014 Feb 06 9:46 AM
Hi all ,
I could find the solution for the above problem . I created a function module and called it in IN_UPDATE method as follow .
CALL FUNCTION 'Zxxxxx' STARTING NEW TASK 'UPDATE'.
Inside it , I added the above mentioned code and it worked without the commit work error.
Thank you all for the replies .
Hope I will get your support in my future discussions .
Thanks & regards ,
Prakrita Kapoor.
2014 Feb 06 10:02 AM
Nice that you posted the answer prakrita
This will really be helpful for all other members who go through this thread Good work
and also glad that you found the solution
thanks,
Satish