08-11-2006 8:58 AM
Hi all,
I am using Bapi to post records in a loop on internal table itab. After posting records, I am again looping at itab and populating those records to my custom table.
Does this scenario use 2 logical unit of work?
If yes, then please tell me how do I use one logical unit of work.
Thanks,
Ridhima
08-11-2006 9:32 AM
Hey,
You should not post records to the custom table if the BAPI posting has failed.
In order to maintain data consistency the logic in your program should be as below:
LOOP AT itab.
CALL BAPI.
IF BAPI Call is successful
Post data to Custom table.
CALL BAPI_TRANSACTION_COMMIT.
ELSE.
CALL BAPI_TRANSACTION_ROLLBACK.
ENDIF.
ENDLOOP.
Talking about LUW's, any program uses 1 SAP LUW and Multiple Database LUWs depending on the number times you COMMIT the data to the database.
If in your program you were to use only one COMMIT statement or no COMMIT statement at all, your program would use 1 SAP LUW and 1 database LUW.
-Kiran
*Please mark useful answers
08-11-2006 9:32 AM
Hey,
You should not post records to the custom table if the BAPI posting has failed.
In order to maintain data consistency the logic in your program should be as below:
LOOP AT itab.
CALL BAPI.
IF BAPI Call is successful
Post data to Custom table.
CALL BAPI_TRANSACTION_COMMIT.
ELSE.
CALL BAPI_TRANSACTION_ROLLBACK.
ENDIF.
ENDLOOP.
Talking about LUW's, any program uses 1 SAP LUW and Multiple Database LUWs depending on the number times you COMMIT the data to the database.
If in your program you were to use only one COMMIT statement or no COMMIT statement at all, your program would use 1 SAP LUW and 1 database LUW.
-Kiran
*Please mark useful answers
11-14-2010 5:43 AM
Hi Ridhima,
When Function module is called from within a program, then does another LUW start ?
Regards,
Chitwanjit