Material substitution with BAPI_SALESORDER_CREATEFROMDAT2
Hi, I'm creating sales orders with BAPI_SALESORDER_CREATEFROMDAT2 in background, I have some materials that have substitutes, but when I use the bapi, the material is does not change. When I create the sales order manually in the VA01, the material is replaced.
thanks.
It should behave exactly the same. Usually when you run something online, there are certain fields that get defaulted and you will not notice. But when you call the BAPI, you have to pass those default values as well so that you will see the same result. You will have try it out in a couple of different ways and also debug the code where it decides whether or not substitution allowed and you can trace it back to the value that is missing.
Similar Messages
-
Material configuration with BAPI_SALESORDER_CREATEFROMDAT2
Hi there,
I am trying to create a new sales order with material configuration using BAPI_SALESORDER_CREATEFROMDAT2. It's not working though. I have seen some comments that it is not possible to create configuration directly with this BAPI - is this really true? - and that the config should be created after sales order creation using function CE_C_PROCESSING.
I have played around a bit, but without succes. Could somebody help me out?
Kins regards,
RoyHi, you can use this BAPI to create a sales order with configurable material.
Fisrt you can try with some hardcode config items.
You need the corresponding 'Characteristic values' in your system
eg:
*Header data
wa_header-doc_type = 'ZREK'.
wa_header-sales_org = '1020'.
wa_header-distr_chan = 'AS'.
wa_header-division = 'AS'. "not mandantory
wa_header-purch_no_c = 'mypohehe'.
*Partner data
it_partners-partn_role = 'AG'.
it_partners-partn_numb = '0000000104'.
APPEND it_partners.
it_partners-partn_role = 'WE'.
it_partners-partn_numb = '0000000105'.
APPEND it_partners.
*1st
*items
it_items-material = 'BC263R'.
it_items-po_itm_no = '000010'.
it_items-target_qty = '1.000'.
it_items-target_qu = 'ST'.
APPEND it_items.
it_schedules_in-itm_number = '000010'.
it_schedules_in-req_qty = '1.000'.
APPEND it_schedules_in.
*it_items_inx
not needed for creation
*reference
it_cfgs_ref-posex = '000010'.
it_cfgs_ref-config_id = '000001'.
it_cfgs_ref-root_id = '00000001'.
APPEND it_cfgs_ref.
*it_cfgs_inst
it_cfgs_inst-config_id = '000001'.
it_cfgs_inst-inst_id = '00000001'.
it_cfgs_inst-obj_type = 'MARA'.
it_cfgs_inst-class_type = '300'.
it_cfgs_inst-obj_key = 'Z-BC263R'.
APPEND it_cfgs_inst.
configuration values
it_cfgs_value-config_id = '000001'.
it_cfgs_value-inst_id = '00000001'.
it_cfgs_value-charc = 'ATS_GRUNDLAGE'.
it_cfgs_value-value = p_conf. "01 - 07
APPEND it_cfgs_value.
it_cfgs_value-config_id = '000001'.
it_cfgs_value-inst_id = '00000001'.
it_cfgs_value-charc = 'ATS_BESCHRIFTUNG'.
it_cfgs_value-value = 'N'.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
order_header_in = wa_header
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
int_number_assignment =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
salesdocument = v_salesdocument
TABLES
return = it_return
order_items_in = it_items
order_items_inx = it_items_inx
order_partners = it_partners
order_schedules_in = it_schedules_in
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN =
order_cfgs_ref = it_cfgs_ref
order_cfgs_inst = it_cfgs_inst
ORDER_CFGS_PART_OF = it_cfgs_part_of
order_cfgs_value = it_cfgs_value
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_CCARD =
ORDER_TEXT =
ORDER_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
*it_return
READ TABLE it_return WITH KEY type = 'E'.
Rgds,
JP -
Need to bypass Material substitution rule for SO created through RFC
Hello SAP Geniuses,
I have an external process that creates Sales orders using a RFC calling BAPI_SALESORDER_CREATEFROMDAT2.
My Users want to create orders for Materials that have substitution rules defined, but they want to bypass these rules when the Sales Orders are created from the external process. Other Users in the same Sales Organization and Distribution Channel need the substitution rule to sell these materials, so config cannot solve this.
I have already tried detecting when VBAP-MATNR NE VBAP-MATWA and calling BAPI_SALESORDER_CHANGE with the original MATNR, but the same substitution occurs in this FM.
Can anyone point me to a User Exit or BADI that can add flexibility to the Material Substitution mechanism in SD module?Jack,
You are a genius!
These are the steps I followed to implement this idea:
1) VOFM -> Requirements -> Material determination -> New rule in the 800 series
2) Insert code into rule with SSCR key; Activate code; Activate rule.
3) Run utility program RV80HGEN to create rule in FG V61D -> SAPLV61D -> LV61DNNN -> RV61DNNN -> RV61D8xx
4) SPRO-> Sales and Distribution -> Basic Functions -> Maintain Prerequisites for Material Determination -> Maintain procedure -> select procedure -> double-click "Control data" -> enter rule into box "Requiremnt". Save.
5) SPRO-> Sales and Distribution -> Basic Functions -> Assign Procedures To Sales Document Types -> select doc type of interest -> enter procedure name into field "MatDeterm." for doc type. Save. -
Having Multiple Material Codes with Different Profit Centers in one Plant
Hi,
Can someone explain me what impact it will have, if there are different Material Codes with multiple profit centers in a single plant? For example, say Material 1 has Profit Center as PC1 and Material 2 has Profit Center as PC2 and they are in a single plant. Will this have impact on Financial Transactions?
Thanks and Regards,
Sameer JoshiHi Sameer
No negative impact.. It is very much possible and logical
All the purchases made - > Stocks and vendor liability will be tagged to the PC of the Material
All the sales made -> COGS, Revenue and Customer Liability will be tagged to the PC of the material, unless you overwrite using a Substitution
Br, Ajay M -
Material determination with Product selection
Hi SAP Gurus
We are using material determination with product selection. The process is that customer will send in one product in a sales order. At the time of doing ATP we have to look for about three or four possible alternatives and confirm that alternative which has the highest stock level depending on the ATP situation. We have configured material determination with SAP standard substitution reason0006 to take care of this. The problem with this is that this creates two line items in sales order as the item substituted is shown as a sub-item of the material entered. We do not want to have two line items in a sales order for this. Is there a way we can do material determination with product selection (Based on ATP) and have the item substituted replace the item entered in a sales order? In other words we do not want to see two line items in a sales order. The substitute item should simply replace the original item and the material entered could be stored in field VBAP-MATWA. I have gone through all the standard SAP documentation which clearly states that in order to material determination based on ATP we have to use outcome A or B both of which create a sub-item.
I was wondering if there is any workaround or if there is any user exit in which we can replace the original item with the substituted item?? Any help or any direction will be highly appreciated.
Another question is if we were to use APO for doing global/Rule based ATP is it possible to get rid of the double line items. We have also tried to use rule based ATP in APO and use product/location substitution in our sandbox system to see if we can get back only one line item. But even in that case we do get a sub item. Any help on this issue will be greatly appreciated. You can also send me an e-mail at [email protected]
Thanks
SDSAPCON>
SAPCON SD wrote:
> Hi SAP Gurus
>
> We are using material determination with product selection. The process is that customer will send in one product in a sales order. At the time of doing ATP we have to look for about three or four possible alternatives and confirm that alternative which has the highest stock level depending on the ATP situation. We have configured material determination with SAP standard substitution reason0006 to take care of this. The problem with this is that this creates two line items in sales order as the item substituted is shown as a sub-item of the material entered. We do not want to have two line items in a sales order for this. Is there a way we can do material determination with product selection (Based on ATP) and have the item substituted replace the item entered in a sales order? In other words we do not want to see two line items in a sales order. The substitute item should simply replace the original item and the material entered could be stored in field VBAP-MATWA. I have gone through all the standard SAP documentation which clearly states that in order to material determination based on ATP we have to use outcome A or B both of which create a sub-item.
>
> I was wondering if there is any workaround or if there is any user exit in which we can replace the original item with the substituted item?? Any help or any direction will be highly appreciated.
>
> Another question is if we were to use APO for doing global/Rule based ATP is it possible to get rid of the double line items. We have also tried to use rule based ATP in APO and use product/location substitution in our sandbox system to see if we can get back only one line item. But even in that case we do get a sub item. Any help on this issue will be greatly appreciated. You can also send me an e-mail at [email protected].
>
> Thanks
>
> SDSAPCON
In the substitution reasons ...mark the OUTCOME as blank for this particular 0006. I am not sure for ATP
rgds
Sai
Edited by: Sai on Mar 27, 2008 10:00 PM -
Cogi Errors due to Material Substitution
Hello,
In plant 0162 we have cogi errors that I can not explain. It is related to material substition and BOM changes.the COGI error comes from the component material 10085940 in order 100239889. this material 10085940 was set for material substitution for material 10007152 on September 7, 2008 effective when i refer to BOM but the production order was created this august.why do we have this COGI error? we have 10007152 in house and none of the 10085940 material please answer and explain why this happen?
More thanks,
RyanHi,
Where could i see this percentage for this in BOM? i have noticed in the production order compenet overview of my material the two material was there already both backflushing indicator was check, discontinuation column was populated on both material = 1 (simple discontinuation - maintain in master record). could this be a factor? why does my production order pick both this two material in its BOM 10085940 will be effective on 07.09.2008 this is weird and problematic to us.
Please advice what happen and fixed this one my cogi error said enter storage location for this 10085940 component.
and in CS03 when i look at the BOM:
10074921 (valid fr) 14.05.2008 (valid to) 07.09.2008 (change # 500001258 (change # to) 500001311
10085940 (valid fr) 07.09.2008 (valid to) 31.12.9999 (change # 500001311 (change # to ) blank
Please any help with this one for me to resolve this issue expert. please
Thanks
Ryan
Edited by: Ryan Lazaro on Aug 22, 2008 10:22 AM
Edited by: Ryan Lazaro on Aug 26, 2008 4:30 AM -
Warning message for material substitution in ERP E-commerce
Hi Gurus,
We are implementing SAP ERP E-commerce with TREX, ECC 6.0 backend.
Automatic material substitution is working in ECC. The material is also dispalying a warining message before substitution.
In B2B shop the substituion works - material X is replaced with matereial y but there is no warning message during substituion.
I believe matereial substituion in E-commerce is standard funtionality and it should work as configured in ECC for VA01.
Any susgestion why there is no dispaly of any message during matereial sub in E-commerce.
Thank youHi Ram,
What type of messags can be displayed on ECO ERP can be configured via XCM "UI" component. By default only error messages are displayed, You can create a customer component with message severity set to 'Warning" / "info" as required. After this all the messages raised by the Standard BAPIs are displayed on the basket.
However you need to be careful what severity level you want to use as apart from the message that you require, lot of other messages might also be displayed on the basket.
Regards
Roopali -
Regarding sales order creation with "BAPI_SALESORDER_CREATEFROMDAT2"
Hi Experts,
I am facing an issue when creating a sales order with FM "BAPI_SALESORDER_CREATEFROMDAT2" it is showing the error
V1 -761 as " unpermitted combination of BUS 2032 with Sales document category L" .
In VA01 ,if i provide the fallowing details
Sales org 1000
dist 10
div 10
item no 10 material-52 plant 1000 shipping point -0001 target qty-1,uOM-EA,weight unit-KG
billing date 11022011
pricing date-11022011
currency - GBP
shipping party -1
sold to party -1
buyer - 1
bill-to-party -1
it is creating the sales order.
what could be the problem with this BAPI..
Please help.
Regards
VishnuHi Vishnu,
First try with minimum data for header and item .Check the documentation of that bapi.
DATA:
Order partners
li_order_partners TYPE STANDARD TABLE OF bapiparnr,l_order_partners LIKE bapiparnr,l_order_header_in LIKE bapisdhd1,
li_order_items_in TYPE STANDARD TABLE OF bapisditm,l_order_items_in LIKE bapisditm,li_order_items_inx TYPE STANDARD TABLE OF bapisditmx,l_order_items_inx LIKE bapisditmx,return TYPE STANDARD TABLE OF bapiret2,l_return TYPE bapiret2,
l_vbeln LIKE bapivbeln-vbeln,
CLEAR l_order_partners.
l_order_partners-partn_role = 'AG'. "Remember German codes !
l_order_partners-partn_numb = '0000001032'.
APPEND l_order_partners TO li_order_partners.
Sales document type
l_order_header_in-doc_type = 'TA'. "Remember German codes !
l_order_header_inx-doc_type = 'X'.
Sales organization
l_order_header_in-sales_org = '1000'.
l_order_header_in-distr_chan = '10'.
l_order_header_in-division = '00'.
l_order_items_in-itm_number = '10'.
l_order_items_in-material = 'abcmaterial'.
l_order_items_in-comp_quant = '1'.
APPEND l_order_items_in TO li_order_items_in.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = l_order_header_in
IMPORTING
salesdocument = l_vbeln
TABLES
return = li_return
order_items_in = li_order_items_in
order_partners = li_order_part
WRITE: / l_vbeln.
IF l_errflag IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
For the above document type , sales organisation,distribution channel,division,customer,material check with you functional consultants and take the exact combination of data. That combination is very important.Please ask t if you need more help in this.
Regards,
Madhu.
Edited by: madhurao123 on Mar 3, 2011 5:11 AM -
Create sales order with BAPI_SALESORDER_CREATEFROMDAT2 example
Hi, does anyone have a working example of how to create a sales order using BAPI_SALESORDER_CREATEFROMDAT2?
Thankshi Robert,
Check this code...try to map.
one order with total sum of effort
clear: l_order_header,
l_salesdocument,
l_order_partners,
l_order_items,
l_order_schdl.
refresh: it_order_items,
it_order_partners,
it_order_schdl,
it_return.
???????? get from material ...
Order header
l_order_header-doc_type = 'ZQBV'.
l_order_header-distr_chan = '10'.
l_order_header-division = '00'.
if g_qals-werk eq '1100'.
l_order_header-sales_org = '1000'.
else.
if g_qals-werk eq '3100'.
l_order_header-sales_org = '3000'.
else.
message i001(00) with text-005.
endif.
endif.
l_order_header-purch_no_c = g_qals-prueflos. " <= lot
Partner data
l_order_partners-partn_role = 'AG'.
l_order_partners-partn_numb = g_qals-kunnr.
append l_order_partners to it_order_partners.
Order items => only one
l_order_items-itm_number = 10.
l_order_items-material = g_qals-matnr.
l_order_items-target_qty = 1.
append l_order_items to it_order_items.
Schedules for quantity
l_order_schdl-itm_number = 10.
l_order_schdl-req_qty = 1. " <= only 1 !
append l_order_schdl to it_order_schdl.
Conditions for value
l_order_conditions-itm_number = 10.
l_order_conditions-cond_type = 'PR00'.
l_order_conditions-cond_value = g_effort_sum.
l_order_conditions-currency = g_effort_unit.
append l_order_conditions to it_order_conditions.
BAPI to create sales order
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
ORDER_HEADER_IN = l_order_header
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = l_salesdocument
TABLES
RETURN = it_return
ORDER_ITEMS_IN = it_order_items
ORDER_ITEMS_INX =
ORDER_PARTNERS = it_order_partners
ORDER_SCHEDULES_IN = it_order_schdl
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN = it_order_conditions
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 l_salesdocument is initial.
order successfully created
message i001(00) with text-001 l_salesdocument.
endif.
endif.
for more info check the below link also
Problem with BAPI_SALESORDER_CREATEFROMDAT2
Regards,
Naveen -
Creation of Material Documents With Mvt Type
On Performing Post Goods Issue (PGI) in one Plant in case of Plant to Plant Dispatches, there should be Inbound delivery created for already created Purchase Order (PO). In addition after creation of inbound delivery, there should be material document created with 103 movement. This Material document is triggered when the inbound delivery is saved. Once Warehouse processes are finished, then Post Goods Receipt (PGR) happens, so 101 Movement Type happens for Purchase Order. PGR document should trigger one more material document with 104 movements; this document is reversal for material document with 103 movement type.
can any one suggest to enhance SAP for this?
Moderator message : Requirements dumping is not allowed, show the work you have already done. Thread locked.
Edited by: Vinod Kumar on Oct 21, 2011 5:18 PMHi Nitin,
Before creating the Service type of product, you have to define the Base category for Service type product. Generally the category for service will be created under the R3 hierarchy R3PRODSTYPE. You can create this category using the TCode:
COMM_HIERARCHY. Here you have to select the product type as Service and have to assign the set types to the category.
You can create a service product using the transaction : COMMPR01 -> Click on Service ICON -> Select the Category for Service Type. Then fill in the details for Service Product description, Service ID(Based on number range settings for products), Language.
Also fill other details like Base Unit of measure, Pricing condition for different sales areas for the service product.
Since you are using CRM7.0, you can do all these activities using a POWER USER role.
For more information about Set types and hierarchies please refer the following help link:
http://help.sap.com/saphelp_crm70/helpdata/EN/46/57672501a208e7e10000000a114a6b/frameset.htm
Hope this helps!
Regards,
Chethan -
Variable Substitution with tag attribute
Hi,
is possible to use variable substitution with tag attribute? as follow:
<root directory="xxx" filename="yyy">
<....
</root>
using variable substitution for directory : root,1,directory,1
root,1,filename,1Hi,
I solved my problem using Dynamic Configuration to set the FileName and Directory fields in Adapter Specific Configuration. To use Variable Substitution only accept element in XML.
Thanks for all. -
Report For list of material Master with PO text
Hi all,
I need a report whether it is available in Standard SAP or a customized, for List of Material Master with their PO text.
If any one can help, please reply to this theard.
Regards,
Kapil KulkarniTo get the material number combined with the PO text you will need the help of an ABAP programmer. The programmer can create a report for you using the function module READ_TEXT in the function group STXD. The tables to use are:
STXH - STXD SAPscript text file header
STXL - STXD SAPscript text file lines
The selection screen should have at least the following:
OBJECT - STXH-TDOBJECT
NAME - STXH-TDNAME
LANGUAGE - STXH-TDSPRAS
TEXTID - STXH-TDID
You find the information for these fields by going to the PO text entry screen and displaying the header information under Goto -> Header. For materials, the object is MATERIAL, the name is "material number", the language is "EN", and the text ID is BEST. You can use this program to get long text in lots of places like information records, purchase order texts, etc.
Hope this helps. -
Find Material Document with Movement type 103 for material document 105
Hi experts,
In PO History, I have three line items with movement type 103 (Blocked Stock) and one with movement type 105 (From blocked stock to unrestricted stock). I would like to know the material document with movement type 105 document that has the movement type 103.
Regards,
AbdullahHi,
you can get the material documents (mblnr) for the movement type(bwart) in table AUFK.
But i think you need to pass some other data along with bwart like matnr or aufnr for getting the correct mblnr.
Regards,
Chaitanya -
Not able to create a material document with movement type 103
I am not able to create a material document with movement type 103,
The system is populating the value as 101 .
How do I create a matdoc with movement type 103?What is the error you receive? Please specify with message number.
On MIGO, you need to change the default value mvmt type value to 103 before you enter the PO number to be able to do 103.
Once this defualt value is set, you can enter the PO and item number in the document number fields and proceed with 103.
But you cannot change the mvmt type for already entered items from 101-103 or vice versa.
I think the 101-103 and 103-101 mvmt type conversion message is standard error message -
To fill in the material number with item category u201CBu201D for Framework Order.
The use of framework orders (also referred to as blanket purchase orders) enables you to procure a variety of materials or services from a vendor up to a predefined maximum value (the value limit).
Instead of a specific delivery date, you specify a validity period for the order.
Goods receipts or the entry and acceptance of services performed are not necessary in the case of a framework PO and limit items.
The invoices are posted directly with reference to the purchase order, provided that the specified value limit is not exceeded. When the value limit of the PO is reached, or the validity period is exceeded, the system issues a warning message. It is possible to book the invoices, but these are blocked for payment.
During the phase of service performance, the cumulative u201Cactual" values (for the services actually performed) are continually updated in the underlying purchase. This enables you to monitor the progress of a procurement project on an ongoing basis. By comparing the "actual" value with the total value, you can always obtain an overview of the degree to which a budget for unplanned services or materials has been exhausted (i.e. see whether predefined limits have been reached or nearly reached).
So with the Framework Order type (FO) and item category u201CBu201D you get the error that it is not allowed to fill in the material number with item category u201CBu201D.
Please suggest me the possible solution to fill in the material number with item category u201CBu201D for Framework Order.
Best Regards,
HarishaThe Framework order type is specialy defined for lesser value procurements (ex: stationeries, cleaning services ....) which are all not worthy to create Material Master at all.
If you are very sure to fill the Material number, then proceed with some other document type.
In what circumstances you want to put material number in FO order?
Karthi.
Maybe you are looking for
-
Sales Order Settlement to Only WBS
Hi, I have scenario like Sales Order Settlement to only WBS in make to order. Again from WBS settlement to COPA. So far I know WBS settlement to COPA and I am not sure in the 1 st scenario. Can you any body tell me where I need to configure, is it on
-
MTL_SECONDARY_LOCS_INTERFACE... Import Program
Hi all, I am working on Inventory Stock Locators Conversion, While exploring the interface table & Import program, I found the below statement (from Manufacturing API, Page no. 195) "You may also put in details about other interface tables not used b
-
Only partly sync between computers
I am interested in syncing my history to two other computers, and in the future I wish all the computers to be in sync with history. But when I use Firefox Sync, only some of my visited homepages are synced to the other computers. For example, yester
-
Reorganizing in Photoshop Elements Organizer 11
I want to import photos from a file on my computer into Photoshop Organizer 11 and REORGANIZE them. Once they are in there, I want to move some photos in front of others- chronologically- from 2-3 different cameras and then BATCH RENAME them all acco
-
Old firewire to new thunderbolt drive
I have a 2010 iMac 27. Id like to get a new thunderbolt hard drive. How do I connect them? Apparently the firewire to thunderbolt adaptor is one way and not the way I need.