2019 Jul 25 11:18 AM
I want to create Purchase order based on material document in transaction MB1B,
1. IF_EX_MB_DOCUMENT_BADI ~ MB_DOCUMENT_BEFORE_UPDATE
2. IF_EX_MB_DOCUMENT_BADI ~ MB_DOCUMENT_UPDATE
3. EXIT_SAPLMBMB_001
I call "BAPI_PO_CREATE" function in Badi and exits above, I get the following error.
Many thanks in advance for your help
Category ABAP programming error
Runtime Errors COMMIT_IN_POSTING
ABAP Program SAPLBAPT
Application Component BC-MID-ALE
Short Text
Invalid COMMIT WORK in an update function module.
Information on where terminated
The termination occurred in the ABAP program or include "SAPLBAPT", in "TRANSACTION_END". the main program was "RSM13000". In the source code, the termination point is in line 10 of the program or include "LBAPTU05". The program "SAPLBAPT" was started in the update system.
2019 Aug 06 2:34 PM
Hi,
Don't use commit work with this BAPI, You must call BAPI_PO_CREATE function module as
CALL FUNCTION 'BAPI_PO_CREATE' IN UPDATE TASK. Otherwise It will give dump. Don't your
Try to call the BAPI_PR_CREATE1 in background task so that it creates a separate task.
In this case commit is not required. The task will start after commit has occured in the current transaction.
Regards,
Nawa
2019 Aug 06 2:14 PM
Hi everyone,
I copied the problem with the BAPI_PO_CREATE function as ZBAPI_PO_CREATE and ran it as a background,
2019 Aug 06 2:18 PM
if you have copied the function, maybe you could try to set asynchronous
call function in update task ..
it seems something is doing a comit, at the wrong moment
2019 Aug 06 2:34 PM
Hi,
Don't use commit work with this BAPI, You must call BAPI_PO_CREATE function module as
CALL FUNCTION 'BAPI_PO_CREATE' IN UPDATE TASK. Otherwise It will give dump. Don't your
Try to call the BAPI_PR_CREATE1 in background task so that it creates a separate task.
In this case commit is not required. The task will start after commit has occured in the current transaction.
Regards,
Nawa
2019 Aug 06 4:54 PM
I don't really understand the way you say it.
I'd say: if one uses "commit work" during the update task, that triggers COMMIT_IN_POSTING. That is logic because an update task is being triggered via commit work, so commit work inside commit work is non-sense. C.f. ABAP documentation of COMMIT WORK.
Using IN BACKGROUND TASK (tRFC/SM58) is possible and should be executed before the standard commit work too (can also be executed inside the update task but that doesn't change anything).