Appending new quotation items into an existing sales order using copy cntrl

Hi,
Following is the requirement:-
1) Customer negotiates a quotation.
2) The quotation is converted to a sales order. The order replicates to ecc for fulfillment.
3) The customer negotiates another quotation and decides to place additional order.
4) However, the implementing organization wants to append / update the original sales order with the additional items on the new negotiated quotation using copy control.
Can this functionality be achieved through copy control enhancement or can this be handled some other way?
Regards
Ashish

Hi Alexander ,
Yes ofcourse you can use consignmentment Process
and you can use the concept of special stock partner in the partner profile
Spoecial stock partner (SB) can assign to your ship to party
1stly you can do consignment fill up(  with your customer name (ex-2316)
then at the time of creating the consignment issue parter function use 2361 customer
Regards    
Ramesh

Similar Messages

  • Urgent: How to copy multiple sales order items into a return sales order?

    Dear developers,
    I have a requirement to copy multiple sales order items into a single return sales order. For example, generated return sales order have 2 items, item 10 is created with reference to sales item 2610/10 and item 20 is created with reference to sales item 2611/20. What's more, when it happens, copy control should be taken care of. I know it is possible to create this kind of order by transaction. But how to do it in coding?
    In current SAP release, there is only BAPI for creating with reference on 1:1 relationship which means copy one document to another but what I need is N:1 copy.
    Any suggestion is high appreciated!!
    BR,
    Tony.

    Hi ,
    If you are creating sales order by using bapi then after calling bapi you can check import parameter <i><b>SALESDOCUMENT</b></i> in the bapi function module .If this parameter is not initial then sales order is created in this case you can create return order. If this import parameter is initial then sales order is not created and you cannot use return bapi function module.
    Bapi is simple method than BDC.
    In above case it is required to call BAPI_TRANSACTION_COMMIT after every successful sales order creation.
    One more important point is you have to clear import parameter <i><b>SALESDOCUMENT</b></i>  before calling sales order creation function module.
    Thanks,
    shyla

  • How to make a new line item appear in a sales order in VA01 transaction?

    Dear All,
    I am trying to create a SO with single line item with quantity 100.
    Upon hitting the 'Enter' key, if the available quantity is less than the requested quantity (say 20), it takes me to an availabilty control screen which has a push-button 'One-time delivery' on the application tool bar.
    Upon clicking on this button, it takes me back to the main screen of VA01 where I currently see only one line item with quantity 100 and confirmed quantity 20.
    My requirement here is to make two line items appear, one with quantity 20 and the other with quantity 80, once I navigate back to the main screen of VA01 after clicking on the push-button 'One-time delivery'.
    Please provide me your valuable inputs. Any kind of help is highly appreciated.
    Useful answers never go unrewarded.
    Regards,
    Sreekanth Reddy B.

    Hi Sreekanth ,
    creating line items based on the confirmation qty can be done thru config, not thru ABAP,standard SAP will gives you options to create a new line item for unconfirmed qtys.
    check with ur functional consultant or try to post in SD /APO forums.
    regards
    Prabhu

  • Set item, partner data of sales order using BAPI_BUSPROCESSND_CREATEMULTI

    hi all,
    i am using BAPI_BUSPROCESSND_CREATEMULTI to create sales order in CRM. the order is created but i dont have the partner information, item data, organization and schedule line data even though i am passing them in the bapi.
    I am generating a new guide each time for all these tables HEADER, ITEM, PARTNER, ORGANIZATION, SCHEDULELINE,u2026u2026
    and finally in 'BAPI_BUSPROCESSND_SAVE i am passing  the guide as the guide that i generated for HEADER table..I am i using the bapi in correct way?
    I don't know why I dont see any partner data, product data i, item data n my saved order.i dont know what values i should pass to the PARTNER table for REF_GUID , REF_KIND, REF_PARTNER_HANDLE . please help me.
    this is my code
    *****Internal Tables
    ***TABLES
    DATA: IT_HEADER TYPE TABLE OF BAPIBUS20001_HEADER_INS.
    DATA: IT_INPUT_FIELDS_FILL TYPE TABLE OF BAPIBUS20001_INPUT_FIELDS.
    DATA: IT_ITEM TYPE TABLE OF BAPIBUS20001_ITEM.
    DATA: IT_PARTNER TYPE TABLE OF BAPIBUS20001_PARTNER_INS.
    DATA: IT_ORGANISATION TYPE TABLE OF BAPIBUS20001_ORGMAN_INS.
    ***WORK AREA
    DATA: WA_INPUT_FIELDS TYPE BAPIBUS20001_INPUT_FIELDS.
    DATA: WA_HEADER TYPE BAPIBUS20001_HEADER_INS.
    DATA: WA_ITEM TYPE BAPIBUS20001_ITEM.
    DATA: WA_PARTNER TYPE BAPIBUS20001_PARTNER_INS.
    DATA: WA_ORGANISATION TYPE BAPIBUS20001_ORGMAN_INS.
    DATA: IT_EV_GUID_32 TYPE GUID_32.
    DATA: IT_EV_GUID_32_1 TYPE GUID_32.
    DATA: IT_EV_GUID_32_2 TYPE GUID_32.
    DATA: IT_EV_GUID_32_3 TYPE GUID_32.
    DATA: IT_OBJECTS_TO_SAVE TYPE STANDARD TABLE OF BAPIBUS20001_GUID_DIS WITH HEADER LINE.
    DATA: IT_OBJECTS_TO_SAVE_1 TYPE STANDARD TABLE OF BAPIBUS20001_GUID_DIS WITH HEADER LINE.
    CONSTANTS:true TYPE crmt_boolean VALUE 'X'.
    *Create your own GUID for each order using function module GUID_CREATE (and use output field EV_GUID_32).
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        EV_GUID_32       = IT_EV_GUID_32.
    Fill of the HEADER the fields GUID, PROCESS_TYPE, DESCRIPTION and CREATED_BY,
    do NOT fill HANDLE and OBJECT_ID, other fields if needed are allowed).
    WA_HEADER-GUID                      =  IT_EV_GUID_32.
    WA_HEADER-PROCESS_TYPE              =  'ZWEB'.
    WA_HEADER-DESCRIPTION               =  'WEB ORDER'.
    WA_HEADER-CREATED_BY                =  'SAMJESI.
    APPEND WA_HEADER TO IT_HEADER.
    *For each FIELD of HEADER structure that has been filled also fill INPUT_FIELDS fields REF_GUID (header GUID),
    *REF_KIND (header REF_KIND), LOGICAL_KEY (='1'), OBJECTNAME (='ORDERADM_H') and FIELDNAME (as text).
    WA_INPUT_FIELDS-REF_GUID               =  IT_EV_GUID_32.
    WA_INPUT_FIELDS-REF_KIND               =  'A'.
    WA_INPUT_FIELDS-OBJECTNAME             =  'ORDERADM_H'.
    WA_INPUT_FIELDS-LOGICAL_KEY            =  '1'.
    WA_INPUT_FIELDS-CHANGEABLE             =  ' '.
    WA_INPUT_FIELDS-FIELDNAME              =  'PROCESS_TYPE'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              =  'GUID'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              =  'DESCRIPTION'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              =  'CREATED_BY'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    *Create your own GUID for each order using function module GUID_CREATE (and use output field EV_GUID_32).
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        EV_GUID_32       = IT_EV_GUID_32_1.
    *For each ITEM, create your own GUID and fill the fields GUID (item GUID), HEADER (header GUID),
    *ORDERED_PROD, DESCRIPTION, ITM_TYPE, ORDER_DATE and MODE (='A').
    WA_ITEM-GUID              =  IT_EV_GUID_32_1.
    WA_ITEM-NUMBER_INT        =  '10'.
    WA_ITEM-ORDERED_PROD      =  '000000000090000230'.
    WA_ITEM-ITM_TYPE          =  'ZTAN'.
    WA_ITEM-MODE              =  'B'.
    APPEND WA_ITEM TO IT_ITEM.
    *For each FIELD of ITEM structure that has been filled also fill INPUT_FIELDS fields REF_GUID (header GUID),
    *REF_KIND (header REF_KIND), LOGICAL_KEY (='1'), OBJECTNAME (='ORDERADM_I') and FIELDNAME (as text).
    WA_INPUT_FIELDS-REF_GUID               =  IT_EV_GUID_32_1.
    WA_INPUT_FIELDS-REF_KIND               =  'B'.
    WA_INPUT_FIELDS-OBJECTNAME             =  'ORDERADM_I'.
    WA_INPUT_FIELDS-LOGICAL_KEY            =  '1'.
    WA_INPUT_FIELDS-CHANGEABLE             =  ' '.
    WA_INPUT_FIELDS-FIELDNAME              =  'GUID'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              =  'NUMBER_INT'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME                 =  'ORDERED_PROD'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME                 =  'ITM_TYPE'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    *For each PARTNER fill the fields REF_GUID (header GUID), REF_KIND, REF_PARTNER_HANDLE (start with 1, next 1 higher),
    *KIND_OF_ENTRY, PARTNER_FCT, PARTNER_NO, NO_TYPE and DISPLAY_TYPE.
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        EV_GUID_32       = IT_EV_GUID_32_2.
    WA_PARTNER-REF_GUID                = IT_EV_GUID_32_2.
    *WA_PARTNER-REF_KIND                = '1'
    *WA_PARTNER-REF_PARTNER_HANDLE      =  '1'.
    WA_PARTNER-PARTNER_FCT             =  '00000001'.
    WA_PARTNER-PARTNER_NO              =  '100000433'.
    APPEND WA_PARTNER TO IT_PARTNER.
    *For each FIELD of PARTNER structure that has been filled also fill INPUT_FIELDS fields REF_GUID (partner GUID),
    *REF_KIND (partner REF_KIND), LOGICAL_KEY (='1'), OBJECTNAME (='PARTNER') and FIELDNAME (as text).
    WA_INPUT_FIELDS-REF_GUID               =  IT_EV_GUID_32_2.
    WA_INPUT_FIELDS-REF_KIND               =  'A'.
    WA_INPUT_FIELDS-OBJECTNAME             =  'PARTNER'.
    WA_INPUT_FIELDS-LOGICAL_KEY            =  '1'.
    WA_INPUT_FIELDS-CHANGEABLE             =  ' '.
    WA_INPUT_FIELDS-FIELDNAME              =  'REF_GUID'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    *WA_INPUT_FIELDS-FIELDNAME              =  'REF_PARTNER_HANDLE'.
    *APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              =  'PARTNER_FCT'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              = 'PARTNER_NO'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    *Fill the ORGANISATION fields REF_GUID, REF_KIND, DIS_CHANNEL, DIVISION, SALES_ORG and MODE.
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        EV_GUID_32       = IT_EV_GUID_32_3.
    WA_ORGANISATION-REF_GUID = IT_EV_GUID_32_3.
    *WA_ORGANISATION-REF_KIND
    WA_ORGANISATION-DIS_CHANNEL  =  '20'.
    WA_ORGANISATION-DIVISION     =  '00'.
    WA_ORGANISATION-SALES_ORG    =  '228'.
    WA_ORGANISATION-MODE         =  'A'.
    APPEND WA_ORGANISATION TO IT_ORGANISATION.
    *For each field of ORGANISATION structure that has been filled als fill INPUT_FIELDS. OBJECTNAME='ORGMAN'.
    WA_INPUT_FIELDS-REF_GUID               =  IT_EV_GUID_32_3.
    WA_INPUT_FIELDS-REF_KIND               =  'A'.
    WA_INPUT_FIELDS-OBJECTNAME             =  'ORGMAN'.
    WA_INPUT_FIELDS-LOGICAL_KEY            =  '1'.
    WA_INPUT_FIELDS-CHANGEABLE             =  ' '.
    WA_INPUT_FIELDS-FIELDNAME              =  'REF_GUID'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              =  'DIS_CHANNEL'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              =  'DIVISION'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              = 'SALES_ORG'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    WA_INPUT_FIELDS-FIELDNAME              = 'MODE'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS_FILL.
    REFRESH: CREATED_PROCESS.
                   CALL FUNCTION 'BAPI_BUSPROCESSND_CREATEMULTI'
                     TABLES
                        HEADER                  = IT_HEADER
                        ITEM                    = IT_ITEM
                        PARTNER                 = IT_PARTNER
                        ORGANISATION            = IT_ORGANISATION
                        INPUT_FIELDS            = IT_INPUT_FIELDS_FILL
                        CREATED_PROCESS         = CREATED_PROCESS
                        RETURN                  = RETURN.
    IT_OBJECTS_TO_SAVE-GUID = IT_EV_GUID_32.
    IT_OBJECTS_TO_SAVE-OBJECT_TYPE = 'BAPIBUS20001'.
    APPEND IT_OBJECTS_TO_SAVE TO IT_OBJECTS_TO_SAVE.
    CALL FUNCTION 'BAPI_BUSPROCESSND_SAVE'
      EXPORTING
        UPDATE_TASK_LOCAL       = true
        SAVE_FRAME_LOG          = true
    IMPORTING
      LOG_HANDLE              =
      TABLES
        OBJECTS_TO_SAVE         = IT_OBJECTS_TO_SAVE
        SAVED_OBJECTS           = ITAB_SAVED_OBJECTS
        RETURN                  = itab_return.

    Hi Jessica,
    Please find an example of how the code is implemented.
    DATA:    lt_saved   TYPE crmt_return_objects,
             lt_exc     TYPE crmt_exception_t,
             lt_not_saved TYPE crmt_object_guid_tab.
    DATA:    lv_contact_guid TYPE crmt_object_guid.
    DATA:    lt_headerx  TYPE TABLE OF bapibus2000110_header_insx,
             ls_headerx  TYPE bapibus2000110_header_insx,
             lt_reasonx  TYPE TABLE OF bapibus2000110_reason_insx,
             ls_reasonx  TYPE bapibus2000110_reason_insx,
             lt_reason   TYPE TABLE OF bapibus2000110_reason_ins,
             ls_reason   TYPE bapibus2000110_reason_ins,
             lt_text     TYPE TABLE OF bapibus20001_text_ins,
             ls_text     TYPE bapibus20001_text_ins,
             lt_textx    TYPE TABLE OF bapibus20001_text_insx,
             ls_textx    TYPE bapibus20001_text_insx,
             lt_outcome  TYPE TABLE OF bapibus2000110_outcome_ins,
             ls_outcome  TYPE bapibus2000110_outcome_ins,
             lt_outcomex TYPE TABLE OF bapibus2000110_outcome_insx,
             ls_outcomex TYPE bapibus2000110_outcome_insx,
             lt_status   TYPE TABLE OF bapibus20001_status_ins,
             ls_status   TYPE bapibus20001_status_ins,
             lt_statusx  TYPE TABLE OF bapibus20001_status_insx,
             ls_statusx  TYPE bapibus20001_status_insx,
             lt_return   TYPE TABLE OF bapiret2,
             BEGIN OF lv_reason,
               cat(2)        TYPE c,
               code_group(8) TYPE c,
               code(4)       TYPE c,
             END OF lv_reason,
             BEGIN OF lv_outcome,
               cat(2)        TYPE c,
               code_group(8) TYPE c,
               code(4)       TYPE c,
             END OF lv_outcome,
             lv_entry TYPE boolean.
    DATA: ls_header TYPE bapibus20001_header_ins.
    DATA: lt_header TYPE STANDARD TABLE OF bapibus20001_header_ins.
    DATA: ls_input_fields TYPE bapibus20001_input_fields.
    DATA: lt_input_fields TYPE STANDARD TABLE OF bapibus20001_input_fields.
    data: lw_service_os type BAPIBUS20001_SERVICE_OS_INS.
    data: lt_service_os type standard table of BAPIBUS20001_SERVICE_OS_INS.
    DATA: guid type guid_32.
    DATA LT_RRETURN TYPE STANDARD TABLE OF BAPIRET2.
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        ev_guid_32 = guid.
    lv_contact_guid = guid.
    Description, objective, completion and priority
    description
    ls_header-guid            = guid.
    ls_header-descr_language  = sy-langu.
    ls_header-description     = 'Test'.
    ls_header-created_at      = sy-uzeit.
    ls_header-created_by      = sy-uname.
    ls_header-process_type    = 'ZPRI'.
    APPEND ls_header  TO lt_header.
    APPEND ls_headerx TO lt_headerx.
    ls_input_fields-ref_guid   = guid.
    ls_input_fields-ref_kind  = 'A'.
    ls_input_fields-objectname = 'ORDERADM_H'.
    ls_input_fields-fieldname = 'GUID'.
    INSERT ls_input_fields INTO TABLE lt_input_fields.
    ls_input_fields-fieldname = 'LANGUAGE'.
    INSERT ls_input_fields INTO TABLE lt_input_fields.
    ls_input_fields-fieldname = 'DESCRIPTION'.
    INSERT ls_input_fields INTO TABLE lt_input_fields.
    ls_input_fields-fieldname = 'CREATED_AT'.
    INSERT ls_input_fields INTO TABLE lt_input_fields.
    ls_input_fields-fieldname = 'CREATED_BY'.
    INSERT ls_input_fields INTO TABLE lt_input_fields.
    ls_input_fields-fieldname = 'PROCESS_TYPE'.
    INSERT ls_input_fields INTO TABLE lt_input_fields.
    lw_service_os-REF_HANDLE = guid.
    lw_service_os-REF_GUID  = guid.
    lw_service_os-SUBJECT_PROFILE = 'ZSPTSKPRI'.
    LW_SERVICE_OS-CAT_TYPE = 'A1'.
    LW_SERVICE_OS-CODE_GROUP = 'ZCGPRI'.
    LW_SERVICE_OS-CODE = 'P120'.
    APPEND LW_SERVICE_OS TO LT_SERVICE_OS.
    CALL FUNCTION 'BAPI_BUSPROCESSND_CREATEMULTI'
      TABLES
        header                  = lt_header
      ITEM                    =
      ACTIVITY                =
      SALES                   =
      PARTNER                 =
      ORGANISATION            =
      SHIPPING                =
      APPOINTMENT             =
      TEXT                    =
       SERVICE_OS              = LT_SERVICE_OS
      STATUS                  =
       input_fields            = lt_input_fields
      CREATED_PROCESS         =
       RETURN                  = LT_RRETURN
      LEAD                    =
      OPPORTUNITY             =
      PRODUCT                 =
      SCHEDULELINE            =
      CUSTOMER_HEAD           =
      CUSTOMER_ITEM           =
      PRICING                 =
      PRICING_ITEM            =
      CONDITION_CREATE        =
      BILLING                 =
      CONFIG_CFG              =
      CONFIG_BLB              =
      CONFIG_INS              =
      CONFIG_PRT              =
      CONFIG_VAL              =
      CONFIG_VK               =
      CONFIG_REF              =
      ADDRESS                 =
      BILLPLAN                =
      BILLPLAN_DATE           =
      EXTENSIONIN             =
      DOCUMENT_FLOW           =
      BATCH                   =
      PRICING_AGR_CRM         =
      FINPROD_ITEM            =
      CANCEL                  =
      CANCEL_IR               =
      PRODUCT_LIST            =
      PRODUCTS                =
      OBJECTS                 =
      PAYPLAN                 =
      PAYPLAN_DATE            =
      CONFIG_FILTER_CFG       =
      CONFIG_FILTER_INS       =
      CONFIG_FILTER_PRT       =
      CONFIG_FILTER_VAL       =
      ACTIVITY_I              =
      EXT_REF                 =
    DATA: lt_objects_to_save  TYPE TABLE OF bapibus20001_guid_dis,
          ls_objects_to_save  TYPE bapibus20001_guid_dis,
          lt_saved_objects    TYPE STANDARD TABLE OF bapibus20001_object_id,
          lt_return1        TYPE STANDARD TABLE OF bapiret2,
          lv_object_guid      TYPE crmt_object_guid.
    build save table
    ls_objects_to_save-guid = ls_header-guid.
    ls_objects_to_save-object_type = 'BUS2000125'.
    INSERT ls_objects_to_save INTO TABLE lt_objects_to_save.
    CHECK lt_objects_to_save IS NOT INITIAL.
    CALL FUNCTION 'BAPI_BUSPROCESSND_SAVE'
    EXPORTING
      UPDATE_TASK_LOCAL       = FALSE
      SAVE_FRAME_LOG          = FALSE
    IMPORTING
      LOG_HANDLE              =
      TABLES
        objects_to_save         = lt_objects_to_save
       saved_objects           = lt_saved_objects
       return                  = lt_return1

  • How to delete a Item line in a Sales Order during Copy Control

    I want to delete a Line item (VBAP ) record for a certain condition during Copying from reference  . I am writing the code in the Data Transfer Routine 151 which is called through VOFM Transaction  . I  cannot delete it as it . it is a work area VBAP . When i Clear it in debugging i am only able to clear the Line items . I want to completely remove the line . Is there a user exit for the same .

    Hi,
    You should create a new copy requirement routine at item level in order to exclude the unwanted item.
    Assign the requirement routine to each item category type in the copy control .
    Regards,
    Andrea

  • Change sales order using BAPI_SALESORDER_CHANGE

    Hi i want to add a new line item to the existing sales order using BAPI_SALESORDER_CHANGE
    but when i am trying it is giving
    'Schedule line 0001 for item 000020 does not exist ' error..
    please help me..

    *********I wanted to add an new line item.***.. this is my code..********
    LOOP AT gt_input3 INTO st_input3.
    *Finding Max No of line Items
        IF fl_set IS INITIAL.
          READ TABLE gt_vbap INTO st_vbap WITH KEY vbeln = st_input3-vbeln.
          IF sy-subrc EQ 0.
            lv_posnr = st_vbap-posnr.
            fl_set = 'X'.
          ENDIF.
        ENDIF.
    *Populate Item details
        lv_posnr = lv_posnr + 10.
        lv_vbeln = st_input3-vbeln.
        lv_order_header_inx-updateflag = 'U'.
        st_order_item_in-itm_number = lv_posnr.
        st_order_item_in-material  = st_input3-matnr.
        st_order_item_in-target_qty = st_input3-imv_qty.
        st_order_item_in-plant = st_input3-werks.
        st_order_item_in-store_loc = st_input3-lgort.
       st_order_item_in-store_loc = st_input3-lgort.
        APPEND st_order_item_in TO lt_order_item_in.
    *Populate item updation Details
        st_order_item_inx-itm_number = lv_posnr.
        st_order_item_inx-updateflag = 'U'.
        st_order_item_inx-material = 'X'.
        st_order_item_inx-plant = 'X'.
        st_order_item_inx-store_loc = 'X'.
        st_order_item_inx-target_qty = 'X'.
        APPEND st_order_item_inx TO lt_order_item_inx.
    *Populate the Schedule Lines
        st_schedule_lines-itm_number = lv_posnr.
        st_schedule_lines-sched_line = '0001'.
        st_schedule_lines-req_qty = st_input3-imv_qty.
        APPEND st_schedule_lines TO lt_schedule_lines.
    *Populate the update details of schedule lines
        st_schedule_linesx-itm_number = lv_posnr.
        st_schedule_linesx-sched_line = '0001'.
        st_schedule_linesx-req_qty = 'X'.
        st_schedule_linesx-updateflag = 'U'.
        APPEND st_schedule_linesx TO lt_schedule_linesx.
           AT END OF vbeln.
    *Call BAPI Sales order change
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
            EXPORTING
              salesdocument    = lv_vbeln
              order_header_inx = lv_order_header_inx
            TABLES
              return           = lt_return
              order_item_in    = lt_order_item_in
              order_item_inx   = lt_order_item_inx
              schedule_lines   = lt_schedule_lines
              schedule_linesx  = lt_schedule_linesx.
    *Save Sales Order
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
          CLEAR lv_posnr.
          READ  TABLE lt_return INTO st_return WITH KEY type = 'E'.
          st_ipfile_err3-message = st_return-message.
    *Error Log
          LOOP AT gt_temp3 INTO st_temp3.
            IF st_ipfile_err3-message IS NOT INITIAL.
              MOVE st_temp3-record TO st_ipfile_err3-record.
              IF fl_set1 IS INITIAL.
                APPEND st_temp_err TO gt_ipfile_err3.
                fl_set1 = 'X'.
              ENDIF.
              APPEND st_ipfile_err3 TO gt_ipfile_err3.
            ELSE.
              APPEND st_temp3 TO gt_audit3.
            ENDIF.
            CLEAR : st_temp3,
                    st_temp_err,
                    st_ipfile_err3,
                    fl_set.
          ENDLOOP.
          REFRESH : gt_zrman,

  • Append New Line Item(s) onto the created Purchase Request using Function

    Dear Expert,
    I am trying to append new lines into the created purchase request via Function Module/ BAPI.
    Say, now, the Purchase Request has already 1 line item. And i want to append new line items into
    this purchase request via function module/ bapi.
    Do you know if there is any function module/ bapi exists to do this?
    Thanks.
    Tee

    Hi,
    It's weird.
    I tried on the BAPI_PR_CHANGE, and the return message says that it has successfully changed the PR. But, when i see it via ME53N, it's not being updated.
    Does anyone has sample usage/ code using this BAPI?
    Thanks.
    Tee

  • Custom program for availability check and update for existing sale order at Item level(VA02)

    Hi,
    I came to know Bapi_Saleorder_Simulate can be used for availability check and update an existing sale order.but there is no sample program explaining the process.I have tried this by passing parameters ORDER_HEADER_IN , ORDER_ITEMS_IN  ,ORDER_PARTNERS and ORDER_SCHEDULE_EX(for getting details),also i have assigned the sale document number ,custom document type(ZSO) in ORDER_HEADER_IN . while executing the BAPI I am getting the error external number range is not assigned for the document type ZSO . I am confused on seeing this error. It is possible to do availability check for existing sale order using this BAPI. Please explain how to achieve this.It will be really helpful if it is expalained with an example.   
    Regards,
    Shanmuga

    Hello, I think you may have been misinformed about this BAPI updating a sales order at item level. As far as I understand it this BAPI can be used to simulate the creation of a sales order which obviously would include and ATP check. This is why it is giving the error because it is simulating creation but you are entering a value in a field that should be automatically generated (i.e. the sales order number). For change the sales order at item level have you looked at BAPI_SALESORDER_CHANGE? I pretty sure this BAPI both updates sales order (header or item level) and can do an ATP first.
    Points are always welcome if you feel an answer has been helpful.

  • How do I merge new imported photos into an existing event?

    How do I merge new imported photos into an existing event while using the latest version of iPhoto?

    You can merge two Events simply by dragging one to the other.
    You can move photos between Events by drag and drop or by first flagging them, then switching to Events View and selecting the target Event and going Events Menu -> Add Flagged Photos to selected Event.

  • Import new sales order line in existing sales order

    Hi All,
    I want to import new sales order line in existing sales order using these open Interface tables or APIs.
    I did some test but the import request always give me the error message:
    You are trying to insert an existing order or update an order that does not exist. Please enter a correct operation code.
    Help..
    BR,
    Edited by: user7993358 on 2011/5/26 下午 8:48

    Hi,
    The script available in Oracle Note 746796.1 may be of help with your troubleshooting.
    Cheers,
    Arun

  • Inserting new line item into existing delivery using BAPI

    Hi
    can you send me the code for inserting new line item into existing delivery either using BAPI or
    Function module.
    We are using SAP 4.7 version

    Hi Sreekanth,
    Refer to this links
    New item for outbound delivery via FM/BAPI?
    /message/3976349#3976349 [original link is broken]
    BAPI_OUTB_DELIVERY_CHANGE Help - Add new line item
    hope it is useful to you.
    Regards!

  • How to insert new schedule line in Sales order using BAPI

    Hi All,
    I am using the below code to add a new line in the schedules line of a existing sales order.But i am not getting the extra line after running the report.
    Kindly guide me in how to achieve this.
    thanks and regards
    shilpa
    REPORT  Z_VA32_EDI1.
    data: v_vbeln type BAPIVBELN-VBELN,
          wa_order_header type BAPISDH1X,
          i_sch_line type standard table of BAPISCHDL with header line,
          i_sch  type standard table of BAPISCHDLX with header line,
          i_return type standard table of BAPIRET2 with header line.
    v_vbeln = '0030001227'.
    wa_order_header-UPDATEFLAG = 'U'.
    i_sch-ITM_NUMBER = '000010'.
    i_sch-UPDATEFLAG  = 'I'.
    i_sch-REQ_DATE  = 'X'.
    i_sch-REL_TYPE = 'X'.
    i_sch-PLAN_SCHED_TYPE = 'X'.
    i_sch-REQ_QTY     = 'X'.
    append i_Sch.
    i_sch_line-ITM_NUMBER = '000010'.
    i_sch_line-REQ_DATE  = '20080127'.
    i_sch_line-REL_TYPE = '2'.
    i_sch_line-PLAN_SCHED_TYPE = '2'.
    i_sch_line-REQ_QTY     = '65'.
    append i_Sch_line.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = v_vbeln
      ORDER_HEADER_IN             =
        order_header_inx            = wa_order_header
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      NO_STATUS_BUF_INIT          = ' '
      tables
        return                      = i_Return
      ORDER_ITEM_IN               =
      ORDER_ITEM_INX              =
      PARTNERS                    =
      PARTNERCHANGES              =
      PARTNERADDRESSES            =
      ORDER_CFGS_REF              =
      ORDER_CFGS_INST             =
      ORDER_CFGS_PART_OF          =
      ORDER_CFGS_VALUE            =
      ORDER_CFGS_BLOB             =
      ORDER_CFGS_VK               =
      ORDER_CFGS_REFINST          =
       SCHEDULE_LINES              = i_sch_line[]
       SCHEDULE_LINESX             = i_sch[]
      ORDER_TEXT                  =
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
      NFMETALLITMS                =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    wait = 'X'.
    write: 'Done'.

    hi,
    pass the values 'x' to the bellow structure for all the fields that u want use and provide the item no ,schedule line no.
    SCHEDULE_LINESX

  • Quantity update into sales order using BAPI_SALESORDER_CREATEFROMDAT2

    Hi All,
    I am able to create a sales order using the BAPI "BAPI_SALESORDER_CREATEFROMDAT2".
    But even after assinging the Target_quntity and the Target_quantity_units, the values are not getting updated into the Sales order, but the sales order gets created .
    Did anyone of you had a similare problem, how was it solved.
    cold some one please help me out on this.
    Regards

    Hi
    I had used below code (using <b>BAPI_SALESORDER_CREATEFROMDAT1</b>)..but never faced any problem.. you can try the same...
    Regards,
    Raj
    REPORT  z_sd_salesorder_create
            NO STANDARD PAGE HEADING
            LINE-SIZE 150
            MESSAGE-ID zz.
                  S T R U C T U R E  D E C L A R A T I O N S             *
    TYPES: BEGIN OF x_ppl,
            ppl_order(18),   " ppl Orderno
            auart(4),         " Sales Doc Type
            vkorg(4),         " Sales Organization
            vtweg(2),         " Distribution Channel
            spart(2),         " Division
            div(3),           " Division
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(18),        " Item Matnr#
            uom(3),           " UOM
            qty(15),          " Qty
           kschl(4),         " Pricing condiiton type
           kbetr(11),        " Rate
           END OF x_ppl.
    TYPES: BEGIN OF x_file,
            loc(30),          " Location
            div(3),           " Division
            ppl_order(18),   " ppl Orderno
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(20),        " Item Matnr#
            qty(15),          " Qty
            uom(3),           " UOM
           kbetr(11),        " Rate
           discount(5),      " Discount
           END OF x_file.
    TYPES: BEGIN OF x_output,
            ppl_order(18),       " ppl Orderno
            mesg(130),            " Mesg Success/Error
           END OF x_output.
    TYPES: BEGIN OF x_werks,
            name2(30),                " Location
            werks TYPE werks_ext,     " Plant
           END OF x_werks.
    TYPES: BEGIN OF x_info,
            vkorg TYPE vkorg ,   " Sales org
            vtweg TYPE vtweg,    " Dist channel
            werks TYPE werks_ext," Plant
            spart TYPE spart,    " Storage Loc
           END OF x_info.
    TYPES: BEGIN OF x_material,
            ppl_prdid(20),      " ppl Prd id
            matnr TYPE matnr,    " Material (SAP)
           END OF x_material.
           I N T E R N A L    T A B L E    D E C L A R A T I O N S       *
    DATA: it_file  TYPE STANDARD TABLE OF x_file  WITH HEADER LINE." File Data
    DATA: it_data  TYPE STANDARD TABLE OF x_ppl  WITH HEADER LINE." ppl File
    DATA: it_out TYPE STANDARD TABLE OF x_output WITH HEADER LINE. " Outcome
    DATA: it_werks TYPE STANDARD TABLE OF x_werks WITH HEADER LINE.    " Plant
    DATA: it_info TYPE STANDARD TABLE OF x_info WITH HEADER LINE.      " Othr Info
    DATA: it_matnr TYPE STANDARD TABLE OF x_material WITH HEADER LINE. " Material Info
    DATA: it_item TYPE STANDARD TABLE OF bapiitemin WITH HEADER LINE.  "Order Itm data
    DATA: it_partner TYPE STANDARD TABLE OF bapipartnr WITH HEADER LINE. "Order Partner data
               V A R I A B L E S      D E C L A R A T I O N S            *
    DATA  : v_correct  TYPE i,
            v_error    TYPE i,
            v_total    TYPE i,
            v_return   LIKE bapireturn1,
            v_index    LIKE sy-tabix.
    *- Return values
    DATA: it_orderh TYPE bapisdhead, "Order Hdr data
          order TYPE bapivbeln-vbeln,
          soldto TYPE bapisoldto,
          shipto TYPE bapishipto,
          return TYPE bapireturn1.
    DATA: hdate   TYPE sy-datum.
                    U S E R   I N P U T S   S C R E E N                  *
    SELECTION-SCREEN: BEGIN OF BLOCK blk01 WITH FRAME TITLE text-t01.
    PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY. " File name
    SELECTION-SCREEN END OF BLOCK blk01.
                      S E L E C T I O N    S C R E E N                   *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM get_file.
                    S t a r t    o f    S e l e c t i o n                *
    START-OF-SELECTION.
      PERFORM get_upload.
      PERFORM validate_data.        " Validate the data
      PERFORM data_swap.            " Prepare the data for processing
      IF NOT it_data[] IS INITIAL.
        PERFORM get_update.           " Create SalesOrders
      ELSE.
        MESSAGE i001(zz) WITH text-001.
        STOP.
      ENDIF.
                    E n d    o f    S e l e c t i o n                    *
    END-OF-SELECTION.
      IF NOT it_data[] IS INITIAL.
        PERFORM get_write.
      ENDIF.
    *&      Form  get_file
          Get File name
    FORM get_file .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          program_name  = syst-repid
          mask          = '*'
        CHANGING
          file_name     = p_file
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_file
    *&      Form  get_upload
          to upload the file
    FORM get_upload .
      DATA l_file TYPE string.
      CLEAR: it_file, it_file[].
      l_file = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = it_file
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSEIF sy-subrc = 0.
        SORT it_file BY loc ppl_order.
      ENDIF.
    ENDFORM.                    " get_upload
    *&      Form  get_update
          Creating mapping Data in Z table
    FORM get_update .
      DATA: l_itemno(2) TYPE n,
            l_partner TYPE parvw,
            l_kunnr TYPE kunnr,
            l_matnr TYPE matnr,
            l_mesg TYPE string,
            l_kbetr TYPE p DECIMALS 2.
      DATA: l_in_qty LIKE vbap-zmeng,
            l_meins LIKE mara-meins,
            l_qty   LIKE vbap-zmeng.
      CLEAR: v_correct, v_error, v_total.
      SORT it_data BY ppl_order.
      LOOP AT it_data.
        CLEAR v_index.
        v_index = sy-tabix.
    *- New SalesOrder
        AT NEW ppl_order.
          READ TABLE it_data INDEX v_index.
          CLEAR: it_orderh, it_item, it_partner,
                 order, soldto, shipto, return,
                 it_item[], it_partner[].
          v_total = v_total + 1.  "Increment Total SalesOrders counter
          CLEAR l_itemno.
          l_itemno = '10'.
    *- Covert date fields into Internal format
          CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
            EXPORTING
              datum = it_data-date
              dtype = 'DATS'
            IMPORTING
              idate = it_data-date.
    *- Populate SalesOrder header data.
          CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
            EXPORTING
              input  = it_data-auart
            IMPORTING
              output = it_data-auart.
          it_orderh-doc_type   = it_data-auart.
          it_orderh-sales_org  = it_data-vkorg.
          it_orderh-distr_chan = it_data-vtweg.
          it_orderh-division   = it_data-spart.
          it_orderh-purch_no   = 'DEPOT'.
          it_orderh-price_date = it_data-date.      "Doc Dt
          it_orderh-req_date_h = it_data-date.      "Del.Dt
          it_orderh-purch_no_s = it_data-ppl_order.
    *- Partner data
          CLEAR: l_partner, l_kunnr.
    *- Convert Partner type into internal format
          l_partner = 'SP'.  "SoldTo Party
          CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'
            EXPORTING
              input  = l_partner
            IMPORTING
              output = l_partner.
    *- Convert Customer into internal format
          l_kunnr = it_data-kunnr.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = l_kunnr
            IMPORTING
              output = l_kunnr.
          it_partner-partn_role = l_partner.
          it_partner-partn_numb = l_kunnr.
          APPEND it_partner.
          CLEAR it_partner.
        ENDAT.
    *- Item data
        it_item-itm_number = l_itemno.
    *- Convert material number into internal format
        CLEAR l_matnr.
        l_matnr = it_data-matnr.
        CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
          EXPORTING
            input        = l_matnr
          IMPORTING
            output       = l_matnr
          EXCEPTIONS
            length_error = 1
            OTHERS       = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        it_item-material  = l_matnr.
    *- Call FM to get new qty based on SAP UOM
        CLEAR: l_meins, l_qty, l_in_qty.
        l_in_qty = it_data-qty.
        CALL FUNCTION 'Z_GET_QTY_FROM_UOM'
          EXPORTING
            matnr     = it_item-material
            in_meins  = it_data-uom
            in_qty    = l_in_qty
          IMPORTING
            out_meins = l_meins
            quantity  = l_qty.
        IF sy-subrc = 0.
          it_data-qty = l_qty.
          it_data-uom = l_meins.
        ENDIF.
        it_data-qty = it_data-qty * 1000.
        it_item-req_qty = it_data-qty.
        it_item-sales_unit = it_data-uom.
        it_item-req_date   = it_data-date.
    *- Pricing data
       it_item-cond_type = it_data-kschl.  "Pricing condition
       CLEAR l_kbetr.
       l_kbetr = it_data-kbetr / 10. "Price (Rate)
       it_item-cond_value = l_kbetr.
        APPEND it_item.
        CLEAR  it_item.
    *- Increment Item counter.
        l_itemno = l_itemno + 10.
    *- At end of SalesOrder
        AT END OF ppl_order.
          READ TABLE it_data INDEX v_index.
    *- Call the BAPI for SalesOrder creation
          CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
            EXPORTING
              order_header_in = it_orderh
            IMPORTING
              salesdocument   = order
              sold_to_party   = soldto
              ship_to_party   = shipto
              return          = return
            TABLES
              order_items_in  = it_item
              order_partners  = it_partner.
          IF sy-subrc = 0.
            COMMIT WORK.
          ENDIF.
          v_return = return+0(1).
          IF v_return = 'E'.
            v_error = v_error + 1.
            CLEAR l_mesg.
            l_mesg = return.
            CONDENSE l_mesg.
          ELSE.
            v_correct = v_correct + 1.
            CLEAR l_mesg.
            CONCATENATE 'Salesorder'(007) order 'successfully created.'(008)
            INTO l_mesg SEPARATED BY space.
            CONDENSE l_mesg.
          ENDIF.
    *- Populate the output table
          CLEAR it_out.
          it_out-ppl_order = it_data-ppl_order.
          it_out-mesg = l_mesg.
          APPEND it_out.
          CLEAR it_out.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_update
    *&      Form  get_write
          Write the results
    FORM get_write .
      WRITE:/ 'Total Number of Records :'(002), v_total COLOR 1.
      WRITE:/ 'Total Correct Records   :'(003), v_correct COLOR 3.
      WRITE:/ 'Total Error Records     :'(004), v_error COLOR 6.
      SKIP 3.
      IF NOT it_out[] IS INITIAL.
        WRITE:/5 'ppl Order #'(005),
              28 'Message'(006).
      ENDIF.
      SKIP 1.
      LOOP AT it_out.
        WRITE:/5  it_out-ppl_order,
               28 it_out-mesg.
      ENDLOOP.
    ENDFORM.                    " get_write
    *&      Form  validate_data
          Validate the data
    FORM validate_data .
      DATA: l_bstkde TYPE bstkd_e.
      LOOP AT it_file.
        SELECT bstkd_e INTO l_bstkde
         UP TO 1 ROWS
         FROM vbkd
         WHERE bstkd_e = it_file-ppl_order.
        ENDSELECT.
        IF sy-subrc = 0.  " This ppl Order is already been created in SAP, so delete record
          DELETE it_file.
        ENDIF.
      ENDLOOP.
      SORT it_file BY ppl_order.
    ENDFORM.                    " validate_data
    *&      Form  data_swap
          Prepare the data for processing
    FORM data_swap .
      CLEAR: it_werks, it_info, it_matnr, it_data,
             it_werks[], it_info[], it_matnr[], it_data[].
      IF NOT it_file[] IS INITIAL.
    *- Get the plant from location
        SELECT name2
               werks
          INTO CORRESPONDING FIELDS OF TABLE it_werks
        FROM t001w FOR ALL ENTRIES IN it_file
        WHERE name2 = it_file-loc.
        IF sy-subrc = 0.
          SORT it_werks BY name2 werks.
    *- Get the Sales Org, Division and Distribution Channel
          IF NOT it_werks[] IS INITIAL.
            SELECT vkorg
                   vtweg
                   werks
            INTO CORRESPONDING FIELDS OF TABLE it_info
            FROM tvkwz FOR ALL ENTRIES IN it_werks
            WHERE werks = it_werks-werks.
            IF sy-subrc =  0.
              LOOP AT it_info.
                it_info-spart = '99'.
                MODIFY it_info INDEX sy-tabix.
              ENDLOOP.
              SORT it_info BY vkorg vtweg werks.
            ENDIF.
          ENDIF.
        ENDIF.
    *- Get material from ppl material
        SELECT ppl_prdid
               matnr
          FROM zppl_master
          INTO TABLE it_matnr FOR ALL ENTRIES IN it_file
          WHERE ppl_prdid = it_file-matnr.
        IF sy-subrc = 0.
          SORT it_matnr BY ppl_prdid matnr.
        ENDIF.
      ENDIF.
    *- Update the data in it_data
      LOOP AT it_file.
        CLEAR it_data.
       it_data-auart = 'OR'.
        it_data-auart = 'OR'.  " CHANGED BY Jo ON 3103005
        READ TABLE it_werks WITH KEY name2 = it_file-loc BINARY SEARCH.
        IF sy-subrc = 0.
          READ TABLE it_info WITH KEY werks = it_werks-werks BINARY SEARCH.
          IF sy-subrc = 0.
            it_data-vkorg = it_info-vkorg.
            it_data-vtweg = it_info-vtweg.
          ENDIF.
        ENDIF.
    *- Material
        READ TABLE it_matnr WITH KEY ppl_prdid = it_file-matnr BINARY SEARCH.
        IF sy-subrc = 0.
          it_data-matnr = it_matnr-matnr.
        ENDIF.
        it_data-ppl_order = it_file-ppl_order.
        it_data-date  = it_file-date.
        CONCATENATE it_file-kunnr it_file-loc+1(2) INTO it_data-kunnr.
        it_data-qty   = it_file-qty.
        it_data-uom   = it_file-uom.
       it_data-kbetr = it_file-kbetr.
    *- Pricing condition
       it_data-kschl = 'PR00'.
        CASE it_file-div.
          WHEN 'BRN'.
            it_data-div = '04'.
          WHEN 'GEN'.
            it_data-div = '03'.
          WHEN 'IVF'.
            it_data-div = '02'.
          WHEN 'OPH'.
            it_data-div = '01'.
        ENDCASE.
        it_data-spart = it_data-div.
        APPEND it_data.
        CLEAR  it_data.
      ENDLOOP.
    ENDFORM.                    " data_swap

  • Mass change - Move existing sales orders from Sales org A to Sales org B

    Good morning dear network,
    am seeking for your guidance on one specific matter.
    We are in the process of making changes to our billing / organisational structure (new sales orgs)
    One of the challenges is that we need to move existing open sales orders from one sales org to another (new) sales org.
    If all master records exist in the new sales org, is there a (technical) way of moving the existing sales orders from the current sales org into the new sales org, without having to replace each order individually ?
    would welcome any suggestions.
    Many thanks

    I would recommend to close the existing open sale orders by assigning Reason for Rejection and create new sale orders in the newly created sales organisation.
    This is due to the fact that you need to ensure each and field in the existing sale orders to match with the newly created sales organisation and it is bit time consuming.
    Still if you prefer to what you had indicated, LSMW is the better option
    thanks
    G. Lakshmipathi

  • Line item data is not saving while creating a Sales order using Interactive

    Hi all,
    I am creating a sales order Using Interactive forms. In the form i am having Header data and line item data.I had created two structures one for Header data and one for Line item data. For entering  the LINE ITEM DATA i had created a Dynamic table with Buttons ADD ROW and DELETE ROW.
    User will Add the Row or Delete the Row based on the requirement.
    My issue is When ever the user clicks the SUBMIT button after entering the header data and 3 line items data , Sales order has been created with only first line item and the remaining two line items are not created.
    My Interactive form is like below
    HEADER DATA
    DOC_TYPE
    SALES_ORG
    DIST_CHN
    DIVISION
    PURCH_NO
    PARTN_ROLE
    PART_NO
    LINE ITEM DATA
                             ITEM_NO      MATERIAL          PLANT          QTY        COND_TYPE            COND_VALUE
    ADD ROW
    DELETE ROW
                                                                                    SUBMIT
    My  code for the method ONACTIONCLICK is like below
    method ONACTIONCLICK .
    data:
          Node_Adobe       type ref to If_Wd_Context_Node,
          Node_Zsaleheader       type ref to If_Wd_Context_Node,
          Elem_Zsaleheader       type ref to If_Wd_Context_Element,
          Stru_Zsaleheader       type If_Main=>Element_Zsaleheader,
          Node_Zsaleitem       type ref to If_Wd_Context_Node,
          Elem_Zsaleitem       type ref to If_Wd_Context_Element,
          Stru_Zsaleitem       type If_Main=>Element_Zsaleitem.
      data: header_data type BAPISDHEAD.
      data: item_wa type BAPIITEMIN.
      data: item_data type table of BAPIITEMIN.
      data: partner_wa type BAPIPARTNR.
      data: partner_data type table of BAPIPARTNR.
      data: sales_order type BAPIVBELN-VBELN.
      data: Errorlog type BAPIRETURN1.
    navigate from <CONTEXT> to <ADOBE> via lead selection
      Node_Adobe = wd_Context->get_Child_Node( Name = IF_MAIN=>wdctx_Adobe ).
    navigate from <ADOBE> to <Zsaleheader> via lead selection
      Node_Zsaleheader = Node_Adobe->get_Child_Node( Name = IF_MAIN=>wdctx_Zsaleheader ).
      Node_Zsaleitem = Node_Adobe->get_Child_Node( Name = IF_MAIN=>wdctx_Zsaleitem ).
    get element via lead selection
      Elem_Zsaleheader = Node_Zsaleheader->get_Element(  ).
      Elem_Zsaleitem = Node_Zsaleitem->get_Element(  ).
    get all declared attributes
      Elem_Zsaleheader->get_Static_Attributes(
        importing
          Static_Attributes = Stru_Zsaleheader ).
      header_data-DOC_TYPE = Stru_Zsaleheader-DOC_TYPE.
      header_data-SALES_ORG = Stru_Zsaleheader-SALES_ORG.
      header_data-DISTR_CHAN   = Stru_Zsaleheader-DISTR_CHAN.
      header_data-DIVISION = Stru_Zsaleheader-DIVISION.
      header_data-PURCH_NO = Stru_Zsaleheader-PURCH_NO.
      partner_wa-PARTN_ROLE   = Stru_Zsaleheader-PARTN_ROLE.
      partner_wa-PARTN_NUMB = Stru_Zsaleheader-PARTN_NUMB.
       append partner_wa to partner_data.
        Elem_Zsaleitem->get_Static_Attributes(
        importing
          Static_Attributes = Stru_Zsaleitem ).
      item_wa-ITM_NUMBER = Stru_Zsaleitem-ITM_NUMBER.
      item_wa-MATERIAL   = Stru_Zsaleitem-MATERIAL.
      item_wa-PLANT = Stru_Zsaleitem-PLANT.
      item_wa-REQ_QTY = Stru_Zsaleitem-REQ_QTY.
      item_wa-COND_TYPE   = Stru_Zsaleitem-COND_TYPE.
      item_wa-COND_VALUE = Stru_Zsaleitem-COND_VALUE.
      append item_wa to item_data.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
      EXPORTING
        ORDER_HEADER_IN           = header_data
      WITHOUT_COMMIT            = ' '
      CONVERT_PARVW_AUART       = ' '
    IMPORTING
       SALESDOCUMENT             = sales_order
      SOLD_TO_PARTY             =
      SHIP_TO_PARTY             =
      BILLING_PARTY             =
       RETURN                    = errorlog
      TABLES
        ORDER_ITEMS_IN            = item_data
        ORDER_PARTNERS            = partner_data
      ORDER_ITEMS_OUT           =
      ORDER_CFGS_REF            =
      ORDER_CFGS_INST           =
      ORDER_CFGS_PART_OF        =
      ORDER_CFGS_VALUE          =
      ORDER_CCARD               =
      ORDER_CFGS_BLOB           =
      ORDER_SCHEDULE_EX         =
    endmethod.
    PLEASE SUGGEST ME IF ANY CODE CHANGE IS REQUIRED
    Thanks in advance
    Ajay

    Hi,
    The item data is not read because, the dynamically added rows should also reflect back to the Web Dynpro context. When the user clicks on Add Row, use the Onsubmit event to add a empty line to internal table and then bind it to the context. And if the user removes a row, remove a row from internal table and bind it back to the context.
    You may refer this article.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/802f0ed1-a17a-2c10-7db4-d515a5b047ed
    Regards,
    Runal

Maybe you are looking for