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

Problem with BAPI_TRANSACTION_COMMIT in Loop.

manoj_goyal2
Participant
0 Likes
1,643

Hi Guys,

I am having problem with above bapi.  Below is my code:

Tcode :  ZABC calls tcode ZABC_2.

CALL TRANSACTION 'ZABC_2' USING it_bdc MODE 'E'
                            MESSAGES INTO it_mess.

Below is the program in Tcode ZABC_2.

LOOP AT ITAB_1.
     
LOOP AT ITAB_2.

                     CALL FUNCTION 'F_UPDATE' IN UPDATE TASK
                    
COMMIT WORK AND WAIT.  

     ENDLOOP.
     
IF mode = create.

                PERFORM f_create_new.
     
ENDIF.

ENDLOOP.

FORM F_CREATE_NEW.

        CALL FUNCTION ‘ZBAPI_1’.

        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          
EXPORTING
          
wait = 'X'.

ENDFORM

There are 5 records in ITAB_1. But loop ITAB_1 is executed only 1 time and control comes out of loop ITAB_1.

Bapi ZBAPI_1 only excute one time. Thru debugger I followed until BAPI_TRANSACTION_COMMIT. After that it comes out of the loop completely, and control goes back to tcode ZABC.

I idea what wrong I am doing.

Thanks a lot.


1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,028

Read online documentation on COMMIT WORK or press F1.

In a program executed using batch input, or if you have called the program using the USING addition of the statement CALL TRANSACTION, COMMIT WORK terminates the batch input processing when using the corresponding settings.

Also true for BAPI_TRANSACTION_COMMIT.

So first commit will end the CALL TRANSACTION 'ZABC_2' USING...

Regards,

Raymond

3 REPLIES 3
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,029

Read online documentation on COMMIT WORK or press F1.

In a program executed using batch input, or if you have called the program using the USING addition of the statement CALL TRANSACTION, COMMIT WORK terminates the batch input processing when using the corresponding settings.

Also true for BAPI_TRANSACTION_COMMIT.

So first commit will end the CALL TRANSACTION 'ZABC_2' USING...

Regards,

Raymond

Read only

0 Likes
1,028

Hi Raymond,

I think the soultion lies in reading the f1 help of call transaction & the option RACOMMIT in it.

Read only

0 Likes
1,028

(Shhh, there is a link to this document in my answer, but it would have been more instructive if the requester had clicked on it, finding the answer himself )