2008 Jul 01 6:41 AM
Hi Experts,
I met a problem about Function 'BAPI_SALESORDER_CREATEFROMDAT2'.
The same input parameters, if I use this function in a report , that's ok, A new sales order is created.But if I use this function is a custom-function( eg, 'ZORDER_CREATE), the return messages of BAPI_SALESORDER_CREATEFROMDAT2 are successfully.At this time, I use t-code 'VA02' to display this generated order.occurs a error message 'SD document 18180 is not in the database or has been archived'
Who can you tell me why happen this scenarios?
Thanks
Kelvin
Hello Kevin,
maybe you can solve your problem if you use the export parameter WAIT in FM BAPI_TRANSACTION_COMMIT (see coding below). This parameter causes that the FM realy waits until the commit is successfully done. In this case the word area return is empty.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = wa_return2.
Hope this helps.
Kind regards
Rolf
2008 Jul 01 6:49 AM
Try to execute the function module BAPI_TRANSACTION_COMMIT after you executed the BAPI_SALESORDER_CREATEFROMDAT2. After executing the BAPI_SALESORDER_CREATEFROMDAT2 a commit must be given.
2008 Jul 01 6:50 AM
HI ,
i think COMMIT work is missing from ur program .
it should be like this .
Call 'BAPI'.
if return[] is initial.
commit work.
endif.
regards
prabhu
2008 Jul 01 6:56 AM
The Problem is related to commit .
Try calling BAPI_transaction_commit after the function in your custome function.
Please reward if useful.
2008 Jul 01 9:54 AM
Thanks.
Ater I executed the BAPI_SALESORDER_CREATEFROMDAT2,To execute the function module BAPI_TRANSACTION_COMMIT looks well. Please see my coding below:
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
ORDER_HEADER_IN = W_HEAD
IMPORTING
SALESDOCUMENT = ZONC_ORDER_NUMBER
TABLES
RETURN = T_RETURN
ORDER_ITEMS_IN = T_LINE
ORDER_ITEMS_INX = T_LINEX
ORDER_PARTNERS = T_PARTNER
ORDER_CONDITIONS_IN = T_COND
ORDER_CONDITIONS_INX = T_CONDX
ORDER_CCARD = T_CCARD
ORDER_TEXT = T_TEXT
EXTENSIONIN = T_EXTEN.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
Why this select can't be implement(I need use related data).How to implement below function?
SELECT SINGLE *
INTO CORRESPONDING FIELDS OF LW_VBAK
FROM VBAK
WHERE VBELN = ZONC_ORDER_NUMBER
2008 Jul 01 1:21 PM
Hello Kevin,
Your code looks perfect. Looks like the Sales order not yet saved immediatey to the database. So after commit bapi use a wait statement for 3 seconds and check your results. It will work fine.
Hope this answers your question.
Thanks,
Greetson
2008 Jul 02 9:04 AM
Hello Kevin,
maybe you can solve your problem if you use the export parameter WAIT in FM BAPI_TRANSACTION_COMMIT (see coding below). This parameter causes that the FM realy waits until the commit is successfully done. In this case the word area return is empty.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = wa_return2.
Hope this helps.
Kind regards
Rolf
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |