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 gives short dump

Former Member
0 Likes
2,564

Hello Gurus,

I have a problem. I m using the BAPI and after that ım committing my changes to the database.

However, I get a short dump. It says unexpected commit work. My source code is


call function 'BAPI_GOODSMVT_CREATE'
      exporting
        goodsmvt_header  = gs_goodsmvt_header
        goodsmvt_code    = gs_goodsmvt_code
      importing
        goodsmvt_headret = gs_goodsmvt_headret
      tables
        goodsmvt_item    = gt_goodsmvt_item
        return           = gt_return.

    clear : lv_hata.
    loop at gt_return into gv_return.
      if gv_return-type eq 'E'.
        lv_hata = 'X'.
      endif.
    endloop.

*  CLEAR : gt_messages, gt_messages[].
    if lv_hata is initial.
      call function 'BAPI_TRANSACTION_COMMIT'
         exporting
          wait   = 'X'
        importing
          return = bapi_return2.
    endif.

My return table is empty. What may be the reason. Thanks in advance

Edited by: Neil Gardiner on Dec 9, 2010 11:37 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,139

hi,


 CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        GOODSMVT_HEADER  = LS_GOODSMVT_HEADER
        GOODSMVT_CODE    = '01'
      IMPORTING
        MATERIALDOCUMENT = LV_MATERIALDOCUMENT
      TABLES
        GOODSMVT_ITEM    = LT_GOODSMVT_ITEM_BAPI
        RETURN           = LT_RETURN_GR.


    IF LV_MATERIALDOCUMENT IS NOT INITIAL.
      DATA : LT_RETURN_GOODS TYPE BAPIRET2.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT   = 'X'
        IMPORTING
          RETURN = LT_RETURN_GOODS.
endif.

Edited by: Neil Gardiner on Dec 9, 2010 11:38 AM

16 REPLIES 16
Read only

Former Member
0 Likes
2,139

How did you declare the bapi_return2? And check the detail analysis of the dump in ST22.

Vishwa.

Read only

0 Likes
2,139

bapi_return2 type bapiret2.

I have already checked the details. It is just what ı wrote in the first post.:(

ERROR MESSAGE: In order processing, a commit work may not be carried out until the save process is finished because otherwise the order data may be posted incorrectly or incopletely.

Edited by: OSMANBIYIK on Dec 8, 2010 10:44 AM

Read only

0 Likes
2,139

Looks like there is a user-exit or BADI containing a COMMIT WORK.

Read only

0 Likes
2,139

Write WAIT UP TO 2 SECONDS. before the commit BAPI and check if the dump is happening.

Vishwa.

Read only

0 Likes
2,139

Hi

Try to check update request by trx SM13

Max

Read only

0 Likes
2,139

WHat to do now. I cannot delete it. THey are different from each other. How can ı make them work together.

Read only

0 Likes
2,139

TO Visha: Yes, it is again happening:(

Edited by: OSMANBIYIK on Dec 8, 2010 10:53 AM

Read only

0 Likes
2,139

can u please post the dump caused...

Thanks and Regards

S.Janagar

Read only

0 Likes
2,139

>

> ERROR MESSAGE: In order processing, a commit work may not be carried out until the save process is finished because otherwise the order data may be posted incorrectly or incopletely.

>

> Edited by: OSMANBIYIK on Dec 8, 2010 10:44 AM

I am curious: is this piece of code written in a separate program or did you write it in a user-exit or BADI or enhancement?

If the latter is the case: there's your problem. You should not use a COMMIT WORK in a user-exit etc.

Read only

Former Member
0 Likes
2,140

hi,


 CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        GOODSMVT_HEADER  = LS_GOODSMVT_HEADER
        GOODSMVT_CODE    = '01'
      IMPORTING
        MATERIALDOCUMENT = LV_MATERIALDOCUMENT
      TABLES
        GOODSMVT_ITEM    = LT_GOODSMVT_ITEM_BAPI
        RETURN           = LT_RETURN_GR.


    IF LV_MATERIALDOCUMENT IS NOT INITIAL.
      DATA : LT_RETURN_GOODS TYPE BAPIRET2.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT   = 'X'
        IMPORTING
          RETURN = LT_RETURN_GOODS.
endif.

Edited by: Neil Gardiner on Dec 9, 2010 11:38 AM

Read only

0 Likes
2,139

Yes, I m writing this code in a BADI. However, once upon a time this block was working.

Read only

0 Likes
2,139

As Maen said, you cannot call a COMMIT within a BADI.

However, once upon a time this block was working

I Don't think so..

Read only

0 Likes
2,139

IF_EX_WORKORDER_CONFIRM~AT_SAVE-> I m working in this method.

Do you have any alternative idea to commit work? What should ı do right now.

Edited by: OSMANBIYIK on Dec 8, 2010 12:02 PM

Read only

0 Likes
2,139

Hi,

If you are calling the BAPI with in any BADI, you don't need to explicitly do the COMMIT. The data will automatically get committed if the transaction is successful.

Regards,

Jaya krishna.K

Read only

Former Member
0 Likes
2,139

I think u need to start a new session,,,call a report or define a new FM using Remote-Enabled Moudle

Read only

Former Member
0 Likes
2,139

Have to check declaration or bapi_return2

Please declare bapi_return2 as follow



DATA: BEGIN OF  bapi_return2 OCCURS 0.
        INCLUDE STRUCTURE BAPIRET2.
DATA: END OF  bapi_return2.


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