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,
Renjith
Hi 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
Similar Messages
-
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 -
Ship-To not assigned to Sold-To, even though able to create an order
Hi,
We have a peculiar scenario.
We have a Sold-To Ex: 1100, ship to 1200 and 1300 for a sales area, ex 1000-10-10. Here only 1200 Ship-to is assigned to Sold to 1100. ( SH 1300 is not assigned to SP 1100).
I am able to create an order for 1100 and 1200 for the above sales area, it is fine with the system.
But system is allowing me to create and order for 1100 and 1300 toooo. As per my knowledge system should not accept this order and system should give us a message like this "ship to is not maintained for this sold to" or some thing like that.
This is happening in ECC6.0. As i already checked with the system there is no enhancement or user exits used. Is it standard behavior of ECC6.0 or is there any solution for this problem.
Any help help form any one so much help full.
Thanks
Venkat Cheedalla.Hi Venkatesh,
You can do this in Customer Master of Sold-to party: 1100. In master, go to Sales Area Data Tab --> Partners Tabstrip. There you will find a Ship-to-Party Customer Code. Here change the 1100 code to 1200. Then Save.
Now while creation of Sale Order, system will automatically give you the Ship-to party as 1200. And if you want to change that Ship-to Party, then system will give you an Information message that Ship-to needs to be redetermined.
If you want that this Information Message should come as Error Message, then I think some customizations needs to be done in SPRO.
Regards,
Vishal -
Sales Order Creation with reference to Quotation using FM IDOC_INPUT_ORDERS
HI Guru's,
I've a requirement to create the sale order from the quotation.
For this we are using the FM "IDOC_INPUT_ORDERS".
Here my problem is i'm able to create the sales order with the custom program, but if i made any changes to the quotation Header
(Ship-to party address) before creating the sales order, it is not reflecting into the sales order header level (ship-to party address).
What i was thinking is we are not using the Quotation as reference to create the sales order while filling the segments.
Could you please tell me which segment do i need to use fill the reference document number (quotation) at header level.
one more problem, if i change ship-to party of one line item, it is affecting the other line items also.
Please guide me what to do???
Thanks,
Adi.HI Ramesh,
Question:
Could you please tell me which segment do i need to use fill the reference document number (quotation) at header level.
Sol: use segment E1EDK02
Segment type E1EDK02 IDoc: Document header reference data
QUALF 011 : Referenced Document Number
BELNR XXXXX IDOC document number
DATUM 20100121 IDOC: Date'
what i've used in my program
I'm using the E1EDK02 segment as you mentioned above.
le1edk02-qualf = '011'.
e1edk02-belnr = Quotes-vbeln.
Question:
Here my problem is i'm able to create the sales order with the custom program, but if i made any changes to the quotation Header
(Ship-to party address) before creating the sales order, it is not reflecting into the sales order header level (ship-to party address).
Sol: Check you custom code .. whether you are bringing write address to segement or not
(if you change any address in Quotation then Address master is added with new entry with new address no )
In my program..
I'm passing the partner numbers and partner types (WE & AG) to the segment "E1EDKA1". (Ship-to & Sold-to).
What i was thinking is the above segment is causing the problems, because if we reference the Quotation, we should not pass the Ship-to and sold-to numbers, it should take all those from quotation.
I've tried to comment the code which we have written for that segment "E1EDKA1", it is giving me the error saying that
Customer numbers can't be determined for the document number..
Please guide me how to solve this problem..
Thanks,
Adi. -
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 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. -
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? -
Material Variant Matching in Sales Order Creation with ref.to Sales Order
Hi All,
We are working in Variant configuration.Our product is defined at PQD(Product, Quality & Dimension).
But, Sales Contracts are created at PQ (Product, Quality/Grade ) level only.
We have defined Variant Characteristics GRADE(ALLOY CODE),DIMENSION AND TWO MATERIALS.
MAT 1 , configurable material.
MAT 2, A Material Variant of MAT 1, Having values of GRADE = A & DIMENSION = 150 in MRP 3 view of the same.
When a Sales Order is created for MAT 1 and its characteristics values are GRADE = A, DIMENSION = 150, Material Variant type matching happens & it replaces the configurable material.
Similarly,Sales Contract is created for Configurable material MAT 1, with only GRADE = A ( As mentioned above, only quality is known at contract creation level).But, when we are trying to creart a Sales Order with reference to this Contract, we are trying to punch characteristic Value for DIMENSION = 150 also. At this stage, Materuial Variant MAT 2 is shown, but it is not replacing MAT 1.
Is this the standard behaviour or there is some solution/enhancement available.
regards,
StutiDear Vijay,
in incompletion procedure we can arrange to check whether any field is empty, here data comparison is not possible.
As far as I know you can not achieve this through standard config.
To achieve your requirement, you will need to take help of an ABAPer, it can be achieved using Userexit.
ABAPer can use include MV45AFZZ
and Userexit ""USEREXIT_SAVE_DOCUMENT".
the code written in this userexit will check and compare the quantities before saving the dcument.
Logic if quantity enter is greater than the quantity mentioned in Contract show warning Message.
I hope this solves your Problem.
Regards,
Paresh -
Return Order Creation with Multiple Lines not possible - EHP3
Hi Experts,
We are facing an issue while creating Return Orders with external reference billing document post upgrade from CRM 7.0 to EHP3.
While we select multiple line items from the external reference billing document and Create a return order(BT120H_CPL/NewComplEF ), the very first line item gets repeated instead of all the line items getting copied to the subsequent view(BT120H_CPL/ItemList ).
Please help.
Thanks,
RohitI hope you have tried.If not can you please try with below qualifier
'015' Billing Document Number of Invoicing Party
Provide the billing document EEDK02-BELNR.
Also give qualifier at item level
E1EDP02 : use Qualifier =15
Provide the Billing document number at E1EDP02_BELNR and item at ZEILE.
I am not sure what is error you are getting when you are referencing billing document.If something STD Idoc is not working as you expected use your custom logic to bring the data when you are posting the Idoc.
I have not worked on sales order process,But I have worked on Purchase Order creation process.
Please let me know the error ,If i know the error i will defiantly help you. -
Sales order creation with reference to check quantity according reference
Hi,
I create return sales order with reference. But the problem is that system can not check the quantity of creation sales order according reference quantity now. I want the system check the quantity according reference sales order quantity and do not allow to put sales order quantity more than reference sales order quantity.
Thanks.hi,
please check the below thread
Return Quntity is more the sales Quantity?
this may help you
regards
senya -
Problem in Sales Order Creation with reference to Contract
Hi All,
We had enhanced Contracts (VA41) by adding fields thru append structures in VBAP and the same is provided in the "Additional Data B" tab at the item level.
The Z fields are populated with data and gets saved along with the contracts line items.
But when a sale order is created with reference to a contract, the data in the Z fields (maintained in Append Structures) of the contract are not getting copied to the line item of Sales orders.
Should a routine be necessarily written for copying Z fields from contract to Sales orders or Copy control must be set up for Z fields separately?
Any info on this would help.
Thanks,
K.V.VenkatasubramanianHi VJ,
The copying from Contract to Orders worked. I copied the standard routine (151) in data transfers and added the code to transfer Z fields from work area CVBAP to work area VBAP and attached the same in the copy control. It works!!!
Thanks for the help VJ.
Cheers,
Venkat -
Sales order creation with ref. to contract. Quantity related issue
Hii All,
I am creating sales order with ref. to contract. But i can enter more quantity than that mentioned in the contract. Here i need the system should give a warning while saving the order. I refered the thread Sales Order Against Contract
In this thread the procedure to convert the warning to error is given. but i need how to give this warning message.
In VTAA, I have maintained copy requirement as 303 at item level. & DataT as 151, 102 & 002.
Please suggest.Dear Vijay,
in incompletion procedure we can arrange to check whether any field is empty, here data comparison is not possible.
As far as I know you can not achieve this through standard config.
To achieve your requirement, you will need to take help of an ABAPer, it can be achieved using Userexit.
ABAPer can use include MV45AFZZ
and Userexit ""USEREXIT_SAVE_DOCUMENT".
the code written in this userexit will check and compare the quantities before saving the dcument.
Logic if quantity enter is greater than the quantity mentioned in Contract show warning Message.
I hope this solves your Problem.
Regards,
Paresh -
Sales order creation with reference to quote using BAPI
Hi All,
I am trying to create a sales order with reference to quote using BAPI BAPI_SALESORDER_CREATEFROMDAT2.
I am passing the Quote number and preceding doc.category (B) at the header level and
at item level I am passing the quote number and the line item number in the quote for REF_DOC and REF_DOC_IT.
The order is created but there seems to be some issue with the document flow.
I do not see the Reference Doc number at the header level from the Sales order document flow whereas I can see the Reference Doc for each line item.
In VBFA I can see the Ref.Doc number at the header level along with the Ref.Doc at the line item level.
Why do you think it is not showing at the header level from Sales Document Document Flow?
Is there any bug in the standard BAPI or is there any OSS note?
Any answer would be greatly appreciated.
Thanks
Sandeephi,
Are you giving different quotation numbers in the different line items, if that is the case you will not get that in the header document flow, as it cann't point to all the quotations.
Thanks,
Mahesh. -
Sales order creation with reference to a contract....urgent
Hi all,
I am creating a sales order with reference to a contract, but purchase order no. and date are not copying to the sales order due to standard sap settings, is there any solution to copy these two from contract to order ?
Useful solutions will be rewarded.Hi Jithendra,
You need to edit the copy control settings. Path
IMG Screen/Sales & Distribution/Sales/Maintain Copy control for Sales Documents.
In this Goto Copying Control for Sales Documents to Sales Documents. And you need to change the header settings for the given selection.
I think this might help you.
Regards,
Sreekanth
Maybe you are looking for
-
Can I add a simple PDF to the forms site?
I am looking to add a simple pdf - with no form content to my website and use my forms account to do so. Is that possible? I tried importing a pdf, but it needs editable content. Thank you for any help.
-
ISA 2006 with IPSEC and NAT - Publishing Outlook Anywhere - TCP Checksum Dropped 0xc0040031 problem
Hi I am looking to publish Outlook Anywhere, with IPSEC configured as per (http://www.microsoft.com/en-us/download/confirmation.aspx?id=23708) to lock down Outlook Anywhere to machines with internal certificates only. I have the following infrastruct
-
Help, i must resolve this problem. I must modify one existing application write on Apex 3.2 I must creat the output report in zip format, the application now create the output in Word, PDF, E-mail, end txt. Thanks for information. (sorry for my wron
-
Hello Sappers, Iam new to sap hr and i have been assisgned to a new implementation project. so first of all i have to go with q& a db and then bbp, so pls guide me in these areas . if anybody help me by mailing me any sample q & a db and bbp i will
-
Concurrent processing casing contention
I have 2 identical processes that I need to run concurrently, the only difference being each process handles a data set from a different day. I get the following error when both processes insert into the same table, even though no commit has yet been