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
Krishna

Hi 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

Similar Messages

  • 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 Today’s 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
    Thanks

    Hi ,
    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?

  • 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.Venkatasubramanian

    Hi 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

  • Change of Sold to Party in Sales order created with Reference to Contract

    Dear Gurus
    I want to change the sold to party in Sales Order created with reference to contract.
    When I create a Sales order with reference to contract the system copies all the partner functions- Sold to, Ship to, Bill to and Payer alongwith other data.
    However Sold to is marked as "Grey" and not changable, rest of the partners can be changed.
    There is no subsiquent document created with reference to this Sales Order.
    Please advice.
    Thanks a lot.
    Regards
    Raghu

    Hi ,
    Please follow the below mentioned step.
    1) Create a partner function letts say Authorized SP .
    2) Assign all the possible authorised  SP (customer) in the contract.
    3) When you create sales order with reff to Contract. Put the customer for whom you wish to create a sales order in release partner tab.
    Hop this will resolve our problem
    Regards,
    Krishna O

  • Sales Order Created with reference to Contract - Exchange rate Issue

    When Sales Order created with reference to contract VBKD fields KURSK and KURSK_DAT gets copied from contract and not redetrmined based on pricing date and Exchange rate type. I expected it to be determined based on pricing date is standard. What I am missing, should it be controlled by data transfers
    If Document currency and condition currency are different it cause problems with incorrect condition values are calculated, as KOMP-KURSK are copied from VBKD-KURSK
    Any help or directions would be greatly appreciated . We are on 4.7 ISOIL
    Sincerely Julietta

    Well,
    and if we have the same issue, but we don't have OIL Version, but simple 4.6C, which solution has to be applied then?
    Thank you
    Standa

  • 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
    Taranum

    Hi 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

  • 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

  • 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 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

  • Sales order creation with (Auto) refernece to Contract

    Hi all,
    I need your help and advice. I have configured the settings for contract referencing when sales order is created.
    so whenever there are multiple contracts available for a customer/material then the system shows a list of available contracts.
    also when there is only one contract available for a customer/material the system still shows a popup. what I want to do is that in case there is only one contract available then no message should be displayed.
    Can you pl advice which user-exit or parameter can I use to control this.
    Thanks.

    Did not quite get what you mean by ' when user enters some units only then it should make reference to contract". Appears like you want the reference but don't want it at the same time.
    and
    No contract units should get copied into order lines-  do you mean order should not copy the UOMs for item quantities or that order should not copy every one of the items from the contract.
    Any ways here are the areas where you can try:
    1) Copy control: Item level: (VTAA) :  a) Data Routine-  change it to not copy the quantity from contract. b)  Pos/Neg Quantity, c) Copy quantity  fields.
    2) Completion rule in item category
    3) User exits:
    MV45AFZB- USEREXIT_CHECK_VBAP
    MV45AFZZ - USEREXIT_MOVE_FIELD_TO_VBAP
    Hope this helps.

  • 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,
    Stuti

    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

  • Error while posting a sales order created with reference from contract for

    Hi,
    I am posting a sales document( Type: WA)  created with reference from contract document(  type wk2) for delivery.  The item category in the sales order of the Item is WAN. On posting this document for delivery I am getting the error as "Item category WAN is not defined".  Please help me out how to resolve this issue.
    Thanks
    Jayant

    Hi Jayant,
    I think its value contract releated error,
    You suppose to check material item category group through T.code-MM02 into sales2 tab and maintain VCIT,
    and do item category assignment through T.code- VOV4.
    plz.maintain like that,
    WK2 -          -VCIT-         -           - WAN(contract item category),
    wk2  -          -        -VCTR-          - WAN((contract item category),
    you should also maintain same against your standard Sales Document type and for Standard Item category into VOV4,
    WA(standard docu.type) -VCIT-                             -                -TAN(your standard docu.type item category),
    WA(standard docu.type) -         -VCTR(item usage)-              -TAN(your standard docu.type item category),

  • Sales order document with reference to Contract

    Hi Sap gurus,
    I have question pertaining to sales order with refrence to contract documents,
    I have created 2-3 contract documents, and with reference to these contracts i am creating a sales order, while i am creating the sales order i am supposed to get the Pop-UP box stating that this customer and particular material has got open contract documents , but i am not getting any such message why.? though there are open contract documents for that particular customer and material combination.

    To get the pop up message, u need to Goto  t. code VOV8, under transaction flow tab, there is a field called outline agreement messages.
    There u need to enter an entry as per ur requirement.  After that u can try to create the release orders.
    Hope it is useful,
    Reward points if useful...
    Regards
    Kaleeswaran

Maybe you are looking for

  • Primary screen goes dark when external display is added

    Hi, Earlier, when I was on Mac Lion, I always used to face problems whenever an external Monitor was added to the Mac through the firewire to VGA converter port. Hoping that Mavericks update would give me a respite from the issue, I upgraded my Mac P

  • CRM/AET Help

    Hi, I need to add few zfields to the Sales Quotation, Service Quotation, Service Order  in SAP CRM , I am new to CRM and i found that AET tool in CRM can be used to enhance these tcodes. I need the below information , can some one help me with this 1

  • Convert Double To String

    Hello, I have the following method: private String doubleToString(double value, int kommas)      int stringLength;      String mString ="";      String mSubstringSuf ="";      Double dValue = new Double(value);      mString = new String(dValue.toStri

  • Confused with the WP Enrollment Process

    Hi team, I'm studing the WP MDM documents from http://technet.microsoft.com/en-us/library/dn499787.aspx and faced some questions really need your help. I can get the Dicovery response from the service in current and I set the <AuthPolicy> to Federate

  • Pacman: "error: database path undefined"

    Whenever I try do anything with pacman, I get the error quoted in the title. This was after accidentally deleting /var in the process of mounting a partition there. I'm fearful that I've deleted something vital; namely, pacman's internal record of wh