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

FM Inside Loop - Lock Issue

Former Member
0 Likes
1,496

Hi all,

         I am using a FM to assign Revision level to  many materials - REVISION_LEVEL_INSERT - I believe this is not BAPI as its not Remote enabled . 

        Problem is only first record is getting updated . Even though FM  returns success message for all the remaining records its not updating in Table .

Loop ...FM

FM call

if sy-subrc eq 0

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  EXPORTING

    WAIT          = 'X'

* IMPORTING

*   RETURN        =

           .

endif

endloop...

        Did i miss anything here. I guess I am not committing it properly or Object(Change Number ) Locked  and  so further records did not update ..Help please.

Thanks,

Srini.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,132

Thanks all for you suggestions..I found that i have to do INIT and Reset at the beginning and end of loop..

REVISION_LEVEL_BUFFER_INIT

REVISION_LEVEL_BUFFER_RESET

This Solved.

Thanks,

Srini.

5 REPLIES 5
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,132

Use CCAP_REV_LEVEL_MAINTAIN. The lock & unlock is handled internally.

Read only

Private_Member_49934
Product and Topic Expert
Product and Topic Expert
0 Likes
1,132

Such problem occurs when global data of function group and not intialized and they are buffered for subsiquient run.

Not sure but you may try one thing. call the function CCRL_INIT of the same function group before actual function call.

Loop ...FM

call funcion CCRL_INIT

FM call

if sy-subrc eq 0

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  EXPORTING

    WAIT          = 'X'

* IMPORTING

*   RETURN        =

           .

endif

endloop...

Read only

Former Member
0 Likes
1,133

Thanks all for you suggestions..I found that i have to do INIT and Reset at the beginning and end of loop..

REVISION_LEVEL_BUFFER_INIT

REVISION_LEVEL_BUFFER_RESET

This Solved.

Thanks,

Srini.

Read only

0 Likes
1,132

Did you notice that CCRL_INIT calls the fm you listed plus clears some other global variables.?

Below is the code of this FM. I still suggest use this FM instead.

  

   clear itaeoib.
   refresh itaeoib.

   call function 'REVISION_LEVEL_BUFFER_RESET'
        exceptions
             others  = 0.

   call function 'REVISION_LEVEL_BUFFER_INIT'
        exceptions
             others  = 0.

Read only

0 Likes
1,132

Hi,

If sy-subrc is not initial, and if necessary, you can call 'BAPI_TRANSACTION_ROLLBACK', that refresh the buffers.

Regards,

Maria João Rocha