Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_TRANSACTION_COMMIT in select

Former Member
0 Likes
950

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 !

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
797

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.

4 REPLIES 4
Read only

h_senden2
Active Contributor
0 Likes
797

Store first all entries of ZTABLE in internal table I_ZTABLE.

Then loop over internal table and do your perform create_bom.

regards,

hans

Read only

Former Member
0 Likes
797

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.

Read only

Former Member
0 Likes
798

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.

Read only

Former Member
0 Likes
797

thanks guys