Order creation with Sales BOM........
Hi there ,
If I maintain the MRP & work scheduling view in the material master & maintain <b>BOM with usage as <b>sales</b>.</b> Then can I create as process/production order of that material as there is no BOM with usage type production maintained in SAP........
Please enlighten me ........
Thanks
Kaushik
Kaushik,
A process/production order can be created without BOM also, so the answer is yes still you can create a production order.(You will get an additional status "NMAT" - No material).
If the usage is defined as Sales then that BOM will not get picked for Prodn/Proc order.
If the Item level details of the component is also defined "production relevant" with "Relavent to sales", then the BOM gets picked up. (This is defined in Status/Long txt tab page in component item level details).
Hope this helps...Reward your points if so,
Regards,
Prasobh
Similar Messages
-
Planned order creation with sale order assingment at the run time of MRP
some material item not planed with sale order stock in MRP run time. all setting in material master are corrected as i knowing.having some mistake in setting other configuration.
Planning strategy is Make to order individual collective as individual but still come as make to stock plan orders
Incase of Header material- Plan order is creating in MTS
Check the sale order procurement tab, Is The requiremnt type is relevant to your Stratergy?, if not chnage it to correct requiremnt type and rerun MRP again
Incase of component material- Plan order is creating in MTS
Check for the component material MRP 4 View, individual/Coll.req- as 1. If not set as 1 and rerun the MRP again -
Process order creation with out BOM
Hi
I have an requirement...
material A is finished good
i create process order for material A
but i dont use BOM... with out BOM can i create process order .
after creating process order cani isuue components against order ? is it possible please can any one help me in this issue
but one condition : i craet process order material A 10 KG
for this FG i used components materia A used 8 kg and material B used 2 kg
is it possibel pls..could any one gude me in this issue
Regards
Sesimaterial A is finished good
i create process order for material A
but i dont use BOM... with out BOM can i create process order .
yes, You can create a orderwith out BOM
after creating process order cani isuue components against order ? is it possible please can any one help me in this issue
Yes, You can assign component manually in component overview screen or you can issue material directly for order with 261 movement, It will go to unplanned consumption
but one condition : i craet process order material A 10 KG*
for this FG i used components materia A used 8 kg and material B used 2 kg
In The component overview screen of process order assign the Material A with 8 kg ,
& material B as 2 KG
Regards,
Sundaresan
Edited by: Sundaresan . E. V on Oct 4, 2010 2:41 PM -
3rd Part Dropship Scenario with Sales BOM
Hi
We have a 3rd Party Dropshipment scenario with Sales BOM with susequent Debit
Characteristics of Sales BOM
Sales BOM is created
Header Material is Valuated but non-inventorised (Accounting and costing view should exist)
Component Material is Valuated and inventorised
In Sales order, Pricing is done at the header material not at the components level
During Billing we get the COGS for the header material (cost coming from VPRS)
No VPRS exist at component level instead we have copy of VPRS just to capture the value in COPA for our reporting
Process
1. Sales Order created with Sales BOM exploded in sales order.
2. At the Item level Purchase requisition is created.
3. PR for the components is converted to PO
4. Vendor Delivers the components to Customer.
5. Statistical GR done in our system.
6. Invoicing is done in MIRO
7. We directly do the Billing. Billing is created at header level. Revenue and COGS is reported at Header level only.
We are stuck when we are doing the Subsequent Debit (can be for any unplanned cost). For Susequent Debit we are not able to report differential COPA at header level.
Normally whenever you do subsequent debit in case of 3rd party dropship for normal material, COPA document automatically attached to Billing. This is happening because of the behaviour of VPRS condition type. In our case VPRS only exists at header level and not at component level but replenishment is for components. Subsequent debit is also happening at component level. We need it to be reported at header level.
We need some solution to this.
Please advise
Regards
Neeraj
Edited by: NEERAJ BHARDWAJ on Dec 2, 2011 5:12 AMHi Raj,
Please clarified your requirement here, you mention that you wanted to valuated COGS at actual cost of PO? That sound more like actual costing here and what is the reason for this requirement?
Is this MTO with variant configuration?
If this is MTO with VC, Yes - we do cost Sales Order and here is the brief steps:-
Price Control S
a) Sales Order Creation - Normally when you save this will be costed and marked automatically. Note that condition type EK02 will represent the cost here
b) Run MRP based on Sales Order requirement which resulting planned orders, PR, etc
c) Convert PR-PO, Planned Order -> Production Order
d) Confirmations, GR on PO which valuated according to the SCE Costing in step a)
e) PGI will be based on the GR value on step d) which is also your SCE Costing
f) Any variance between PO and SCE need to be settle.
Thanks,
Ong Yang Lim -
Create ecatt script for one sales order creation with multiple line items
Hi ,
I want to create a ecatt script for one sales order creation with multiple line items. Preferably SAP GUI.
This selection of data will be from an external file/ variants which will have only one row of data in it.
Firstly: I have to sort the external file having same PO Numbers in an order.Group them together.
Second: I have to create sales order for those many line items having same PO Number.
Best Regard
TaranumHi Micky
Firstl you should upload the Line items for a particular sales Order in an Internal table
and then pass that internal table to your BAPI during your coding corresponding to a particu;lar sales order
In case of any issues pls revert back
Reward points if helpful
Regards
Hitesh -
Exit for production order creation that update BOM explosion date
Hi Guros
does any one know a user exit for production order creation that update BOM explosion date = AUFLD.
or a UE that run before the BOM explosion.
thanks.Dear,
I dont think user exist will work for you,
You need to find BAdi for it, cl_exithandler=>get_class_name_by_interface .
Or try with SE84,
Enter the package name and check the " Enhancements"
Regards,
R.Brahmankar -
Purchase order creation with reference to Contract
Dear All
Purchase order creation with reference to quantity contract the contract quantity is not copied in to po. any configuration copying rules required. please guide
Regards
Anand.Hi Buddy
The correct business process is RV Preq created by a user from any department then buyer converts this Preq to a MK contract with some quantity keeping the duration as some months/year. Then as and when material mentioned in the contract is required during the validity period of the contract MRP creates Preq or buyer manually creates NB preqs , same are then converted to PO but these PO are released against MK contract. So qty in PO are different then mentioned in contract because contract is for a large qty keeping in mind the duration (for example one year).
Regrds
Yogesh -
TCODE for Process order creation against Sales order
Hi gurus,
Pls tell me what is the TCODE for Process order creation against Sales order
Eg. CO07 is for production order from sales ordeTypically, in MTO scenario after the sales order is created you run MRP which will create planned order and then you convert that into production order using MD04.
Or if you have SD settings correctly directly from the release of Sales Order it will create planned order or production order.
please check and revert back. -
How to deal with purchase order purchased with sale order
Hi,
I know we can produce with sale order, and the finished products can be priced in their own sale order and line item even when the finished product master data is set 'S' in its price control field. But how to deal with purchase order purchased with sale order if its price control is 'S' and the purchased material can be priced differently with its own sale order?
thanks.Hi,
That is to say, we want to get these results:
1. material purchased must match its sale order and its item
2. the purchased material is valued by sale order and its item when it is put into the stock.
3. the purchased material is set "valued by standard price' in its material master data.
How to practice?
Thanks. -
Sales Order Creation with reference to Contract
Hi all ,
Existing Setup in the System:
1) I have a contract created with a validity period of 30 days. When i create sales order with reference to contract, then i get a pop-up box, from the box i can select my contract.
2) I have a Lead time configured as 5 days for the Sales document type , I,e when I create sales order I can see my Requested delivery date is always system date + 5 days.
3) I have a Pricing date configured as Todays date. Therefore when I create sales order I can see pricing date becomes the system date.
Execution of Sales Order:
4) When I create Sales Order with reference to contract document. Always Requested Delivery date is compared with Contract Validity Dates.
Example: Contract Validity 01/03/2008 - 31/03/2008
Sales Order: Sales Order Creation date -> 19/03/2008, Pricing Date: 19/03/2008 Requested delivery date 24/03/2008.
REQUIREMENT IS:
But my requirement is when i create Sales Order it should consider System date or Pricing Date( since pricing date is today date) for to compare with contract validity dates.
Can it be done with standard config or do we need to some type of custom? Appreciate your help
ThanksHi ,
As said when I create Sales Order with reference to contract document. Always Requested Delivery date on Sales Order is checked against Contract Validity Dates.
But i want Pricing date in Sales Order should be checked against Contract Validity Dates.
Can someone suggest me on this? -
Sales order creation with respect to contracts
Hi Guys,
I am trying to create a saleorders with referece to contract for which in the background I configured so that during my sales order creation I see the pop-up box with all existing contracts for a specified sold-to party.
This process is so painful that order entry people have to manually select from the big list (pop up box consisting of huge list).
Is there any way so that I can automate this process insetead of selecting contracts from that list.
Regards
KrishnaHi Ravi,
Thanks for your solution and could you please give me some more details what is the neame of the user exit.
and welcome for some more suggestions.
Thanks
Krishna
One way is to create the order with reference to the Contract and then the system will not give the pop up for the existing contracts.
The other way to automate the process is by using a userexit. Here the system should check all the existing valid contracts for this sold to party and should select the oldest or latest valid contract, as per the client choice.
Thanks,
Ravi -
Sales Order creation with Ship to not assigned to Sold to
Hi There,
I have an issue that I am able to create an order with a Ship to which is not assigned to Sold to. i.e, The sold to accepts any ship to and not giving any error. I am giving both Sold to and Ship to together while order creation. Is it because of this? Should I enter sold to and then press enter for the list of Ship to's assigned to that? I dont find any issues in the Partner determination.
Can you help?
Thanks in advance,
RenjithHi Renjith,
I agree with you that SAP allows you to enter any ship to(belonging to sales org of sold-to party) for a given sold to party.
To meet your requirement, You may like to use the Userexit MV45AFZZ (Form USEREXIT_SAVE_DOCUMENT_PREPARE) to check the Ship-to while saving. Thus a comparison could be made with assigned Ship-Tos for the given Sold-to party. In case there is a mismatch throw a error message before allowing committing of save.
Your developer would be able to help you to achieve this
Please let me know if this helps
Warm regards
Harpreet -
Sales order creation with bapi in webdynpro using table control
When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of data sale order is getting created in va01 for multiple line items. Pls give me some idea to resolve this issue, here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2' method CREATE_SALES_ORDER .
Declaration for Order Header Node DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.
-
Sales order creation with bapi in webdynpro
When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of data sale order is getting created in va01 for multiple line items.
Pls give me some idea to resolve this issue,
here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2'
method CREATE_SALES_ORDER .
Declaration for Order Header Node
DATA: node_order_header TYPE REF TO if_wd_context_node,
elem_order_header TYPE REF TO if_wd_context_element,
stru_order_header TYPE if_componentcontroller=>element_order_header .
Declaration for Order Items Node
DATA: node_order_items TYPE REF TO if_wd_context_node,
elem_order_items TYPE REF TO if_wd_context_element,
stru_order_items TYPE if_componentcontroller=>element_order_items .
Declaration for Order Partners Node
DATA: node_order_partners TYPE REF TO if_wd_context_node,
elem_order_partners TYPE REF TO if_wd_context_element,
stru_order_partners TYPE if_componentcontroller=>element_order_partners .
node_order_header = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_header
elem_order_header = node_order_header->get_element( ).
elem_order_header->get_static_attributes(
IMPORTING static_attributes = stru_order_header
<ORDER_ITEMS> via lead selection
node_order_items = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_items ).
elem_order_items = node_order_items->get_element( ).
elem_order_items->get_static_attributes(
IMPORTING static_attributes = stru_order_items ).
<ORDER_PARTNERS> via lead selection
node_order_partners = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_partners ).
elem_order_partners = node_order_partners->get_element( ).
elem_order_partners->get_static_attributes(
IMPORTING static_attributes = stru_order_partners ).
DATA: v_sales_doc TYPE bapivbeln-vbeln.
DATA: w_order_header_in TYPE bapisdhd1,
i_order_header_in TYPE table of bapisdhd1,"
i_order_partners TYPE TABLE OF bapiparnr,
w_order_partners TYPE bapiparnr,
i_return TYPE TABLE OF bapiret2,
w_return TYPE bapiret2,
i_order_items_in TYPE TABLE OF bapisditm,
w_order_items_in TYPE bapisditm,
i_order_conditions_in TYPE TABLE OF bapicond,
w_order_conditions_in TYPE bapicond,
w_order_SCHDL type BAPISCHDL,
i_order_SCHDL type table of BAPISCHDL.
Order Header Details
CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in,
i_order_conditions_in, w_order_SCHDL, i_order_SCHDL.
refresh : i_order_partners, i_return, i_order_items_in,
i_order_conditions_in, i_order_SCHDL.
w_order_header_in-doc_type = stru_order_header-doc_type.
w_order_header_in-sales_org = stru_order_header-sales_org.
w_order_header_in-distr_chan = stru_order_header-distr_chan.
w_order_header_in-division = stru_order_header-division.
w_order_header_in-req_date_h = stru_order_header-req_date_h.
w_order_header_in-sales_dist = stru_order_header-sales_dist.
w_order_header_in-purch_no_c = stru_order_header-purch_no_c.
Order Item Details
CLEAR: i_order_items_in,w_order_items_in.
w_order_items_in-itm_num = stru_order_items-itm_num.
w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER.
w_order_items_in-material = stru_order_items-material.
w_order_items_in-target_qty = stru_order_items-target_qty."'5'.
w_order_items_in-target_qu = stru_order_items-target_qu."'5'.
w_order_items_in-plant = stru_order_items-plant.
w_order_items_in-target_val = stru_order_items-target_val.
w_order_items_in-currency = stru_order_items-currency.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_order_items_in-material
IMPORTING output = w_order_items_in-material.
APPEND w_order_items_in TO i_order_items_in.
Order Partner Details
CLEAR: i_order_partners,w_order_partners.
w_order_partners-partn_role = stru_order_partners-partn_role.
w_order_partners-partn_numb = stru_order_partners-partn_numb.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING input = w_order_partners-partn_numb
IMPORTING output = w_order_partners-partn_numb.
APPEND w_order_partners TO i_order_partners.
Order Condition Details
w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'.
w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'.
APPEND w_order_SCHDL to i_order_SCHDL.
Create Sales Order BAPI Call
*loop at i_order_header_in into w_order_header_in.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = w_order_header_in
IMPORTING
salesdocument = v_sales_doc
TABLES
return = i_return
order_items_in = i_order_items_in
order_partners = i_order_partners
order_schedules_in = i_order_SCHDL
order_conditions_in = i_order_conditions_in.
Get message manager
DATA: l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.
l_current_controller ?= wd_this->wd_get_api( ).
CALL METHOD l_current_controller->get_message_manager
RECEIVING
message_manager = l_message_manager.
DATA: v_message_text TYPE string.
When Sales Order is created commit the data
IF NOT v_sales_doc IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
CONCATENATE 'Sales Document' v_sales_doc 'has been created.'
INTO v_message_text SEPARATED BY space.
Report Success message
CALL METHOD l_message_manager->report_success
EXPORTING message_text = v_message_text.
ELSE.
v_message_text = 'Error Creating Sales Order'.
Report Error message
CALL METHOD l_message_manager->report_error_message
EXPORTING message_text = v_message_text.
ENDIF.
*endloop.
endmethod.
and code for table control i am using is
method WDDOINIT .
Types : Begin of item_tab,
itm_number type bapisditm-itm_number,
material type bapisditm-material,
plant type bapisditm-plant ,
target_qty type bapisditm-target_qty,
target_qu type bapisditm-target_qu,
target_val type bapisditm-target_val,
currency type bapisditm-currency,
end of item_tab.
*Creating internal table and Work Area of the same structure
*as that of the Node created.
Data : it_item type standard table of item_tab,
wa_item type item_tab.
*Appending Blank Work Area to Internal table.
***********************************************888
*LOOP AT it_item INTO wa_item.
**wa_item-itm_number to bapisditm-itm_number.
**wa_item-material to bapisditm-material.
**wa_item-plant to bapisditm-plant.
**wa_item-target_qty to bapisditm-target_qty.
**wa_item-target_qu to bapisditm-target_qu.
**wa_item-target_val to bapisditm-target_val.
**wa_item-currency to bapisditm-currency.
APPEND wa_item TO it_item.
*ENDLOOP.
**********************************************88
Do 10 times.
Append wa_item to it_item.
enddo.
"Binding the table
DATA lo_nd_order_items TYPE REF TO if_wd_context_node.
DATA lt_material TYPE wd_this->Elements_material.
navigate from <CONTEXT> to <MATERIAL> via lead selection
lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ).
@TODO handle non existant child
IF lo_nd_material IS INITIAL.
ENDIF.
@TODO compute values
e.g. call a model function
lo_nd_order_items->bind_table( new_items =
it_item set_initial_elements = abap_true ).
endmethod.When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of data sale order is getting created in va01 for multiple line items.
Pls give me some idea to resolve this issue,
here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2'
method CREATE_SALES_ORDER .
Declaration for Order Header Node
DATA: node_order_header TYPE REF TO if_wd_context_node,
elem_order_header TYPE REF TO if_wd_context_element,
stru_order_header TYPE if_componentcontroller=>element_order_header .
Declaration for Order Items Node
DATA: node_order_items TYPE REF TO if_wd_context_node,
elem_order_items TYPE REF TO if_wd_context_element,
stru_order_items TYPE if_componentcontroller=>element_order_items .
Declaration for Order Partners Node
DATA: node_order_partners TYPE REF TO if_wd_context_node,
elem_order_partners TYPE REF TO if_wd_context_element,
stru_order_partners TYPE if_componentcontroller=>element_order_partners .
node_order_header = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_header
elem_order_header = node_order_header->get_element( ).
elem_order_header->get_static_attributes(
IMPORTING static_attributes = stru_order_header
<ORDER_ITEMS> via lead selection
node_order_items = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_items ).
elem_order_items = node_order_items->get_element( ).
elem_order_items->get_static_attributes(
IMPORTING static_attributes = stru_order_items ).
<ORDER_PARTNERS> via lead selection
node_order_partners = wd_context->get_child_node(
name = if_componentcontroller=>wdctx_order_partners ).
elem_order_partners = node_order_partners->get_element( ).
elem_order_partners->get_static_attributes(
IMPORTING static_attributes = stru_order_partners ).
DATA: v_sales_doc TYPE bapivbeln-vbeln.
DATA: w_order_header_in TYPE bapisdhd1,
i_order_header_in TYPE table of bapisdhd1,"
i_order_partners TYPE TABLE OF bapiparnr,
w_order_partners TYPE bapiparnr,
i_return TYPE TABLE OF bapiret2,
w_return TYPE bapiret2,
i_order_items_in TYPE TABLE OF bapisditm,
w_order_items_in TYPE bapisditm,
i_order_conditions_in TYPE TABLE OF bapicond,
w_order_conditions_in TYPE bapicond,
w_order_SCHDL type BAPISCHDL,
i_order_SCHDL type table of BAPISCHDL.
Order Header Details
CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in,
i_order_conditions_in, w_order_SCHDL, i_order_SCHDL.
refresh : i_order_partners, i_return, i_order_items_in,
i_order_conditions_in, i_order_SCHDL.
w_order_header_in-doc_type = stru_order_header-doc_type.
w_order_header_in-sales_org = stru_order_header-sales_org.
w_order_header_in-distr_chan = stru_order_header-distr_chan.
w_order_header_in-division = stru_order_header-division.
w_order_header_in-req_date_h = stru_order_header-req_date_h.
w_order_header_in-sales_dist = stru_order_header-sales_dist.
w_order_header_in-purch_no_c = stru_order_header-purch_no_c.
Order Item Details
CLEAR: i_order_items_in,w_order_items_in.
w_order_items_in-itm_num = stru_order_items-itm_num.
w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER.
w_order_items_in-material = stru_order_items-material.
w_order_items_in-target_qty = stru_order_items-target_qty."'5'.
w_order_items_in-target_qu = stru_order_items-target_qu."'5'.
w_order_items_in-plant = stru_order_items-plant.
w_order_items_in-target_val = stru_order_items-target_val.
w_order_items_in-currency = stru_order_items-currency.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_order_items_in-material
IMPORTING output = w_order_items_in-material.
APPEND w_order_items_in TO i_order_items_in.
Order Partner Details
CLEAR: i_order_partners,w_order_partners.
w_order_partners-partn_role = stru_order_partners-partn_role.
w_order_partners-partn_numb = stru_order_partners-partn_numb.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING input = w_order_partners-partn_numb
IMPORTING output = w_order_partners-partn_numb.
APPEND w_order_partners TO i_order_partners.
Order Condition Details
w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'.
w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'.
APPEND w_order_SCHDL to i_order_SCHDL.
Create Sales Order BAPI Call
*loop at i_order_header_in into w_order_header_in.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = w_order_header_in
IMPORTING
salesdocument = v_sales_doc
TABLES
return = i_return
order_items_in = i_order_items_in
order_partners = i_order_partners
order_schedules_in = i_order_SCHDL
order_conditions_in = i_order_conditions_in.
Get message manager
DATA: l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.
l_current_controller ?= wd_this->wd_get_api( ).
CALL METHOD l_current_controller->get_message_manager
RECEIVING
message_manager = l_message_manager.
DATA: v_message_text TYPE string.
When Sales Order is created commit the data
IF NOT v_sales_doc IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
CONCATENATE 'Sales Document' v_sales_doc 'has been created.'
INTO v_message_text SEPARATED BY space.
Report Success message
CALL METHOD l_message_manager->report_success
EXPORTING message_text = v_message_text.
ELSE.
v_message_text = 'Error Creating Sales Order'.
Report Error message
CALL METHOD l_message_manager->report_error_message
EXPORTING message_text = v_message_text.
ENDIF.
*endloop.
endmethod.
and code for table control i am using is
method WDDOINIT .
Types : Begin of item_tab,
itm_number type bapisditm-itm_number,
material type bapisditm-material,
plant type bapisditm-plant ,
target_qty type bapisditm-target_qty,
target_qu type bapisditm-target_qu,
target_val type bapisditm-target_val,
currency type bapisditm-currency,
end of item_tab.
*Creating internal table and Work Area of the same structure
*as that of the Node created.
Data : it_item type standard table of item_tab,
wa_item type item_tab.
*Appending Blank Work Area to Internal table.
***********************************************888
*LOOP AT it_item INTO wa_item.
**wa_item-itm_number to bapisditm-itm_number.
**wa_item-material to bapisditm-material.
**wa_item-plant to bapisditm-plant.
**wa_item-target_qty to bapisditm-target_qty.
**wa_item-target_qu to bapisditm-target_qu.
**wa_item-target_val to bapisditm-target_val.
**wa_item-currency to bapisditm-currency.
APPEND wa_item TO it_item.
*ENDLOOP.
**********************************************88
Do 10 times.
Append wa_item to it_item.
enddo.
"Binding the table
DATA lo_nd_order_items TYPE REF TO if_wd_context_node.
DATA lt_material TYPE wd_this->Elements_material.
navigate from <CONTEXT> to <MATERIAL> via lead selection
lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ).
@TODO handle non existant child
IF lo_nd_material IS INITIAL.
ENDIF.
@TODO compute values
e.g. call a model function
lo_nd_order_items->bind_table( new_items =
it_item set_initial_elements = abap_true ).
endmethod. -
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
Maybe you are looking for
-
How to use TextFormat on multiple frames
I must be missing something, but how on earth do I make it so that I can set TextFormats for the whole movie and not just the frame the actionscript is on. My movie is basically a video with cuepoints that trigger different keyframes that display tex
-
Best Practice for initial data
When installing a database onto a new server, I do not know what is the best solution to populate the database with the initial data that needs to exist before I can start running. I have sql scripts that take care of creating the tables, constraints
-
JButton in inner class cuasing Null Pointer Excp
Ok so i have this class called "square" and in it there is a JButton. There is a method called createButton() and getButton(). In create button it takes the classes JButton called button and instantiates: public void createButton() { button = new JBu
-
How I know my iphone model was real 3GS?
I bought my iphone last a month but *now days I realized that my model was MC131B verson 3.1.3(7E18)* setting on the phone . *my question is , what really does my iphone model is?* When I bought this iphone the salesman told that was Iphone 3GS. I'm
-
Hi, When mbp is sent to sleep, safari stops all downloads but doesnt clear from list. When waking up, you click resume download but it starts downloading the file again right from the start despite the fact that it had already downloaded part of it b