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

PM Order Release - many BAPI`s in loop - how?

Former Member
0 Likes
1,478

Hello,

I have problem with releasing many orders in loop.

My code is like:

LOOP AT itab INTO wa.

l_aufnr = wa-OBJNR+2(12).

       CALL FUNCTION 'IBAPI_ALM_ORDER_RELEASE'
         EXPORTING
           IV_ORDERID  = l_aufnr
         TABLES
           ET_MESSAGES = lt_messages.

*      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT          = 'X'
*       IMPORTING
*         RETURN        =
                 .

ENDLOOP.


After first loop it is ok. During second loop I have errors in lt_messages.

" Order &: Release rejected"

MSGID: C2   MSGNO: 009

Why during second loop I have error? Is there any way to release many orders in loop?

Would be grateful for any help.

Hello,

I have problem with releasing many orders in loop.

My code is like:

LOOP AT itab INTO wa.

l_aufnr = wa-OBJNR+2(12).

       CALL FUNCTION 'IBAPI_ALM_ORDER_RELEASE'
         EXPORTING
           IV_ORDERID  = l_aufnr
         TABLES
           ET_MESSAGES = lt_messages.

*      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT          = 'X'
*       IMPORTING
*         RETURN        =
                 .

ENDLOOP.


After first loop it is ok. During second loop I have errors in lt_messages.

" Order &: Release rejected"

MSGID: C2   MSGNO: 009

Why during second loop I have error? Is there any way to release many orders in loop?

Would be grateful for any help.

5 REPLIES 5
Read only

Former Member
0 Likes
1,045

Did you sort and remove the duplicate object numbers from the internal table?

Is it possible that there is something wrong with the orders?

Read only

0 Likes
1,045

In itab i have only 1 entry (duplicates removed) for each order so there are no two identical OBJNR in tab.

Read only

0 Likes
1,045

Do you get errors for all orders after the first loop pass?

Read only

0 Likes
1,045

I always test using 2 new added orders. Everytime 1st one is released and 2nd not. It seems like there is a problem with commit transaction or am I wrong?

Read only

0 Likes
1,045

I dont see anything wrong with the Commit.

Can you try with more than 2 orders ?