BAPI_SALESORDER_CREATEFROMDAT2 link order and quotation
Hi,
Object: Create a sales order and link it with a quotation.
I have created first a quotation VA21 for a customer and a material.
I am using function BAPI_SALESORDER_CREATEFROMDAT2 in a Sap 5.0 to create a TA order in a program with a BAPI_TRANSACTION_COMMIT.
The creation is well working
but I do not obtain a link between the new orders and the quotation.
What I have forgotten?
Is it well this function to use to create an order and link with a quotation?
Thank for your help.
Regards
Henri
To do this I fill in for
SALESDOCUMENTIN = P_new new order number
ORDER_HEADER_IN = order_header_in1
ORDER_HEADER_INX = order_header_intX
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
* LOGIC_SWITCH =
* TESTRUN =
* CONVERT = ' '
IMPORTING
SALESDOCUMENT = SALESDOCUMENT1
TABLES
RETURN = RETURN1
ORDER_ITEMS_IN = ORDER_ITEMS_IN1
* ORDER_ITEMS_INX =
ORDER_PARTNERS = order_partners1
ORDER_SCHEDULES_IN = ORDER_SCHEDULES_IN1
* ORDER_SCHEDU
And in ORDER_HEADER_I
order_header_in1-doc_type = 'TA'.
order_header_in1-sales_org = vbak-vkorg.
order_header_in1-distr_chan = vbak-vtweg.
order_header_in1-division = vbak-spart.
order_header_in1-REQ_DATE_H = sy-datum + 20.
order_header_in1-PURCH_NO_C = 'HBR_Commande'.
order_header_in1-REF_1 = 'E-DISTR'.
order_header_in1-SD_DOC_CAT = 'C'.
order_header_in1-REF_DOC = P_quote. Number of quotation
order_header_in1-REFDOC_CAT = 'B'.
order_header_in1-INCOTERMS1 = vbkd-inco1.
order_header_in1-INCOTERMS2 = vbkd-inco2.
order_header_in1-PMNTTRMS = vbkd-zterm.
order_header_in1-SALES_OFF = vbak-vkbur.
ORDER_HEADER_INX is just filled in with order_header_intX-REF_DOC = 'U'.
In return I get
233 |SALES_HEADER_IN has been processed successfully
233 |SALES_ITEM_IN has been processed successfully
233 |SALES_SCHEDULES_IN has been processed successfully
311 |Standard Order 5000027 has been saved
Hi All,
I have found wy it was nor working. When you want to create a sales order linked to a quotation (VA21 - 22 - 23), you need to fill in the fill related to the quotation in
the header and the item lines.
*& Report Z_ORDER_CREATE_SPA_HBR
REPORT Z_ORDER_CREATE_SPA_HBR.
* Parameters
Parameters: P_order like vbak-vbeln.
Parameters: P_quote like BAPIVBELN-VBELN.
Parameters: P_new like BAPIVBELN-VBELN.
* We need to create a new order number P_New from an existing order P_order
* linked to an existing quotation P_quote
* Tables
Tables: VBAK,
VBAP,
VBKD. "Sales Document: Business Data
* Data and internal table
DATA: order_header_in1 LIKE BAPISDHD1.
DATA: order_header_intX like BAPISDHD1X.
DATA : SALESDOCUMENT1 TYPE BAPIVBELN-VBELN.
DATA : RETURN2 TYPE BAPIRET2.
DATA: order_partners1 type BAPIPARNR occurs 0 with header line.
DATA: ORDER_ITEMS_IN1 type BAPISDITM occurs 0 with header line.
DATA: ORDER_ITEMS_IN1X type BAPISDITMX occurs 0 with header line.
DATA: ORDER_SCHEDULES_IN1 type BAPISCHDL occurs 0 with header line.
DATA: ORDER_SCHEDULES_IN1X type BAPISCHDLX occurs 0 with header line.
DATA : RETURN1 TYPE BAPIRET2 OCCURS 0 with header line.
Start-of-selection.
Select single * from vbak where vbeln = p_quote.
if not sy-subrc = 0.
write:/ text-e02.
exit.
endif.
Select single * from vbak where vbeln = p_order.
if not sy-subrc = 0.
write:/ text-e01.
exit.
endif.
Select single * from vbkd where vbeln = p_order.
if not sy-subrc = 0.
write:/ text-e03.
exit.
endif.
order_header_in1-doc_type = 'TA'.
order_header_in1-sales_org = vbak-vkorg.
order_header_in1-distr_chan = vbak-vtweg.
order_header_in1-division = vbak-spart.
order_header_in1-REQ_DATE_H = sy-datum + 20.
order_header_in1-PURCH_NO_C = 'HBR_Commande'.
order_header_in1-REF_1 = 'E-DISTR'.
order_header_in1-SD_DOC_CAT = 'C'.
order_header_in1-REF_DOC = P_quote.
order_header_in1-REF_DOC_L = P_quote.
order_header_in1-REFDOC_CAT = 'B'.
order_header_in1-INCOTERMS1 = vbkd-inco1.
order_header_in1-INCOTERMS2 = vbkd-inco2.
order_header_in1-PMNTTRMS = vbkd-zterm.
order_header_in1-SALES_OFF = vbak-vkbur.
select * from vbap where vbeln = vbak-vbeln.
clear ORDER_ITEMS_IN1.
ORDER_ITEMS_IN1-PO_ITM_NO = vbap-posnr.
ORDER_ITEMS_IN1-material = vbap-MATNR.
ORDER_ITEMS_IN1-TARGET_QU = vbap-zieme.
ORDER_ITEMS_IN1-REF_DOC = P_quote.
ORDER_ITEMS_IN1-REF_DOC_IT = vbap-posnr.
ORDER_ITEMS_IN1-REF_DOC_CA = 'B'.
append ORDER_ITEMS_IN1.
clear ORDER_SCHEDULES_IN1.
ORDER_SCHEDULES_IN1-ITM_NUMBER = vbap-posnr.
ORDER_SCHEDULES_IN1-REQ_DATE = sy-datum + 20.
ORDER_SCHEDULES_IN1-REQ_QTY = vbap-KWMENG.
append ORDER_SCHEDULES_IN1.
endselect.
order_partners1-PARTN_ROLE = 'WE'.
order_partners1-PARTN_NUMB = vbak-KUNNR.
APPEND order_partners1.
order_partners1-PARTN_ROLE = 'AG'.
APPEND order_partners1.
Perform call_function.
*& Form call_function
* text
* --> p1 text
* <-- p2 text
form call_function .
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN = P_new
ORDER_HEADER_IN = order_header_in1
* ORDER_HEADER_INX = order_header_intX
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
* LOGIC_SWITCH =
* TESTRUN =
* CONVERT = ' '
IMPORTING
SALESDOCUMENT = SALESDOCUMENT1
TABLES
RETURN = RETURN1
ORDER_ITEMS_IN = ORDER_ITEMS_IN1
* ORDER_ITEMS_INX = ORDER_ITEMS_IN1X
ORDER_PARTNERS = order_partners1
ORDER_SCHEDULES_IN = ORDER_SCHEDULES_IN1
* ORDER_SCHEDULES_INX = ORDER_SCHEDULES_IN1X
* ORDER_CONDITIONS_IN =
* ORDER_CONDITIONS_INX =
* 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 =
IF NOT SALESDOCUMENT1 IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = RETURN2.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
endform. "call_function
<b></b>
Similar Messages
-
How to make payment terms as disable in sales order and quotation
My requirement is to make payment terms(vbkd-zterm) as display in sales order and quotation at overview ,header data and item data.
Regards
Edited by: vijay vijay on Jun 29, 2010 7:43 AMUsing user exit USEREXIT_FIELD_MODIFICATION in MV45AFZZ, use it when you are going for particular case.
Or you can go for or screen variant, use it when you are going for all cases
Hope this can assist you.
Thanks & Regards
JP -
Pending order delivery against sales order and quotation problem
Dear Expert
I am facing problem when we are tracking delivary quantity against sales order and quotation. then our delivary quantity not matching with invoiced quantity.
Actually the logic of report are below
Pick up the VBAK-VBELN and VBAK-KUNNR where AUART = quotation, VKORG, VTWEG, SPART, ERDAT = selection.
now when any quantity which are added in sales order in new line not cattered through below code and it show problem of mismatch.
Can any one help me in finding data from all this table to catter delivey quantity, quotation qty and sale order qty.
thanks in advance.Starting from quotes, you could find your quote, then read SD document flow table VBFA for next document of type sales order (could be more than one sales order from a quote). Then you could obtain delivery documents (could be more than one for a sales order) for all your sales orders, again using next document code in table VBFA. This would present you tables that could contain multiple rows:
quote
sales order
delivery,
delivery
sales order
delivery
and so forth. You might also consider using table VBUK or VBUP to discover status of each quote item. -
ERROR IN SALES ORDER AND QUOTATIONS
Hi All,
" An Error has occured in the system RQ13000LS while copying the Document " , This is an Error displaying in Quotation to follow up Sales Order and while Saving Sales order - This error populates....hope many of them faced this instances , Pls provide the solution and steps. Thanks in Advance.
Regards,
AbhiHi Abhi
This error occurs while replication of the order to the backend R/3 system. Click on the long text button ('?' button) and see whether it gives any details or not.
Also you can go to SMW01 and check the error logs. This will guide you as to what configuration is missing on the CRM or R/3 side.
Also check whether the settings for Quotation replication have been maintained properly or not.
Hope it helps.
Plz reward points if helpful!!
Regards
Debolina -
Hi All,
I need to access the ERP sales order in IC webclient. Can any one explain step by step procedure to achive this.
I also need to access the ERP quotations in IC webclient. I believe we need transaction launcher to achive this. Is this true. Please explain how this can be done.
Is there a Best Practices documentation for these?
Points will be rewarded *
Thanks youHi Ram,
Follow below steps if you want to use transaction launcher for creating ERP Sales order and ERP quotations.
1. Create a transaction Lancher using wizard
IMG: CRM-> IC WebClient -> Basic functions -> Transaction Lancher -> Configure Transaction Launcher ( wizard)
Step 1 : Select entries
Here you can the name of the Transaction launcher ID
and leave other fields empty
Step 2: Technical Details
Here give the class name ( Zclass name)
Step 3: Further technical details
Give the logical system of your R/3 system, BOR
object type BUS2032 and method as CREATEMULTIPLE
Step 4 : Transaction parameters
Select the parameter SALES
Step 5 : Activity clip board
Leave blank
2. Create Navigation bar entry and Profile
IMG : CRM-> IC Webclient -> Basic functions -> Define Navigation bar profiles
Go to Define entries and create a new Navigation bar entry ID
Select the navigation type as launch transaction.
Give the launch transaction ID as the one which created through wizard.
Go to Define profiles and create a new navationbar profile by copying the most relavant standard profile.
Add the navigation bar entry to the newly created profile.
3. Assign the navigation bar profile to IC webclient profile.
IMG: CRM --> IC WebClient --> Define IC Webclient profiles.
Here you assign the navigation bar profile to IC Webclient profile.
Reward points if it helps.
Regards,
Madhu -
CESS and VAT not getting picked automatically in Sales Order and Quotation
Hi Experts,
Whenever we create quotation or sales order the Excise Duty, Cess and VAT/CST has to pickup automatically but it is not happening.Sold to party belongs to TN and Karnataka states are picking up properly but not other states.
Regards
Rajeshwari ShenoyCheck if Condition record are maintained, so that it is picked in Sales order. When it is working fine for TN & Karnataka, it is most likely that condition record is not maintained.
Regards,
Rajesh Banka
Reward points if helpful -
Tax Conditions types not appearing in CRM orders and quotations
Hello All,
I have created a new tax condition type in ECC and through initial load replicate the same to CRM. pricing procedure repliction with new tax condition is also successful.
But, the new tax condition is not appearing in condition tab at item level when i create quotation in CRM. other condition types are coming. data for this condition type is there in custom condition table. mapping of tax classifiction to tax group is also done in SPRO.
Please advise.
THank and Regards
Sudhir GroverHello Sudhir,
You should check the trace log for pricing at first. Set the user parameter:PRC_TRACE as 'X' on T-cd:SU01 for your user and check the Access analysis on the condition tab.
Regards,
Masayuki -
Sales orders for quotation do not cif to APO
Hi experts,
I face an issue I cannot cope with:
when I create an order for a quotation and order quantity is less than quotation quantity the order doesn't cif to apo. When I make another order and quotation is closed the only second order comes to APO and total requirement decreased, because the quotation disappears. If the order is created for a full quantity, the qotation disappeares and order cames OK.
In R/3 I set the rule of position completion = A (complete at first call), document flow records = '2', effect of value copied = '+', copy schedule lines = ' '.
I'll be very pleased if anybody gives an idea how to get a distribution of requirements between quotation and order in APO.
Dimitriy KarpovHi,
If you are replicating the sales order from R3 to CRM then you will get all the orders present in CRM. If that is not the case then you need to write one RFC in R3 to get the desired data as R3 is governed by Select queries on tables instead of Function modules in CRM.
So if you want to fetch any information from R3 then you need to create RFC and use select query to get the data.
Thank you.
Ashish -
Link Sales Order and PO and Pick & Pack
Ability to add a manual Link between a Sales Order and Purchase order to reserve the item(s).
Also do not allow Pick & Pack manager to create pick list for sales orders with an earlier date if other sales orders exists waiting for complete shipment.HI,
WE can use the table VBKD (SALES DOCUMENT: BUSINESS DATA )
1. VBELN - Sales order
2. BSTKD - Customer Purchase order
we can link these two fields and can pass the data in a internal table after that Vbeln is also present in
Tables VBAP ( SALE DOCUMENT ITEM DATA )
1. VBELN - SALE ORDER
2. MATNR - MATERIAL NUMBER
3. KWMENG - ORDER QUANTITY
which could be used for further procssing
Thanks
Rajat -
Link Sales Order and Purchase Order - MRP Pegging - Give Feedback
Oracle Apps Version - 11.5.10.2
Mfg - Discreate manufacturing module along with P2P and OTC..No Projects Module.
Soft Pegging enabled on Items..
Hi Guru,
we have created a SQL to link SO and PO using MRP_Full_Pegging Table,what are issues you see with this logic..would it always give me correct mapping between SO and PO
SELECT
mgr.inventory_item_id Item_ID,
mtl.segment1 Item,
ohll.order_number SO_Number,
--mr.disposition_id,
mr.compile_designator MRP_Plan,
--mipo.line_id,
--poll.line_location_id,
pohll.segment1 P0_Number,
mtl.description Item_Description
FROM
mrp_gross_requirements mgr,
MRP_SCHEDULE_DATES msd,
mtl_sales_orders mso,
oe_order_headers_all ohll,
mrp_recommendations mr,
mrp_item_purchase_orders mipo,
po_line_locations_all poll,
PO_HEADERS_ALL pohll,
mtl_system_items_b mtl
WHERE
msd.mps_transaction_id = mgr.DISPOSITION_ID
and msd.inventory_item_id = mgr.inventory_item_id
and mtl.inventory_item_id = mgr.inventory_item_id
and msd.source_sales_order_Id = mso.sales_order_id
and mso.segment1=ohll.order_number
and msd.organization_id = XXX -- pl use you inv org id
and mr.disposition_id=mipo.transaction_id
And mipo.line_id=poll.po_line_id
and poll.po_header_id = pohll.po_header_id
and mr.inventory_item_id = mtl.inventory_item_id
and mr.compile_designator like '%XXX%' -- pl use MRP plan name
and rownum <100 -- just to limit result set
Order By ohll.order_number desc;
Appreciate your feedback and inputs to make necessary corrections to make it accurate and complete.
thank you.I tried writing the query to find the supply and demand details in ASCP Planning.
In our scenario we created a sales order '5110416.AT PROJECT.ORDER ENTRY(6.1)' and launch the plan. It has created the plan order and after releasing it has created the internal requisition and then Internal sales order. But the supply sales order number is not populated in order_number column of msc_supplies.
Please help me if I am missing some thing. Just for your info I have run the plan again and then also its not updated. Below is the query which I have written. This is very critical for me. Please advice.
SELECT
MS.ORDER_NUMBER,MS.ORDER_TYPE,MS.ORDER_LINE_NUMBER,MD.SALES_ORDER_LINE_ID,MD.ORDER_NUMBER
FROM
MSC_SUPPLIES MS,
MSC_FULL_PEGGING MFP,
MSC_DEMANDS MD
WHERE 1=1
AND MS.TRANSACTION_ID=MFP.TRANSACTION_ID
AND MD.DEMAND_ID=MFP.DEMAND_ID
AND MD.ORDER_NUMBER='5110416.AT PROJECT.ORDER ENTRY(6.1)'
Thanks in advance.
Regards
RV -
Link between process order and sales order for planning strategy 52
Hello,
I investigate the possibility of a link between "sales order" and "planned order / process order" for the usage of planning strategy 52 (planning w/o final assembly, make to stock).
I know, this is not conform to the basics of planning strategies (EITHER make to order OR make to stock) and I suspect it would be a modification. Of course we have the alternative "make to order" - strategy 50, but we do not want to use individual customer stocks.
Is anybody there with similar customer requirements or project experiences?
Thanks in advance,
Joerg
Message was edited by:
Jörg DemtschukHi Jorg,
To my understanding if you need hard pegging then in SAP only Individual requirement is possible.
Or else you need to create a custom transactions/table to identify Sale order and when ever a process order is created by selecting the sale order record, the process order detials should also get updated against that.
You need to take the help of ABAP expert for this,
Regards,
Prasobh
Reward points if this was useful -
BAPI_SALESORDER_CREATEFROMDAT2 for Return Orders and Credit Orders
Dear experts,
I've been searching the SDN forums for information about the usage of BAPIs to create Sales Orders, Return Orders and Credit Memos. Unfortunately it seems hard to get consistent answers around the usage of BAPI_SALESORDER_CREATEFROMDAT2.
Is it, or is it not possible, to use BAPI_SALESORDER_CREATEFROMDAT2 to create Return Orders and Credit Memos with reference to other documents? Can someone please let me know if they have successfully implemented this scenario?
Many thanks and best regards,
Anna EnglundWhen you see the Code inside the BAPI BAPI_SALESORDER_CREATEFROMDAT2
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
SALESDOCUMENT = salesdocumentin
SALES_HEADER_IN = ORDER_HEADER_IN
SALES_HEADER_INX = ORDER_HEADER_INX
SENDER = SENDER
BINARY_RELATIONSHIPTYPE = BINARY_RELATIONSHIPTYPE
INT_NUMBER_ASSIGNMENT = INT_NUMBER_ASSIGNMENT
BEHAVE_WHEN_ERROR = BEHAVE_WHEN_ERROR
LOGIC_SWITCH = LOGIC_SWITCH
BUSINESS_OBJECT = *'BUS2032'*
see it is only used for Sales Order(since BUS2032 is for sales order).
you need to create or copy the BAPI BAPI_SALESORDER_CREATEFROMDAT2 to custom Function.
then change the Business Object to BUS2094 (it is for Credit memo) . Reference i tried it didn't work that time. you check it once with the new Custom FM. -
Link between Purchase order and Attachment list
Hi All,
I got a requirement like Purchase orders are from moved from one system to another system.There was a bug in BDC program
so some Attachment list of the purchase orders are not moved properly to the another system.
Now my client want a report to generate the Purchase orders which is having attachment list.
I did not find any table link between Purcahase order and Attachment list.
So Plz provide me the link between purchase order and attachment list.
Thanks,
RamYou mean service for object services?
if yes then u have to create one custom report for Generic Object Services ( like notes , attachment , url ) -
Link tables of Sales Order and Purchase Requisition
Hi,
thru which tables we can get the data of purchase requistion for a sales order.
regards,
baluDear Balu,
the fields VBEP-BANFN and VBEP-BNFPO are filled in the third-party process only. It means that there is 1:1 connection between the schedule line of the sales order and the purchase requisition. In the third-party process during saving the sales order the purchase requisition is created automatically and is linked to the order.
If the fields are empty, it means, you have no third-party process and no 1:1 connection between the sales order and the purchase requisition. Probably the sales order created normal requirements, which generate purchase requisition(s) after MRP run. In this case you cannot see the purchase requisition from the sales order as there is no 1:1 connection. You have no chance to get the data from sales order to the purchase requisition.
The only possibility which you (may be, it depends on the process) have, is to find sales order numbers from the purchase requisition: so to develop the process backwards. These data are stored in the database table EBKN: Purchase Requisition Account Assignment.
Please use the following fields:
EBKN-BANFN - Purchase requisition number (key field)
EBKN-BNFPO - Item number of purchase requisition (key field)
EBKN-LOEKZ - Deletion indicator in purchasing document (key field, can be helpful)
The corresponding sales orders are stored in:
EBKN-VBELN - Sales Document Number
EBKN-VBELP - Sales Document Item
EBKN-VETEN - Schedule line number
I hope, this information will help you further and will solve your problem.
Kind regards,
Akmal Vakhidov
Development Support SD, SAP, Walldorf/Germany -
How to link asset with purchase order and PO Item.
Hello,
I have to generate a report which contains columns
Asset No , po no(ebeln) ,PO Item(ebelp),Material no etc
My query is how to link asset with purchase order and PO Item.
I am selecting asset and po no. from anla but how to get
po item no(ebelp)?
po line item is important in this report because every line item has differrent asset and material no.
i tried to match asset no in mseg table but i am not getting asset no in mseg .
how should i proceed ?Thanks Thomas & Srimanta for the quick response.
When I checked EKKN table by entering PO there is no asset no. in anln1 field.
Also I would like to add that, In me23n for a PO, account assignment category we are entering 'F' for internal order settlement.
Where can i find the link between asset and po no(ebeln) and po item(ebelp)?
Regards,
Rachel
Edited by: Rachel on Aug 11, 2008 7:23 AM
Maybe you are looking for
-
Smartforms: print accompanying documents
Hi, I have to reproduce in Smartforms the same output as the existing legacy system. Legacy system automatically outputs 1)A Quotation 2)A Condition of Sale document (always printed out) (PDF file, 2 pages, contents are numbered and appear in 2
-
Photosmart 8250 4x6 Prints with horizontal lines running through them
I'm getting horizontal lines running through many of the 4x6 prints made with my Photosmart 8250. They're about 1/3" to 2/3" apart from one another. I've run the head cleaning process and alignment process. I've tried cleaning the rollers. Any su
-
What is the role of the Email Def field in 'Password Warning Task'?
I created a custom Email Def in DC and provided its name in 'Email Definition Name' field under Parameters. But when I ran the job, that email def was not picked for sending email. Instead a notification template 'Password Warning Notification' was u
-
Is it possible to use digital signatures if the pdf was not created in Acrobat? Thanks.
-
Photoshop elements 11 won't start up
Hi, Whenever I open photoshop elements 11 it loads up, shows my organizer screen breifly then closes out and gives me a message saying I must back up my files. I can click cancel, don't show me this message again or click to start the backup. The b