‎2008 Dec 10 12:51 PM
Hi Gurus,
I've written following code
select * from ztable
perform create_bom.
endselect
in create_bom ive written a bapi to create bom and immediatley calling BAPI_TRANSACTION_COMMIT. However the program crashes giving dump saying that i cant have commit within my database cursor.
Im i remove the BAPI_TRANSACTION_COMMIT outside ot create_bom subroutine and place it after endsleect everything works fine.
Can any one guide me what is happening ?
Why cant i have a BAPI_TRANSACTION_COMMIT within a select endselect loop.
Thanks !
‎2008 Dec 10 1:04 PM
BAPI_TRANSACTION_COMMIT is similar to COMMIT WORK.
As COMMIT WORK is not allowed within SELECT...ENDSELECT, so you are geting dump.
You can replace SELECT..ENDSELECT with SELECT..INTO ITAB..
LOOP AT ITAB.
perform create_bom.
COMMIT WORK.
ENDLOOP.
‎2008 Dec 10 12:53 PM
Store first all entries of ZTABLE in internal table I_ZTABLE.
Then loop over internal table and do your perform create_bom.
regards,
hans
‎2008 Dec 10 1:02 PM
Please do an F1 on select and you will learn the set of instructions that you cannot have in between a SELECT / ENDSELECT loop.
COMMIT WORK is not possible and will give a dump.
‎2008 Dec 10 1:04 PM
BAPI_TRANSACTION_COMMIT is similar to COMMIT WORK.
As COMMIT WORK is not allowed within SELECT...ENDSELECT, so you are geting dump.
You can replace SELECT..ENDSELECT with SELECT..INTO ITAB..
LOOP AT ITAB.
perform create_bom.
COMMIT WORK.
ENDLOOP.
‎2008 Dec 22 6:52 AM