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

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

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

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

    hi,
    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 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

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

  • BAPI for sales order creation with Reference

    Hello Experts,
    I have a order, with its reference I have to create a new sales order.
    Am looking for BAPi, with which I can create a sales order with a Reference order (which is in my hand), so I checked SE37 with wild cards, but I did not find any!!
    1) Pls. let me know a BAPI
    2) And just like that I do not want to create a new order with the reference(existing) order, I have to change the PO number & order Reason(2 fileds) in newley creationg order, pls. let me know How to do it
    Thank you

    Hi,
    First try to pass these two parameters to BAPI_SALESORDER_CREATEFROMDAT2
    ORDER_HEADER_IN-REFDOCTYPE = Your Sch. Agreement No. (Please Check) and
    ORDER_HEADER_IN-SD_DOC_CAT = 'E'.
    If the above doesnt work ,than try using BAPI "BAPI_SALESDOCUMENT_COPY"
    I hope you are working in SAP R/3 4.6C and above version because i am not sure whether this BAPI is available in lower version.
    Let us know if this helps you..
    Rgds,
    Mayank

  • Is there any BAPI available for sales order creation with reference?

    Hi Experts,
    My requirement is to create sales order with reference for order type.
    Now my billing document number already contains the two items
    one is correct and another is zero quantity.
    I want to create order with reference of billing document but not with zero quantity item.
    Which BAPI I should use and what to pass to ignore zero quantity item?
    Regards,
    RH

    Hi Ronny,
    Try using BAPI_SALESORDER_CREATEFROMDAT2
    Regards,
    Shraddha

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

  • 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

  • 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

Maybe you are looking for

  • Music Downloading

    I have just received a new Nokia Lumia 520 for Christmas and yes, it is an amazing phone. The thing is, I can't transfer my music from my laptop to the phone. I had no problem downloading music onto it from my windows 7 computer. But today when I had

  • Message "data was copied" on FB01 via substitution

    Dear gurus On FB01, when I insert "invoice ref." manually and change the "baseline date" manually, the message showed that "data was copied". This is what I want. However, when I insert "invoice ref." via substitution(GGB1), the message "data was cop

  • Effectivity in ECR/ECO

    Can some one help me to resolve my query? We are having ECR system developed for existing system and we have not utilized all the provided features of SAP 4.6C Now we are going for SAP ECC6.0 where-in we ant to use effectivity parameter for controlli

  • BPM in SolMan

    Hello, We currently have completed implementation using SolMan and gone-live. From the operational side of things we have set up EWA and Maintenance Optimizer in our SolMan. We are planning to implement Business Process Monitoring (BPM) functionality

  • HT203311 Bonjour service disabled.

    I want to use home sharing again but one computer says Bonjour service has been disabled so I can't share.  How do I re-enable Bonjour?