Changing TaxJurisdiction Code using BAPI_SALESORDER_CHANGE (URGENT)!!!I

Hi All,
I have to change the tax jurisdiction code of ship to party to Tax Jusrisdiction code of Ship from Party (Delivering Plant). How can I achieve this using BAPI_SALESORDER_CHANGE. Please give some inputs.
Regards,
Shankar

Hi Nakul,
Thanks for immediate response. I tried to change the fields in BAPIADDR1, the Partner Number is updating  but the address fields are not updating.
Any suggestions.  URGENT Please

Similar Messages

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

  • How to change pricing formula using bapi_salesorder_change

    Hi,
    I have a customer  portal web application developed in .Net from which I will be getting different values which are changes related to a particular sales order item in SAP. One among these values is the pricing formula used with the sales order item. I am using bapi_salesorder_change to update all the values other than the pricing formula. My input to the bapi is the formula id. I am not sure about the field which I have to use in the bapi structures to update the same. Also I don't even know whether I can use the same bapi to do the required task.
    Requesting help ....
    Thanks,
    Siva

    Sir,
    Thank you for your immediate response.
    Actually we are integrating SAP with the customer portal web application. The requirement is in such a way that the customer portal provides the option to change the sale order details both at the header level as well as item level. The fields include Order qty,Delivery date,Partner details,Payment terms,Terms of sale, Pricing formula etc. The front end consists of a Pricing formula drop down which consists of  the formula descriptions (for eg: ZFA1015-LAST LME W/DAY OF CONT. MOTH) with its corresponding ID(ID is nothing but ZFA1015). At the SAP side my RFC should pick it up and update it for the given item. The process is like if we go to VA02 we have an option called MAINTAIN FORMULA from where we can change the formula used with an item. There the formula id is obtained from the formula repository. In here the we already have the Formula ID given by the front end.
    Hope you are clear wtith the requirement..
    Requesting help..
    Thanks,
    Siva

  • Update sales order using BAPI_SALESORDER_CHANGE --- URGENT!!!!

    Hello,
    <b> I want to update Batch, Pricing date, Header text & Item text using BAPI_SALESORDER_CHANGE.</b>
    But i am not able to do it.
    i have written a code, but it's still not updating:
    PARAMETERS: p_vbeln LIKE vbak-vbeln.
    TYPES: BEGIN OF t_return.
            INCLUDE STRUCTURE bapiret2.
    TYPES: END OF t_return.
    TYPES: BEGIN OF t_order_item_in.
            INCLUDE STRUCTURE bapisditm.
    TYPES: END OF t_order_item_in.
    TYPES: BEGIN OF t_order_item_inx.
            INCLUDE STRUCTURE bapisditmx.
    TYPES: END OF t_order_item_inx.
    TYPES: BEGIN OF t_schedule_lines.
            INCLUDE STRUCTURE bapischdl.
    TYPES: END OF t_schedule_lines.
    TYPES: BEGIN OF t_schedule_linesx.
            INCLUDE STRUCTURE bapischdlx.
    TYPES: END OF t_schedule_linesx.
    TYPES: BEGIN OF t_order_text.
            INCLUDE STRUCTURE bapisdtext.
    TYPES: END OF t_order_text.
    DATA: l_vbeln              LIKE          bapivbeln-vbeln,
          i_order_header_inx   LIKE          bapisdh1x,
          i_order_header_in    LIKE          bapisdh1,
          i_return             TYPE TABLE OF t_return,
          i_order_item_in      TYPE TABLE OF t_order_item_in,
          wa_order_item_in     LIKE LINE  OF i_order_item_in,
          i_order_item_inx     TYPE TABLE OF t_order_item_inx,
          wa_order_item_inx    LIKE LINE  OF i_order_item_inx,
          i_schedule_lines     TYPE TABLE OF t_schedule_lines,
          wa_schedule_lines    LIKE LINE  OF i_schedule_lines,
          i_schedule_linesx    TYPE TABLE OF t_schedule_linesx,
          wa_schedule_linesx   LIKE LINE  OF i_schedule_linesx,
          i_order_text         TYPE TABLE OF t_order_text,
          wa_order_text        LIKE LINE  OF i_order_text,
          w_return             LIKE          bapiret2,
          l_date               TYPE char10.
    CLEAR l_vbeln.
    l_vbeln = p_vbeln.
              UPDATE REJECTION REASON IN SALES ORDER                *
    *WRITE sy-datum TO l_date.
    i_order_header_inx-updateflag = 'U'.
    REFRESH i_order_item_in.
    CLEAR wa_order_item_in.
    wa_order_item_in-itm_number = '000010'.
    wa_order_item_in-batch = '2007450027'.
    wa_order_item_in-price_date = sy-datum.
    wa_order_item_in-reason_rej = '00'.
    APPEND wa_order_item_in TO i_order_item_in.
    REFRESH i_order_item_inx.
    CLEAR wa_order_item_inx.
    wa_order_item_inx-itm_number = '000010'.
    wa_order_item_inx-updateflag = 'U'.
    wa_order_item_in-batch = 'X'.
    wa_order_item_in-price_date = 'X'.
    wa_order_item_inx-reason_rej = 'X'.
    APPEND wa_order_item_inx TO i_order_item_inx.
    *wa_order_text-doc_number = l_vbeln.
    **wa_order_text-TDOBJECT = 'EHSWA_MAN'.
    ***wa_order_text-text_id = '0001'.
    **wa_order_text-TDTEXT = 'Header Texts'.
    *wa_order_text-text_line = 'SYNGENTA HEADER'.
    ***wa_order_text-function = 'U'.
    wa_order_text-doc_number = l_vbeln.
    wa_order_text-itm_number = '000010'.
    *wa_order_text-TDOBJECT = 'EBAN'.
    wa_order_text-text_id = '0001'.
    *wa_order_text-TDTEXT = 'Item text'.
    wa_order_text-text_line = 'SYNGENTA TEXT'.
    wa_order_text-function = '004'.
    APPEND wa_order_text TO i_order_text.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = l_vbeln
      ORDER_HEADER_IN             =
        order_header_inx            = i_order_header_inx
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      NO_STATUS_BUF_INIT          = ' '
      TABLES
        return                      = i_return
        order_item_in               = i_order_item_in
        order_item_inx              = i_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_schedule_lines
       schedule_linesx             = i_schedule_linesx
       order_text                  = i_order_text
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
    IF sy-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait   = 'X'
        IMPORTING
          return = w_return.
    ENDIF.
    Please help out.
    Please send the code of it.
    Thanks in advance...

    START-OF-SELECTION.
    Get Blocked Orders
      PERFORM sub_select_orders.
      PERFORM order_reason_for_reject.
      END-OF-SELECTION.
    Display output
      PERFORM sub_display_output.
    *&      Form  sub_select_orders
          text
    FORM sub_select_orders .
      SELECT a~vbeln
             a~erdat
             a~erzet
             a~auart
             b~posnr
             FROM ( vbak as A
             INNER JOIN VBAP AS B
             on Bvbeln = AVBELN )
             INTO TABLE i_order_data
             WHERE a~vbeln IN s_ordno  AND
                   A~auart IN s_auart  AND
                   A~erdat IN s_orddt  AND
                   A~vkorg IN s_vkorg  AND
                   A~vtweg IN s_vtweg  AND
                   A~spart IN s_spart .
      IF sy-subrc NE 0.
        MESSAGE i001.
      No data selected
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " sub_get_blocked_orders
    *&      Form  order_reason_for_reject
          text
    -->  p1        text
    <--  p2        text
    FORM order_reason_for_reject .
      LOOP AT i_order_data INTO w_order_data.
        w_output-vbeln = w_order_data-vbeln.
        w_ordhdrx-updateflag = c_update.
    Update Order Reason for rejection .
        w_orditem-ITM_NUMBER = w_order_data-posnr.
        w_orditem-reason_rej = p_abgru.
        append w_orditem to i_orditem .
        w_orditemx-ITM_NUMBER = w_order_data-posnr.
        w_orditemx-updateflag = c_update.
        w_orditemx-reason_rej = 'X'.
        append w_orditemx to i_orditemx .
        At end of vbeln .
        w_output-vbeln = w_order_data-vbeln .
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
            EXPORTING
              salesdocument    = w_order_data-vbeln
              order_header_in  = w_ordhdr
              order_header_inx = w_ordhdrx
            TABLES
              ORDER_ITEM_IN    = i_orditem
              ORDER_ITEM_INX   = i_orditemx
              return           = i_bapiret.
          READ TABLE i_bapiret WITH KEY type = c_error
                               TRANSPORTING NO FIELDS.
          IF sy-subrc EQ '0'.
            move 'Order Reason for rejection update Failed' to
            w_output-message .
          ELSE.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait   = c_check
              IMPORTING
                 return = i_return.
          move 'Order Reason for rejection update successful' to
          w_output-message .
         endif .
         refresh :i_orditemx , i_orditem .
        Endat .
        APPEND w_output TO i_output.
        CLEAR w_output.
      endloop .
    ENDFORM.                    " order_reason_for_reject

  • Problem while changing Sales order using 'BAPI_SALESORDER_CHANGE'

    Hi all,
    Below is my code to update delivery block value:
    FORM call_bapi_salesorder_change .
    DATA:  iv_bapi_view  LIKE order_view.
    DATA: gt_sales_doc TYPE STANDARD TABLE OF sales_key, " Document Numbers to Be Selected
            gt_items TYPE STANDARD TABLE OF bapisdit. " Order Item Data for Document Numbers
    *************************************************************8
    DATA:order_headers_out LIKE bapisdhd OCCURS 0 WITH HEADER LINE.
    DATA:order_header_inx LIKE bapisdh1x.
      DATA: lv_salesdocument LIKE bapivbeln-vbeln.
      data: lv_matnr(10) type c.
      DATA:
    gt_schdule TYPE STANDARD TABLE OF bapischdl, " for gl date & load date
    gt_schdulex TYPE STANDARD TABLE OF bapischdlx, " for partner role and partner function.
            gt_return TYPE STANDARD TABLE OF bapiret2,
            gt_itemin TYPE STANDARD TABLE OF bapisditm,
            gt_iteminx TYPE STANDARD TABLE OF bapisditmx ,
            gt_bapisdh1 TYPE STANDARD TABLE OF  bapisdh1.
      DATA:gs_head_bapi TYPE bapisdh1x,
           gs_schdule TYPE bapischdl,
           gs_schdulex TYPE bapischdlx,
           gs_return TYPE bapiret2,
           gs_itemin TYPE bapisditm,
           gs_iteminx TYPE bapisditmx,
           gs_bapisdh1 TYPE bapisdh1.
      CLEAR : gt_schdule,gt_schdulex,gs_return.
      REFRESH gt_return.
      gs_head_bapi-updateflag = 'U'.
    SORT gt_final BY vbeln.
    CLEAR gs_vbep.
    REFRESH gt_vbep[].
      CLEAR gs_final.
      LOOP AT gt_final1 INTO gs_final.
        gs_itemin-itm_number = gs_final-posnr.
    *move gs_final-matnr to lv_matnr."qx94162
       gs_itemin-material = gs_final-matnr.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
          EXPORTING
            input  = gs_final-matnr
          IMPORTING
            output = gs_final-matnr.
       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = lv_matnr
        IMPORTING
         output = lv_matnr.
       gs_itemin-material = lv_matnr.
        gs_itemin-material = gs_final-matnr.
        gs_iteminx-itm_number = gs_final-posnr.
        gs_iteminx-updateflag = 'U'.""changed to I
        gs_iteminx-material = 'X'.
        " gs_schdule-req_dlv_bl = gs_final-lifsp. " Delivery block
        gs_schdule-itm_number = gs_final-posnr.
        gs_schdulex-itm_number = gs_final-posnr.
        gs_schdule-sched_line = '0001'.
        gs_schdulex-sched_line = '0001'.
       MOVE gs_final-lifsp to gs_schdule-req_dlv_bl.
        gs_schdule-req_dlv_bl = gs_final-lifsp.
        gs_schdulex-req_dlv_bl = 'X'. " Delivery block
        gs_schdulex-updateflag = 'U'.
        gs_bapisdh1-sales_org = gs_final-vkorg.
        APPEND gs_schdule TO gt_schdule.
        APPEND gs_schdulex TO gt_schdulex.
        APPEND gs_itemin TO gt_itemin.
        APPEND gs_iteminx TO gt_iteminx.
       Append gs_BAPISDH1 to gt_BAPISDH1.
        lv_salesdocument = gs_final-vbeln.
        CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            salesdocument               = lv_salesdocument     
           ORDER_HEADER_IN             = gs_BAPISDH1
            order_header_inx            = gs_head_bapi         
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      NO_STATUS_BUF_INIT          = ' '
          TABLES
            return                      = gt_return            
       order_item_in               =    gt_itemin
       order_item_inx              = gt_iteminx
      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                = gt_schdule           
          schedule_linesx               = gt_schdulex          
      ORDER_TEXT                  =
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
      NFMETALLITMS                =
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        REFRESH: gt_schdule, gt_schdulex, gt_itemin , gt_iteminx.
        LOOP AT gt_return INTO gs_return.
          WRITE / gs_return-message .
        ENDLOOP .
      ENDLOOP.
    ENDFORM.                    " CALL_BAPI_SALESORDER_CHANGE
    When I am using material value as 18342 using CONVERSION_EXIT_ALPHA_OUTPUT:
    ORDER_HEADER_IN has been processed successfully
    Material  is not defined for sales org.A101,  distr.chan.00,  language DE
    Error in ITEM_IN 000030
    SCHEDULE_IN has been processed successfully
    The sales document is not yet complete: Edit data
    Sales document 5010000715 was not changed
    and when I am using CONVERSION_EXIT_ALPHA_INPUT (000000000000018342)or  while debuging when I am changing value to  0018342 :
    I am getting below dump:
    Runtime Errors         DATA_LENGTH_0
    Exception              CX_SY_RANGE_OUT_OF_BOUNDS
    Date and Time          21.10.2010 07:22:17
    Information on where terminated
         Termination occurred in the ABAP program "SAPLVBAK" - in
          "MAP_VBAP_TO_BAPISDIT".
         The main program was "RS_TESTFRAME_CALL ".
         In the source code you have the termination point in line 168
         of the (Include) program "LVBAK001".
         The termination is caused because exception "CX_SY_RANGE_OUT_OF_BOUNDS"
          occurred in
         procedure "MAP_VBAP_TO_BAPISDIT" "(FORM)", but it was neither handled local
          nor declared
         in the RAISING clause of its signature.
         The procedure is in program "SAPLVBAK "; its source code begins in line
         99 of the (Include program "LVBAK001 ".
    The same dump I am getting while executing this above BAPI from SE37 tcode with the same test data.
    but I am able to change it though Va02 tcode.
    Edited by: Arora26 on Oct 21, 2010 7:58 AM

    Hi,
    have you searched for OSS notes? The note 1137897 looks like related to your problem. It mentions different BAPI but I assume that both BAPI reuse same routines and therefore it might solve your problem as well.
    Cheers

  • Cost involved in changing the code using log4j.properties to log4j.xml

    i have finished my application, and it was done in such a way that logging is done using log4j but it was using log4j.properties file.
    now i need to change it to log4j.xml. i need to do this at the earliest. so i need to know the cost involved in it?. do i need to change a lot on my app to read the log4j.xml?. In my app there is a function named getProperties, which actually reads the log4j.properties file.
    this is the code of that function
    public static Properties getProperties(String filename,String path) throws myException
    //InputStream is = null;
    FileInputStream is=null;
            Properties props = new Properties();       
            //ClassLoader classLoader = ResourceUtil.class.getClassLoader();
            //is = classLoader.getResourceAsStream(filename);
            File catalinaHome = new  File(System.getProperty("catalina.home"));     
            try {       
    is=new
    FileInputStream(catalinaHome.getCanonicalFile()+path + filename);
    } catch (IOException e) {
            if(is == null)
                String message = "Cannot locate property file " + filename + " in the classpath";
                log.error(message);
            throw new myException(message);
            try
                props.load(is);
            catch (IOException e)
                String message = "Error reading property file " + filename;
                log.error(message);
            throw new myException(message, e);
            finally
                try
                    is.close();
                catch(Throwable t)
                    t.printStackTrace();
            if(props.isEmpty())
                String message = "No properties are defined in " + filename;
                log.error(message);
            throw new myException(message);
            return props;       
    }and my initialize function is
    public static void initialize()
    Properties properties=null;
    try {
    String path="/properties/";
    properties=ResourceUtil.getProperties("log4j.properties",path);
    } catch (myException e2) {
    e2.printStackTrace();
    PropertyConfigurator.configure(properties);
    }Message was edited by:
    xema
    Message was edited by:
    xema
    Message was edited by:
    xema

    >
    1. Restructure log4j.properties into log4j.xml.
    thats done
    2. Move log4j.xml into a directory that's in the
    classpath.
    actually i donot understand what does it mean to move in a directory thats in classpath means. i have to use logging in my webapplication running in tomcat. and my log4j.xml has to reside in catalina.home/properties/. My log4j.properties have been residing here and it had worked well woth the previous function. Now what i did is placed the log4j.xml under properties folder. Now tell me what modifications should i make in the above code.
    3. Remove any code that explicitly configures log4j
    (i.e. the initialize() method) because log4j will
    configure itself from any properties file it finds in
    the classpath, automatically, the first time it is
    called.I prefer not remvoing this function as this function is being called in many of my classes... and we don't have time to edit all...
    please help... and excuse me if i asked some blunders.!!!

  • Changing ITEM catergory using BAPI_SALESORDER_CHANGE

    Hi
    i am working on changing ITEM catergory for line items of sales order.
    If the owner(ZZORD_OWNER) is 'AM' then i hv to populate PSTYV in VBAP as 'ZTAC' else 'ZDEL'.
    the field ZZORD_OWNER is custom field added in header level(value is populated using BAPI, cannot be entered from screen).Kindly let me know how can i attain this activity.

    hi
    i have to change entries in table for corresponding items when ZZORD_OWNER is populated or changed.
    i want to know where should i write the code for this.

  • Changing java code using Java program

    hi All,
    I have some java classes, which i need to modify. The changes are mechanical, like putting finally block for the methods where there is a try block.
    Please suggest on how to write a small java program that will accomplish the task. Some code snippets may be helpful.
    Thanks,
    Raj.

    no, you got me wrong. After i add the finally blocks,
    i will perform the clean up tasks there. The first
    part of adding the finally blocks,i want to perform
    using a program.No you really don't want to do this.
    a) This will not be easy and in fact will be quite messy.
    b) It doesn't gain you anything anyway. As you yourself just noted you will have to put appropriate code in all those blocks anyway.
    So give this up and do it manually and for next time you will have learned that you should follow the standards from your project from the start.

  • Using Bapi_salesorder_change adding a item, deleting a  item,Quanty change

    I need help on Bapi_salesorder_change.
    I have a table control in which there will be data of a particular sales document no, items, quantity, sales unit. When user changes the quantity, or adds a line item or deletes a line item and the press the save button bapi_salesorder_change should trigger and should change the order as the user changes.
    Can u help how to write code for this three conditions
    1> adding line item.
    2> deleting a line item.
    3> changing the quantity.
    using bapi_salesorder_change
    Can i use the same bapi for three conditions?
    Please help me in this as soon as possible.
    I thank them in advance

    Hello Geeks,
              i am using this bapi  for updating my item quantity no....
              but the bapi return msg say tat its not changing....
              i think i may did some mistake pls anyone can rectify it....
              i hv attached my code below......
    *For line item
    TYPES :BEGIN OF y_t_vbap,
            vbeln TYPE vbeln_va,  "sales Document
            posnr TYPE posnr_va,  "Item no of SD document
            matnr TYPE matnr,     "Material No
            zmeng TYPE dzmeng ,   "Target qty in Sales unit
            spart TYPE spart,     "division
            message TYPE BAPI_MSG,
           kwmeng type kwmeng,   "cummulative order qty
           END OF y_t_vbap.
    TYPES : y_t_itemin TYPE bapisditm,
            y_t_return TYPE bapiret2,
            y_t_headerx TYPE bapisdh1x.
    TYPES: BEGIN OF y_t_logdata,
           lno             TYPE         lineno,         "Lineno
           field           TYPE         fieldname,      "Field Name
           value           TYPE         lmon_fvalue,    "Field Value
           message         TYPE         bapi_msg,       "Messages
           END OF y_t_logdata.
                     Internal table declaration
    DATA: "y_i_vbak      TYPE   STANDARD TABLE OF y_t_vbak,
          y_i_vbap      TYPE   STANDARD TABLE OF y_t_vbap,
          y_i_headerx   TYPE   STANDARD TABLE OF bapisdh1x,
          y_i_itemin    TYPE   STANDARD TABLE OF bapisditm ,
          y_i_iteminx   TYPE   STANDARD TABLE OF bapisditmx,
          y_i_return    TYPE   STANDARD TABLE OF y_t_return,
          y_i_logdata   TYPE   STANDARD TABLE OF y_t_logdata,
          y_i_bapiret   TYPE   STANDARD TABLE OF bapiret2.
                     Table type declaration
    TYPES: y_tt_vbap    TYPE   STANDARD TABLE OF y_t_vbap ,
           y_tt_logdata TYPE   STANDARD TABLE OF y_t_logdata.
                     Work Area declaration.
    DATA:   y_wa_vbap     TYPE   y_t_vbap,
          y_wa_itemin   TYPE   bapisditm ,
          y_wa_iteminx  TYPE   bapisditmx,
          y_wa_headerx  TYPE   bapisdh1x,
          y_wa_return   TYPE   y_t_return,
          y_wa_logdata  TYPE   y_t_logdata,
          y_wa_event    TYPE   slis_alv_event,
          y_wa_event1   TYPE   slis_t_event,
          y_wa_bapiret  TYPE   bapiret2.
                     Variables declaration.
    DATA: y_i_event     TYPE   slis_t_event,
          y_v_success   TYPE   i           , "For Success
          y_v_error     TYPE   i           , "For Error
          y_v_sno       TYPE   char30      ,
          y_v_eno       TYPE   char30      ,
          y_v_msg       TYPE   char100     . "error msg
                     Constants declaration.
    constants : y_k_x type char1 value 'X',
                    y_k_u type char1 value 'U',
                   y_k_e type char1 value 'E'.
                  SELECTION SCREEN LAYOUT
    SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN: COMMENT 3(18) text-003.
    PARAMETERS   :    y_p_vbln TYPE vbak-vbeln OBLIGATORY.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN : END OF BLOCK b1.
                      START-OF-SELECTION.
    START-OF-SELECTION.
    WRITE: text-002.
                      END-OF-SELECTION.
    END-OF-SELECTION.
      SELECT  vbeln
              posnr
              matnr
              zmeng
              spart
              FROM vbap
                   INTO TABLE    y_i_vbap
                   WHERE vbeln = y_p_vbln.
      LOOP AT y_i_vbap INTO y_wa_vbap.
        y_wa_vbap-zmeng = 2 + y_wa_vbap-zmeng.
        MODIFY y_i_vbap FROM y_wa_vbap INDEX sy-tabix.
      ENDLOOP.
      PERFORM y_f_update USING y_i_vbap.
    *&      Form  y_f_update
           POPULATE BAPI DATA AND RUN BAPI
    FORM y_f_update USING  y_p_vbap TYPE y_tt_vbap.
      CLEAR: y_i_headerx, y_i_itemin, y_i_iteminx,
             y_i_return, y_i_bapiret.
      REFRESH: y_i_itemin, y_i_iteminx, y_i_return, y_i_bapiret.
      LOOP AT y_i_vbap INTO y_wa_vbap.
        MOVE y_wa_vbap-zmeng TO y_wa_itemin-target_qty.
        MOVE y_wa_vbap-posnr TO y_wa_itemin-itm_number.
        APPEND y_wa_itemin TO y_i_itemin.
      ENDLOOP.
    *Update the Bapi Itnernal tables
      y_wa_headerx-updateflag = y_k_u .
      APPEND y_wa_headerx TO y_i_headerx.
      LOOP AT y_i_vbap INTO y_wa_vbap.
        y_wa_iteminx-itm_number = y_wa_vbap-posnr.
        y_wa_iteminx-target_qty = y_k_x .
        y_wa_iteminx-updateflag = y_k_u .
        APPEND y_wa_iteminx TO y_i_iteminx .
      ENDLOOP .
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = y_wa_vbap-vbeln
          order_header_inx = y_wa_headerx
        TABLES
          return           = y_i_return
          order_item_in    = y_i_itemin
          order_item_inx   = y_i_iteminx.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      CLEAR y_i_vbap.
    IF y_i_return is not initial.
      LOOP AT y_i_return INTO y_wa_return where TYPE = y_k_e .
        MOVE y_wa_return-message TO y_wa_vbap-message .
        Append  y_wa_vbap to y_i_vbap.
        y_v_success = y_v_success + 1.
      ENDLOOP.
    ENDIF.
      y_wa_event-name = 'TOP_OF_PAGE'.
      y_wa_event-form = 'Y_FD_TOP_OF_LIST'.
      APPEND y_wa_event TO y_i_event.
      CLEAR y_wa_event.
      CALL FUNCTION 'ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program         = sy-repid
          i_tabtypename1             = 'Y_T_VBAP'
          it_events1                 = y_i_event[]
        TABLES
          t_outtab1                  = y_i_vbap[]
        EXCEPTIONS
          program_error              = 1
          maximum_of_appends_reached = 2
          OTHERS                     = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " y_f_vbap
    *&      Form  Y_FD_TOP_OF_LIST
    FORM y_fd_top_of_list.
      MOVE: y_v_success TO y_v_sno,
            y_v_error   TO y_v_eno.
      CONCATENATE text-002 y_v_sno '/' y_v_eno INTO y_v_msg SEPARATED BY
      space.
      CONDENSE y_v_msg.
      WRITE / y_v_msg .
      SKIP 1.
    ENDFORM.                    "Y_FD_TOP_OF_LIST

  • How to use BAPI_SALESORDER_CHANGE to change payment terms in Orders?

    Can any body give me an idea on how to use BAPI_SALESORDER_CHANGE to change payment terms in Orders?
    Regards,
    Dantham Conpolwedson

    Hi,
    try the link
    Link:[https://forums.sdn.sap.com/click.jspa?searchID=24060901&messageID=7265357]

  • Changing quantity using bapi_salesorder_change function

    hi ,
    i am changing quantity using 'bapi_salesorder_change' function.what are the minimum parameteres that needs to be passsed to the function.i am not able to change the quantity for some items.also for some sales orders i am not getting any error message but commit work is not working.
    thanks ,
    nitin

    Hi Nitin,
    After you call the BAPI_SALESORDER_CHANGE, specifically call BAPI_TRANSACTION_COMMIT , as BAPI_SALESORDER_CHANGE does not run a database commit.(as per the documentation provided by SAP for BAPI_SALESORDER_CHANGE)
    Thanks
    Lakshman

  • Partner address change issue using BAPI_SALESORDER_CHANGE

    Hi,
    I'm trying to change partner address in an order using the Bapi BAPI_SALESORDER_CHANGE. I have searched the known threads but did not found a solution.
    my requrirement is to change partner address without passing address number to 'PARTNERADDRESSES' parameter
    This is brief about my requirement.
    Our requirement is sales order executin from ECC6 to ECC5 i.e. when a sales order is created in ECC6 it should be created in ECC5 when we save order in ECC6, so in a similar way even changes done in EC6 sales order should be reflectedin ECC5 (whichi includes ATP also) so during this process a user can add additional line items with different ship_to party address, so for newly added line item in ECC6 during VA02 (change process) address number will not be there in ECC5 so i can not pass address number in ECC5 during address change using BAPI_SALESORDER_CHANGE.
    since stock is not maintained in ECC6 we are doing above process i.e. sales order execution from ECC6 to ECC5.
    so in order to change partner address for newly added line item in ECC6 i will not be having adrees number in ECC5 so can any body plz let me know how to change address of a parter without passing address number to 'PARTNERADDRESSES' parameter of
    'BAPI_SALESORDER_CHANGE'.
    If any body has faced this and found a solutin for this plz let me know.
    Hope you understood my requirement.

    give a meaningful title to ur thread, so that, people get u back quickly. Just tip that, try to do ur requirement online, then Observe How the system is behaving....thanq

  • Deleting Sales Order Details using BAPI_SALESORDER_CHANGE And Reinserting

    Hi All,
    I need to <b>change a Sales Order</b> in such a way that I would <b>delete all the existing Line Items</b> of that SO And <b>then reinsert new Line Items</b> as generally is the practice of saving a document.(Update Header-Delete Old Item Entries-Reinsert New Present Entries).
    I coded a small test program in ABAP using the <b>BAPI_SALESORDER_GETLIST And BAPI_SALESORDER_CHANGE</b>.
    In order to affect the Qty I have to update the Schedule Parameter also of the BAPI_SALESORDER_CHANGE Function.But this causes a new entry in VBEP.
    eg:
    <b>Before BAPI Calls</b>
    SO-Number:9001
    Header:9001,etc......
    Detail:ItemNo=10,Material=xyz,TargetQty=100,etc..
    Scedule:ItemNo=10,Scheduleline=1,Req_Qty=100,etc...
    I coded the program such that
    1.I <b>Get the List of Items</b> using BAPI_SALESORDER_GETLIST.
    2.Call the <b>BAPI_SALESORDER_CHANGE</b> filling appropraite   values in Parameters <b>with UpdateFlag = 'D'</b>
    3.<b>Insert new values</b> in OrderItems And Schedule Parameters
    say:
    Detail:ItemNo=10,Material=xyz,TargetQty=25,etc..
    Scedule:ItemNo=10,Scheduleline=1,Req_Qty=25,etc...
    4.<b>Call the BAPI_SALESORDER_CHANGE</b> filling appropraite values in Parameters <b>with UpdateFlag = 'I'</b>
    <b>The output now becomes.</b>Header:9001,etc......
    Detail:ItemNo=10,Material=xyz,TargetQty=100,etc..
    Scedule:ItemNo=10,Scheduleline=1,Req_Qty=100,etc...
    ItemNo=10,Scheduleline=2,Req_Qty=25,etc...
    Now After Commit when I see my <b>SO it shows me a qty of
    125</b>.
    I am attaching the code for your analysis.
    Thanx in advance.
    *& Report  ZSM_CHANGESALESORDER                                        *
    REPORT  ZSM_CHANGESALESORDER                    .
    DATA:
    For Calling the GetList BAPI Function
      CUSTOMER_NUMBER LIKE  BAPI1007-CUSTOMER,
      SALES_ORGANIZATION LIKE  BAPIORDERS-SALES_ORG,
      IT_SALES_ORDERS LIKE TABLE OF BAPIORDERS,
      WA_SALES_ORDERS LIKE LINE OF IT_SALES_ORDERS,
      IT_RETURN LIKE TABLE OF BAPIRETURN,
      WA_RETURN LIKE LINE OF IT_RETURN.
    For Calling the ChangeFromData BAPI Function
    DATA:
      SALESDOCUMENT LIKE  BAPIVBELN-VBELN,
      WA_ORDER_HEADER_IN LIKE  BAPISDH1,
      WA_ORDER_HEADER_INX LIKE BAPISDH1X,
      IT_ORDER_ITEM_IN LIKE TABLE OF BAPISDITM ,
      WA_ORDER_ITEM_IN LIKE LINE OF IT_ORDER_ITEM_IN,
      IT_ORDER_ITEM_INX LIKE TABLE OF BAPISDITMX ,
      WA_ORDER_ITEM_INX LIKE LINE OF IT_ORDER_ITEM_INX,
      IT_SCHEDULE_LINES LIKE TABLE OF BAPISCHDL ,
      WA_SCHEDULE_LINES LIKE LINE OF IT_SCHEDULE_LINES,
      IT_SCHEDULE_LINESX LIKE TABLE OF BAPISCHDLX ,
      WA_SCHEDULE_LINESX LIKE LINE OF IT_SCHEDULE_LINESX,
      IT_RETURN_CHG LIKE TABLE OF BAPIRET2,
      WA_RETURN_CHG LIKE LINE OF IT_RETURN_CHG.
    DATA:
      IT_RETURN_CT LIKE BAPIRET2.
    PARAMETERS:
      P_SO LIKE VBAK-VBELN,
      P_CUSTNO LIKE  BAPI1007-CUSTOMER,
      P_SORG LIKE BAPIORDERS-SALES_ORG.
    START-OF-SELECTION.
      SALESDOCUMENT = P_SO.
      CUSTOMER_NUMBER = P_CUSTNO.
      SALES_ORGANIZATION = P_SORG.
    Retrieve the Existing Sales Order details for that Sales Order.
      PERFORM GETREQSODETAILS.
    Delete the Existing Sales Order details from that Sales Order.
      PERFORM DELETEOLDSODETAILS.
    Insert New details for that Sales Order.
       PERFORM ADDNEWSODETAILS.
    END-OF-SELECTION.
      PERFORM COMMITTRANS.
    *&      Form  GetReqSODetails
    FORM GETREQSODETAILS .
      CALL FUNCTION 'BAPI_SALESORDER_GETLIST'
        EXPORTING
          CUSTOMER_NUMBER    = CUSTOMER_NUMBER
          SALES_ORGANIZATION = SALES_ORGANIZATION
        IMPORTING
          RETURN             = WA_RETURN
        TABLES
          SALES_ORDERS       = IT_SALES_ORDERS.
    *delete the Sales Order Details of Sales Orders other than the req.One
      IF NOT IT_SALES_ORDERS[] IS INITIAL.
        SORT IT_SALES_ORDERS BY SD_DOC.
        LOOP AT IT_SALES_ORDERS INTO WA_SALES_ORDERS.
          IF WA_SALES_ORDERS-SD_DOC NE SALESDOCUMENT.
            DELETE IT_SALES_ORDERS.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " GetReqSODetails
    *&      Form  deleteOldSODetails
    FORM DELETEOLDSODETAILS .
      DATA: IRECCOUNT TYPE I.
      IRECCOUNT = 1.
    *Clear all the Inernal Tables And Work Areas
    *and Update the SO Header Index
      PERFORM CLEARDATA.
      PERFORM SOHEADERINDEX.
      LOOP AT IT_SALES_ORDERS INTO WA_SALES_ORDERS.
    *Fill the Order Details Index Internal Table
        PERFORM FILLSODELETEDTLS_INDEX_PARAM
        USING WA_SALES_ORDERS-ITM_NUMBER 'D'.
    *Fill the Order Scedule Index Internal Table
        PERFORM FILLSODELETESCH_INDEX_PARAM
        USING WA_SALES_ORDERS-ITM_NUMBER IRECCOUNT 'D'.
      ENDLOOP.
    *call the Sales Order Change Fumction to delete the Existing Data
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          SALESDOCUMENT    = SALESDOCUMENT
          ORDER_HEADER_INX = WA_ORDER_HEADER_INX
        TABLES
          RETURN           = IT_RETURN_CHG
          ORDER_ITEM_INX   = IT_ORDER_ITEM_INX
          SCHEDULE_LINESX  = IT_SCHEDULE_LINESX.
    ENDFORM.                    " deleteOldSODetails
    *&      Form  SOHeaderIndex
    FORM SOHEADERINDEX .
      WA_ORDER_HEADER_INX-UPDATEFLAG = 'U'.
    ENDFORM.                    " SOHeaderIndex
    *&      Form  FillSODeleteDtls_Index_param
    FORM FILLSODELETEDTLS_INDEX_PARAM
    USING VALUE(P_ITM_NUMBER) VALUE(P_FLAG).
      WA_ORDER_ITEM_INX-ITM_NUMBER = P_ITM_NUMBER.
      WA_ORDER_ITEM_INX-UPDATEFLAG = P_FLAG.
      APPEND WA_ORDER_ITEM_INX TO IT_ORDER_ITEM_INX.
    ENDFORM.                    " FillSODeleteDtls_Index_param
    *&      Form  FILLSODELETEsch_Index_PARAM
    FORM FILLSODELETESCH_INDEX_PARAM
    USING VALUE(P_ITM_NUMBER) VALUE(P_RECCOUNT) VALUE(P_FLAG).
      WA_SCHEDULE_LINESX-ITM_NUMBER = P_ITM_NUMBER.
      WA_SCHEDULE_LINESX-SCHED_LINE = P_RECCOUNT.
      WA_SCHEDULE_LINESX-UPDATEFLAG = P_FLAG.
      APPEND WA_SCHEDULE_LINESX TO IT_SCHEDULE_LINESX.
    ENDFORM.                    " FILLSODELETEsch_Index_PARAM
    *&      Form  addnewSODETAILS
    FORM ADDNEWSODETAILS .
      DATA: IRECCOUNT TYPE I, ITEMNO TYPE I.
      IRECCOUNT = 1.
    *Clear all the Inernal Tables And Work Areas
    *and Update the SO Header Index
      PERFORM CLEARDATA.
      PERFORM SOHEADERINDEX.
      WHILE IRECCOUNT <= 1.
        ITEMNO = IRECCOUNT * 10.
    *Fill the New Order Details in the Internal Table
        PERFORM FILLSODTLDATA USING ITEMNO 'TEST FG' 37 .
    *Fill the Order Details Index Internal Table
        PERFORM FILLSODELETEDTLS_INDEX_PARAM USING ITEMNO 'I'.
    *Fill the New Schedule Details in the Internal Table
        PERFORM FILLSOSCHDATA USING ITEMNO IRECCOUNT 37 .
    *Fill the Order Scedule Index Internal Table
        PERFORM FILLSODELETESCH_INDEX_PARAM
        USING ITEMNO IRECCOUNT 'I'.
        IRECCOUNT = IRECCOUNT + 1.
      ENDWHILE.
    *call the Sales Order Change Fumction to Insert New Data
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          SALESDOCUMENT    = SALESDOCUMENT
          ORDER_HEADER_INX = WA_ORDER_HEADER_INX
        TABLES
          RETURN           = IT_RETURN_CHG
          ORDER_ITEM_IN    = IT_ORDER_ITEM_IN
          ORDER_ITEM_INX   = IT_ORDER_ITEM_INX
          SCHEDULE_LINES   = IT_SCHEDULE_LINES
          SCHEDULE_LINESX  = IT_SCHEDULE_LINESX.
    ENDFORM.                    " addnewSODETAILS
    *&      Form  clearData
    FORM CLEARDATA .
      CLEAR WA_ORDER_HEADER_INX.
      CLEAR WA_ORDER_ITEM_INX.
      REFRESH IT_ORDER_ITEM_INX.
      CLEAR WA_SCHEDULE_LINESX.
      REFRESH IT_SCHEDULE_LINESX.
      CLEAR WA_RETURN.
      REFRESH IT_RETURN.
      CLEAR WA_ORDER_ITEM_IN.
      REFRESH IT_ORDER_ITEM_IN.
      CLEAR WA_SCHEDULE_LINES.
      REFRESH IT_SCHEDULE_LINES.
    ENDFORM.                    " clearData
    *&      Form  FILLSODTLDATA
    FORM FILLSODTLDATA  USING    VALUE(P_ITEMNO) VALUE(P_MATERIAL)
    VALUE(P_TARGET_QTY) .
      WA_ORDER_ITEM_IN-ITM_NUMBER = P_ITEMNO.
      WA_ORDER_ITEM_IN-MATERIAL = P_MATERIAL.
      WA_ORDER_ITEM_IN-TARGET_QTY = P_TARGET_QTY.
      APPEND WA_ORDER_ITEM_IN TO IT_ORDER_ITEM_IN.
    ENDFORM.                    " FILLSODTLDATA
    *&      Form  FILLSOschDATA
    FORM FILLSOSCHDATA  USING    VALUE(P_ITEMNO)
                                 VALUE(P_RECCOUNT)
                                 VALUE(P_REQ_QTY)  .
      WA_SCHEDULE_LINES-ITM_NUMBER = P_ITEMNO.
      WA_SCHEDULE_LINES-SCHED_LINE = P_RECCOUNT.
      WA_SCHEDULE_LINES-REQ_QTY = P_REQ_QTY.
      APPEND WA_SCHEDULE_LINES TO IT_SCHEDULE_LINES.
    ENDFORM.                    " FILLSOschDATA
    *&      Form  committrans
    FORM COMMITTRANS .
      DATA:SUCCESSFLAG(1).
      LOOP AT IT_RETURN_CHG INTO WA_RETURN_CHG.
        IF WA_RETURN_CHG-TYPE = 'S'
              AND WA_RETURN_CHG-ID = 'V1'
              AND WA_RETURN_CHG-NUMBER = 311
              AND SUCCESSFLAG IS INITIAL.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              WAIT   = 'X'
            IMPORTING
              RETURN = IT_RETURN_CT.
          SUCCESSFLAG = 'X'.
        ENDIF.
      ENDLOOP.
      IF SUCCESSFLAG IS INITIAL.
        WRITE: 'SORRY SOME ERROR'.
      ELSE.
        WRITE: 'SUCCESSFUL'.
      ENDIF.
    ENDFORM.                    " committrans

    Thanx wolfgang,
    I needed that info.
    As I had mentioned in the earlier posts, I want to delete the old Sales Order Item Details,
    Schedule Details,Basic Price data And Reinsert data in the same.
    I am giving u the algo that I have used.
    1.<b>Get the SalesOrder Details</b> for a particular Sales Order using BAPI_SALESORDER_GETLIST(para:customer & sales Org and then deleting unwanted SO data).
    2.<b>Delete</b> the Sales Order <b>Item Details,Schedule Details</b> using BAPI_SALESORDER_CHANGE.
    3.<b>Commit</b> Transaction(<b>If I dont use this commit Error comes in Step No.7 while Commiting</b>)
    using BAPI_TRANSACTION_COMMIT.
    4.Check <b>Return Table</b> of both BAPI_SALESORDER_CHANGE and BAPI_TRANSACTION_COMMIT.
    5.if Step No.4 is <b>Not okay</b> <b>then Rollback</b>(BAPI_TRANSACTION_TRANSACTIN) <b>and Exit</b> <b>else move to step 6</b>.
    6.<b>Add New</b> Sales Order <b>Item Details,Schedule Details, Basic Price</b> using BAPI_SALESORDER_CHANGE.
    7.<b>Commit Transaction</b> using BAPI_TRANSACTION_COMMIT.
    8.<b>Check Return</b> Log of both BAPI_SALESORDER_CHANGE and BAPI_TRANSACTION_COMMIT.
    9.if Step No.9 is okay then Exit else Rollback(BAPI_TRANSACTION_TRANSACTIN) and move to step 10.
    10.Add Old Sales Order Item Details,Schedule Details, Basic Price from Data available in Internal
    table(Filled in step.1 ) using BAPI_SALESORDER_CHANGE.
    11.Commit Transaction using BAPI_TRANSACTION_COMMIT.
         This <b>works fine in 1 server in which I get the message of Incomplete Data,etc...when I make a Sales Order from va01</b>.
    But in another server where I dont this message,I get <b>error in step  7 or 11 as per the flow</b>.
    The return structure of BAPI_TRANSACTION_COMMIT contains error with Message 'Updating was not possible'. Also the message 'Updation was terminated' cms frm the SAP server.  
         What could be the reason?
    Thanx in advance

  • Change sold-to party BAPI_SALESORDER_CHANGE

    Hello,
    Does anyone know how to change partner function AG (sold-to-party) in a sales order header from within ABAP code ?
    I'm using BAPI_SALESORDER_CHANGE function module to change partner functions. It works well for all other partner functions, but for the AG ("sold-to-party") function it yields a message saying that changing AG function is impossible.
    Although changing "sold-to-party" partner function is disabled in user interface (VA02 transaction -> order header details), but the user DOES have the possibility to change "sold-to-party": he can change field KUNNR in main screen of transaction VA02 (this field is mapped to VBAK-KUNNR) - after changing it, the AG partner function in header details changes to the value set in it. Does anyone have an idea how to achieve the same from ABAP code ?
    Regards,
    Flavio.

    REPORT  ZSALESORDER_CHANGE MESSAGE-ID 38.
    Selection Screen Definitions *
    PARAMETERS: p_vbeln TYPE vbap-vbeln OBLIGATORY, "Order Number
    p_posnr TYPE vbap-posnr OBLIGATORY, "Order Item
    p_etenr TYPE vbep-etenr OBLIGATORY, "Schedule Line
    p_reqqty TYPE bapischdl-req_qty OBLIGATORY. " Order Qty
    Internal Tables/Structures/Variables for calling BAPI. *
    DATA: i_hdr TYPE bapisdh1,
    i_hdrx TYPE bapisdh1x,
    i_ret TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
    wa_ret TYPE bapiret2.
    DATA: BEGIN OF i_sched OCCURS 10.
    INCLUDE STRUCTURE bapischdl.
    DATA: END OF i_sched.
    DATA: BEGIN OF i_schedx OCCURS 10.
    INCLUDE STRUCTURE bapischdlx.
    DATA: END OF i_schedx.
    START-OF-SELECTION Event *
    START-OF-SELECTION.
    *" Initialize internal tables.
    REFRESH: i_sched, i_schedx, i_ret.
    CLEAR: i_sched, i_schedx, i_ret.
    *" Fill required ORDER_HEADER_IN data.
    i_hdrx-updateflag = 'U'.
    *" Fill required SCHEDULE_LINES data.
    i_sched-itm_number = p_posnr.
    i_sched-sched_line = p_etenr.
    i_sched-req_qty = p_reqqty.
    i_schedx-updateflag = 'U'.
    i_schedx-itm_number = p_posnr.
    i_schedx-sched_line = p_etenr.
    i_schedx-req_qty = 'X'.
    APPEND i_sched.
    APPEND i_schedx.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = p_vbeln
    order_header_in = i_hdr
    order_header_inx = i_hdrx
    TABLES
    return = i_ret
    schedule_lines = i_sched
    schedule_linesx = i_schedx.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    LOOP AT i_ret.
    WRITE / i_ret-message.
    ENDLOOP.

  • Changing unloading point using BAPI

    Hello Gurus,
                         Can we change unloading point(item level) in the sales order using BAPI_SALESORDER_CHANGE. If so please let me know how to do it.
    Thanks,
    KB

    Did you use BAPI_TRANSACTION_COMMIT after BAPI_PO_CHANGE.
    Look also at this <a href="http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm">Sample Abap code on BAPI_PO_CHANGE</a>
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          PURCHASEORDER = T_POHEADER-PO
          POHEADER      = T_BAPI_POHEADER
          POHEADERX     = T_BAPI_POHEADERX
        TABLES
          RETURN        = T_BAPIRETURN
          POITEM        = T_BAPI_POITEM
          POITEMX       = T_BAPI_POITEMX.
      READ TABLE t_bapireturn WITH KEY type = c_err TRANSPORTING NO FIELDS.
      IF sy-subrc NE 0.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = c_x.
      ENDIF.
    Regards

Maybe you are looking for

  • Extremely poor Performance on OAS 10g 9.0.4.0.0 and Oracle DBMS 8.1.7.4.0

    Hi everyboy, after hours of reading and searching on the Web for our problem, i somebody can help me on my quite strange issue. We have installed a 3rd-Party Webapplication on our server. This is a 2-CPU Linux System with 4GB RAM, so that the Hardwar

  • Download url for the sgd 4.6 release

    hello all, can anyone please point me to the correct url to download the new sgd 4.6? the download link on the official web page (http://www.oracle.com/us/technologies/virtualization/oraclevm/061996.html) still points to the old 4.5.1 release. greeti

  • Header Repeats when table runs onto 2nd page

    I have a form with a dynamic table in which the user is allowed to add and remove rows to it as needed.  The table also has a column on the end of it that will become visible/hidden on the click of a button.  It also performs basic arithmatic (additi

  • Sqlldr fails

    load data CHARACTERSET UTF8 truncate into table COLLECTION APPEND fields terminated by "," optionally enclosed by '^' trailing nullcols (COLLECTIONID,PERSONID,NAME1,TAGS,DELETED,PRIVACY,SERVICEID,TYPE1,CONTENTTYPE,EMAILID,DESCRIPTION,CREATIONTIME,UPD

  • Help in if

    hallow i wont to now how i can do if statment in this logic if a and b and c and d is not initial. end if. regards