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

Sales Order

Former Member
0 Likes
1,481

Hello Friends,

While using BAPI_SALESORDER_CREATEFROMDAT2, I can create the BAPi successfully, but get the following error when I go to VA02 to edit the Order :

SD document 722000 is not in the database or has been archived

Message no. V1302

Diagnosis

This message is issued if no document header (VBAK) can be found

(discrepancies in R/3) for a sales requirement single record.

System Response

In the initial sales order supply, the following error message appears

'Document xxxxxx not available' V1 302.

Procedure

If an error occurs in initial data supply in APO, discrepancies have

occurred between the requirements and sales documents in R/3. This

discrepance can be corrected in R/3 using report SDRQCR21.

I can succesfully create an Order in VA01.

Any ideas why this is happening?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,280

have you used the function module BAPI_TRANSACTION_COMIT

after that BAPI Call ?? if not, add this.

if sy-subrc = 0.

data : L_WAIT TYPE BAPITA-WAIT VALUE 'X'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = L_WAIT.

endif.

regards

srikanth

8 REPLIES 8
Read only

Former Member
0 Likes
1,280

Hello,

Please check the following things..

1. Check whether inside the BAPI you are doing a

BAPI_TRANSACTION_COMIIT

2. Check the update termination logs on transactions SM21 and SM13.

3. If it is a update termination error please check whether there is a repition in the number ranges of the slaes document you are trying to generate.

Hope this will help.

Thanks,

Krishnakumar

Read only

Former Member
0 Likes
1,280

hope u can are calling COMMIT work?.

regards

Prabhbu

Read only

Former Member
0 Likes
1,281

have you used the function module BAPI_TRANSACTION_COMIT

after that BAPI Call ?? if not, add this.

if sy-subrc = 0.

data : L_WAIT TYPE BAPITA-WAIT VALUE 'X'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = L_WAIT.

endif.

regards

srikanth

Read only

Former Member
0 Likes
1,280

Hi,

You need to commit after the BAPI is called. For testing this there is no need to create the ABAp program.

go to se37 press SHIFT+F8, it will allow you to call test sequence.

give here ur bapi to create sales order first and then call BAPI_TRANSACTION_COMMIT.

you can test both bapis one after other. and there will be entry in VBAK now.

Reward if useful.

Regds,

Agasti.

Read only

Former Member
0 Likes
1,280

Hi

Call the FM 'BAPI_TRANSACTION_COMMIT' or use the COMMIT WORK statement after calling the Sales order BAPI

Regards

Beena

Read only

0 Likes
1,280

Thanks a lot for all your inputs.

What i fail to understand is why the BAPI was creating an order all these days, and why do I have to explicitly COMMIT WORK today?

In include LV45AU43, line 1861,

if not with_commit is initial.

commit work.

endif.

with_commit is initial when FM SD_SALES_DOCU_MAINTAIN is called. How can I set this flag when calling BAPI_SALESORDER_CREATEFROMDAT2 itself?

Read only

0 Likes
1,280

read the below documentation( i copied from the function module documentation).

Functionality

This method executes a COMMIT WORK command. It is required for transactions developed externally to the R/3 System that change data in the R/3 System via BAPI calls.

When you call BAPIs in your program that change data in the R/3 System, afterwards you must call this method to write the changes to the database.

regards

srikanth

Read only

0 Likes
1,280

Hi Srikanth,

So this means that if I run the BAPi from SE37, it should create an order in the database?