Application Development 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: 

BAPI - SALES ORDER CREATE

Former Member
0 Kudos

Hi everyone,

We are successfully completed Sales Order thru VB by using BAPI_SALESORDER_CREATEFROMDAT2. But we need some more information. In standard SAP Menu we can create SO by using Create with reference button (by using quotation or another SO). How can we involve the same step in VB by using the above said bapi. Pl help

Regards

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Balakumar,

I see that you have registered on SDN just today. I Welcome you here and hope you will find the place very interesting.

Coming to your question, this forum is not exactly the right place for this question. I would like to take you to the at SDN where the chances of getting the correct answer for your question is high (almost 100%, in this case).

Regards,

Anand Mandalika.

Message was edited by: Mark Finnern

I moved the thread. Thanks for posting this answer.

4 REPLIES 4

Former Member
0 Kudos

Hello Balakumar,

I see that you have registered on SDN just today. I Welcome you here and hope you will find the place very interesting.

Coming to your question, this forum is not exactly the right place for this question. I would like to take you to the at SDN where the chances of getting the correct answer for your question is high (almost 100%, in this case).

Regards,

Anand Mandalika.

Message was edited by: Mark Finnern

I moved the thread. Thanks for posting this answer.

christian_wohlfahrt
Active Contributor
0 Kudos

Hi!

You might make some tests with filling fields REFOBJTYPE, REFOBJKEY, REFDOCTYPE of structure ORDER_HEADER_IN.

If there is no success, you can go a longer way:

- Read reference document with BAPISDORDER_GETDETAILEDLIST.

- Delete SO-number and adjust other fields.

- Create new document with BAPI_SALESORDER_CREATEFROMDAT2.

Regards,

Christian

Former Member
0 Kudos

Call function module BAPI_SALESORDER_CREATEFROMDAT1 to create the sales order.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'

EXPORTING

order_header_in = x_so_header

without_commit = 'X'

IMPORTING

salesdocument = vbeln

return = x_return

TABLES

order_items_in = i_so_item

order_partners = i_so_partners.

  • Update the message table.

IF NOT x_return IS INITIAL.

  • ERROR IN PROCESSING

EXIT.

ENDIF.

CLEAR return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = return.

IF NOT return IS INITIAL.

  • ERROR IN POSTING

ELSE.

  • SALES ORDER POSTED

ENDIF.

Former Member
0 Kudos

you can use BAPI_SALESORDER_CREATEFROMDAT2 to create a document with the resference to another document. But there is one problem. If you are using standard transaction to create a new document with reference to other one some data will be copied from the previous deocument (depending on customizing). It's not possible to achive such effect using BAPI_SALESORDER_CREATEFROMDAT2. You must always take care about all input data. It means you must read the orginal document and preapre all BAPI structures for the new document using data of the orignal one. So there is a lot of work to do.

I hope this helps.

Kind Regards,

Remek