2010 Dec 08 9:24 AM
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
2010 Dec 08 10:06 AM
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
2010 Dec 08 9:38 AM
How did you declare the bapi_return2? And check the detail analysis of the dump in ST22.
Vishwa.
2010 Dec 08 9:40 AM
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
2010 Dec 08 9:46 AM
Looks like there is a user-exit or BADI containing a COMMIT WORK.
2010 Dec 08 9:48 AM
Write WAIT UP TO 2 SECONDS. before the commit BAPI and check if the dump is happening.
Vishwa.
2010 Dec 08 9:48 AM
2010 Dec 08 9:48 AM
WHat to do now. I cannot delete it. THey are different from each other. How can ı make them work together.
2010 Dec 08 9:53 AM
TO Visha: Yes, it is again happening:(
Edited by: OSMANBIYIK on Dec 8, 2010 10:53 AM
2010 Dec 08 9:56 AM
can u please post the dump caused...
Thanks and Regards
S.Janagar
2010 Dec 08 10:03 AM
>
> 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.
2010 Dec 08 10:06 AM
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
2010 Dec 08 10:54 AM
Yes, I m writing this code in a BADI. However, once upon a time this block was working.
2010 Dec 08 10:59 AM
As Maen said, you cannot call a COMMIT within a BADI.
However, once upon a time this block was workingI Don't think so..
2010 Dec 08 11:01 AM
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
2010 Dec 08 12:10 PM
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
2010 Dec 30 2:15 AM
I think u need to start a new session,,,call a report or define a new FM using Remote-Enabled Moudle
2010 Dec 30 5:06 AM
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.