BAPI to create Sales Order with
reference
-----Original Message-----
Subject: BAPI to create Sales Order with reference
Hello,
I am trying to create Sales Order with reference to Scheduling
Agreement, but although the
order gets created, it does not contain reference document
information.
The BAPI I am using is BAPI_SALESORDER_CREATEFROMDAT2.
Would someone know which parameters I have to papulate,or
have any other suggestion
how to accomplish my task?
Thank you so much,
-----Reply Message-----
Subject: RE: BAPI to create Sales Order with reference
Try using
ORDER_HEADER_IN-REFDOCTYPE = Your Sch. Agreement No. (Please
Check) and
ORDER_HEADER_IN-SD_DOC_CAT = 'E'.
-----Reply Message-----
Subject: RE: BAPI to create Sales Order with reference
Thank you so much for your quick responce.
Here are the parameters I am populating (including the
once you have mentioned).
Unfortunately, the order gets created with out Scheduling
Agreement reference.
Any idea why?
Thank you,
************** CODE **************************************
* local data
DATA: HEADER LIKE BAPISDHD1.
DATA: I_PARTNERS LIKE BAPIPARNR OCCURS 1 WITH HEADER
LINE.
DATA: I_ITEM LIKE BAPISDITM OCCURS 10 WITH HEADER LINE.
DATA: I_SCHEDULE LIKE BAPISCHDL OCCURS 10 WITH HEADER
LINE.
DATA: RETURN LIKE BAPIRET2 OCCURS 1 WITH HEADER LINE.
* order header values
HEADER-DOC_TYPE = 'ZSED'.
HEADER-SALES_ORG = ZCONSGAGRMWK-VKORG.
HEADER-DISTR_CHAN = ZCONSGAGRMWK-VTWEG.
HEADER-DIVISION = ZCONSGAGRMWK-SPART.
HEADER-PURCH_DATE = ZCONSGACTVSV-TRNACTDAT.
HEADER-PURCH_NO_C = ZCONSGACTVWK-PONUM.
HEADER-REF_DOC = ZCONSGAGRMSV-SCHDAGRM.
HEADER-REFDOC_CAT = 'E'.
HEADER-ASS_NUMBER = ZCONSGACTVSV-HUBREFNUM.
* order item level data
I_ITEM-ITM_NUMBER = '000010'.
I_ITEM-MATERIAL = ZCONSGACTVSV-MLXPART.
I_ITEM-ROUTE = CON-ROUTE.
IF NOT ZCONSGAGRMSV-CHARG IS INITIAL.
I_ITEM-BATCH = ZCONSGAGRMSV-CHARG.
ELSE.
I_ITEM-BATCH = '1'.
ENDIF.
I_SCHEDULE-ITM_NUMBER = '000010'.
I_SCHEDULE-REQ_QTY = ZCONSGACTVWK-QTY.
I_PARTNERS-PARTN_ROLE = 'AG'. " Soldto
I_PARTNERS-PARTN_NUMB = ZCONSGAGRMSV-SOLDTO.
APPEND: I_ITEM,
I_SCHEDULE,
I_PARTNERS.
CLEAR: I_ITEM,
I_SCHEDULE,
I_PARTNERS.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
* SALESDOCUMENTIN =
ORDER_HEADER_IN = HEADER
* ORDER_HEADER_INX =
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
* LOGIC_SWITCH =
* TESTRUN =
* CONVERT = ' '
IMPORTING
SALESDOCUMENT = ORDER
TABLES
RETURN = RETURN
ORDER_ITEMS_IN = I_ITEM
* ORDER_ITEMS_INX =
ORDER_PARTNERS = I_PARTNERS
ORDER_SCHEDULES_IN = I_SCHEDULE
* ORDER_SCHEDULES_INX =
* ORDER_CONDITIONS_IN =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* ORDER_CCARD =
* ORDER_TEXT =
* ORDER_KEYS =
* EXTENSIONIN =
* PARTNERADDRESSES =
.
-----Reply Message-----
Subject: RE: BAPI to create Sales Order with reference
FM BAPI_SALESDOCUMENT_COPY is what you are looking for.
Don't know when SAP
released this one, but its not there in 4.0B and is available
in rel 4.6C
-----End of Message-----
Create SO
BAPI_SALESORDER_CREATEFROMDAT2
- Sales Order Create
ABAP Programming Books
ABAP
Books - Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts
BAPI Tips and Tricks
BAPI Programming Tips
ABAP Tips
ABAP and Samples Program
Codes for Abapers
Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
All product names are trademarks of their respective
companies. The site www.erpgreat.com is in no way affiliated with
SAP AG.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
The content on this site may not be reproduced
or
redistributed without the express written permission of
www.erpgreat.com or the content authors.
|