To update conditiontype values using change BAPI of sales order

Hi Gurus,
i am using the standard bapi 'BAPI_SALESORDER_CHANGE' and i am passing the values for the conditiontypes as follows.......
vbeln is my sales order number..
wa_conditions_in-itm_number = '00010'.
wa_conditions_in-cond_count = '01'.
wa_conditions_in-cond_type = 'ZCUS'.
wa_conditions_in-applicatio = 'V'.
wa_conditions_in-cond_value =  '1000.00'.
wa_conditions_in-currency = 'INR'.
wa_conditions_in-cond_p_unt = '1'.
wa_conditions_inx-itm_number = '00010'.
wa_conditions_inx-cond_count = '01'.
wa_conditions_inx-cond_type = 'ZCUS'.
wa_conditions_inx-updateflag = 'U'.
wa_conditions_inx-cond_value = 'X'.
wa_conditions_inx-currency = 'X'.
wa_conditions_inx-cond_p_unt = 'X'.
    APPEND wa_conditions_in TO conditions_in.
    APPEND wa_conditions_inx TO conditions_inx.
CLEAR : order_header_in, order_header_inx.
order_header_in1-purch_no_c = 'Order'.
order_header_inx1-purch_no_c = 'X'.
order_header_in1-purch_no_s = 'Order'.
order_header_inx1-purch_no_s = 'X'.
order_header_inx1-updateflag = 'U'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    salesdocument               = vbeln
    order_header_in             = order_header_in1
    order_header_inx            = order_header_inx1
  SIMULATION                  =
  BEHAVE_WHEN_ERROR           = ' '
  INT_NUMBER_ASSIGNMENT       = ' '
  LOGIC_SWITCH                =
  TABLES
    return                      = return
   conditions_in               = conditions_in
   conditions_inx              = conditions_inx
  EXTENSIONIN                 =
while executing in the order it is not updating the value for the condition type 'ZCUS' and it is inserting as new record.
Please help me in this regard.
Thanks & Regards,
R.P.Sastry

HI,
Take the below sample code. for example and try to use like that.
REPORT ZTEST_BAPI .
Data: salesd like BAPIVBELN-VBELN.
data: it_BAPISDH1 type BAPISDH1.
data: it_BAPISDH1X type BAPISDH1X.
data: it_BAPIPARNR type BAPIPARNR occurs 0 with header line.
data: it_BAPIRET2 type BAPIRET2 occurs 0 with header line.
data: it_BAPIPARNRC type BAPIPARNRC occurs 0 with header line.
data: it_BAPISDITMX type BAPISDITMX occurs 0 with header line.
data: it_BAPISDITM type standard table of BAPISDITM with header line.
constants: c_bp(2) type c value 'BP'.
it_BAPISDH1X-UPDATEFLAG = 'U'.
it_BAPISDH1X-SALES_ORG = 'X'.
it_BAPISDH1X-DISTR_CHAN = 'X'.
it_BAPISDH1X-DIVISION = 'X'.
it_BAPISDH1X-PURCH_NO_C = 'X'.
it_BAPISDH1X-CUST_GROUP = 'X'.
it_BAPISDH1-SALES_ORG = '1000'.
it_BAPISDH1-DISTR_CHAN = '01'.
it_BAPISDH1-DIVISION = '00'.
it_BAPISDH1-PURCH_NO_C = 'Test1'.
it_BAPIPARNR-PARTN_ROLE = 'RE'.
it_BAPIPARNR-PARTN_NUMB = '0000000171'.
it_BAPIPARNR-ITM_NUMBER = '00000'.
append it_BAPIPARNR.
it_BAPIPARNR-PARTN_ROLE = 'RE'.
it_BAPIPARNR-PARTN_NUMB = '0000000179'.
it_BAPIPARNR-ITM_NUMBER = '000000'.
append it_BAPIPARNR.
it_BAPIPARNRC-DOCUMENT = '000000375'.
it_BAPIPARNRC-ITM_NUMBER = '000000'.
it_BAPIPARNRC-UPDATEFLAG = 'U'.
it_BAPIPARNRC-PARTN_ROLE = 'WE'.
it_BAPIPARNRC-P_NUMB_OLD = '0000000171'.
it_BAPIPARNRC-P_NUMB_NEW = '0000000179'.
it_BAPIPARNRC-ADDRESS = '26324'.
it_BAPIPARNRC-ADDR_LINK = '0000000003'.
it_BAPIPARNRC-REFOBJTYPE = 'BUS2032'.
it_BAPIPARNRC-REFOBJKEY = '000000375'.
append it_BAPIPARNRC.
data PARTNERADDRESSES like BAPIADDR1 occurs 0 with header line.
PARTNERADDRESSES-ADDR_NO = '0000000003'.
PARTNERADDRESSES-NAME = 'Test Cust'.
PARTNERADDRESSES-STREET = '222nd AVE'.
PARTNERADDRESSES-NAME_2 = 'NEW Bldg A2'.
PARTNERADDRESSES-CITY = 'MILPITAS'.
PARTNERADDRESSES-REGION = 'CA'.
PARTNERADDRESSES-POSTL_COD1 = '950351'.
PARTNERADDRESSES-COUNTRY = 'IN'.
PARTNERADDRESSES-LANGU = 'E'.
APPEND PARTNERADDRESSES. CLEAR PARTNERADDRESSES.
it_BAPISDITMX-ITM_NUMBER = '00010'.
it_BAPISDITMX-UPDATEFLAG = 'U'.
it_BAPISDITMX-MATERIAL = 'X'.
it_BAPISDITMX-CUST_GROUP = 'X'.
append it_BAPISDITMX.
it_BAPISDITM-ITM_NUMBER = '00010'.
it_BAPISDITM-MATERIAL = '946'.
append it_BAPISDITM.
break-point.
salesd = '0000000375'.
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = salesd
ORDER_HEADER_IN = it_BAPISDH1
order_header_inx = it_BAPISDH1X
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
tables
ORDER_ITEM_IN = it_BAPISDITM
ORDER_ITEM_INX = it_BAPISDITMX
PARTNERS = it_BAPIPARNR
return = it_BAPIRET2
PARTNERCHANGES = it_BAPIPARNRC
PARTNERADDRESSES = 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 =
SCHEDULE_LINESX =
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
If sy-subrc = 0. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
. endif.
You need to sepaeately use the *Update* and *Change*  and *Insert* flags while filling the data
Thanks!
Edited by: Mr. M on Jan 9, 2009 6:23 PM

Similar Messages

  • BAPI Simulate Sales order issue

    When iam using the BAPI for sales order simulation, it is giving the netvalue of item as
    NET_VALUE  field in the item out table( Description: Net value as num. field - 00000901 equals 9,01 ). How to change that value into actual currency amount ie into vbap-netwr.
    In debugging the value is
    I_BAPIITEMOUT[1]-NET_VALUE     NUMC 15                   000000000005000.
    The actual value should be              P         12
                                   value:                       50.0000.

    Just we need to divide it by 100.
    This is standard method that will be followed by SAP standard programs also.

  • Preventing update to COPA tables for a particular Sales order type

    Hi ,
    We need to have incoming sales order transfer to COPA activated only for one particular sales order type activated.
    Earlier we implemented note 571697  for user exit to allow COPA update only for particular sales order type.
    This prevented the transfer of SO to actuals table, but off late the performance for VA01 and VA02 has decreased substantially.
    Upon checking, we found this is happening because of other CE4XXXX tables (excluding CE1XXXX) which are getting updated during creation/ change of SO. as the data in these tables is huge .
    If possible, please advise, right userexit to prevent update to these tables.
    Thanks.
    Neeraj

    Thanks for your inputs..I have few more queries on same.
    Initially we had incoming sales order activated in KEKF allong with implemented SAP note 571697, which helped us to update CE1XXXX only for a particular sales order type. This was initial requirement to have system updating COPA values only for one particular sales order type.Also, KEQ3 was also activated which resulted in updates to CE4XXXX. This was not a problem initially since we had few sales orders now that plant has grown old with more sales order (resulting in huge size of CE4XXXX) VA01 is impacted..
    Currently ,since we have KEQ3 activated so, Segment is created the moment we create sales order.. and table CE4XXXX is updated..
    As most of you have suggested to switch off sales order in KEQ3, i need to analyze the impact of this..
    From what i understand CE1XXXX will continue with updation for that order type... and CE4XXXX won't be updated in future..Please correct me if i am wrong..
    Also, please advise what all can be possible impacts on COPA reporting if I switch off from now onwards (client has been using this since long) , and what all should be the precautions that i should take while doing this.
    Thanks

  • Change pointer for Sales Order

    Hi,
    Using change pointers I want to create an IDOC when ever a specific field in the sales order line item is changed. I have activated the change pointer for message type ORDRSP. Also maintained the following entries in BD52
    VERKBELEG(Object) VBAP(Table) ABGRU(field).
    After this when I change this field at the sales order line item, it inserts entries into change pointer table.
    But my problem is creating IDOC's from those change pointer entries. I am not sure which function module (MASTERIDOC_CREATE_XXXXX) works for this.
    Anyhelp on this highly appreciated.
    Thanks
    Ram

    Hi Ram,
    I don't think so you can use change pointer for sales order changes. Usually, it is done through transaction code<b> NACE</b> - configuring condition for output type.
    You can setup requeirement in procedure control to trigger IDoc ORDRSP for any changes in item level.
    Hope this will help you and give an idea.
    Regards,
    Ferry Lianto

  • Change of open sales order : using BAPI

    Hi
       this  is ravi
                      can any one help me on this  topic
            1)change of open sales order  using BAPI .With appropriate reason( like header level reason)
                       thanks & regards

    hI,
        chk this FM BAPI_SALESORDER_PROXY_UPLOAD how the FM BAPI_SALESORDER_CHANGE was used
    Check this code,
    REPORT Z_SALES_ORDER_CHANGE
    NO STANDARD PAGE HEADING
    LINE-SIZE 132
    LINE-COUNT 65(0)
    MESSAGE-ID ZZ.
    TABLES: VBAP.
    DATA:
    V_FILEIN(90) TYPE C,
    V_RECIN TYPE I,
    V_RECVBAP TYPE I,
    V_RECORDER TYPE I,
    V_VBELN LIKE VBAP-VBELN,
    ORDERHEADERINX LIKE BAPISDH1X.
    DATA: BEGIN OF I_ORDERS OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    BRGEW(18) TYPE C,
    VOLUM(18) TYPE C,
    END OF I_ORDERS.
    DATA: BEGIN OF I_OUTPUT OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    GEWEI LIKE VBAP-GEWEI,
    BRGEW LIKE VBAP-BRGEW,
    VOLUM LIKE VBAP-VOLUM,
    CKWGT TYPE C,
    CKVOL TYPE C,
    END OF I_OUTPUT.
    DATA: BEGIN OF ORDERITEMIN OCCURS 0.
    INCLUDE STRUCTURE BAPISDITM.
    DATA: END OF ORDERITEMIN.
    DATA: BEGIN OF ORDERITEMINX OCCURS 0.
    INCLUDE STRUCTURE BAPISDITMX.
    DATA: END OF ORDERITEMINX.
    DATA: BEGIN OF RETURN OCCURS 0.
    INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF RETURN.
    DATA: BEGIN OF BAPIRETURN OCCURS 0.
    INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF BAPIRETURN.
    PARAMETERS:
    P_PATH(45) TYPE C DEFAULT '/usr/users/ftpsapom/' LOWER CASE,
    P_FNAME(32) TYPE C DEFAULT '/sweetjo.txt' LOWER CASE.
    START-OF-SELECTION.
    CONCATENATE PATH AND FILE NAME INTO ONE VARIABLE
    CONCATENATE P_PATH P_FNAME INTO V_FILEIN.
    OPEN DATASET
    IF V_FILEIN IS INITIAL.
    MESSAGE E002 WITH 'FILE' V_FILEIN 'DOES NOT CONTAIN ANY DATA!'.
    ELSE.
    OPEN DATASET V_FILEIN
    FOR INPUT
    IN TEXT MODE.
    IF SY-SUBRC = 0.
    READ DATASET
    DO.
    READ DATASET V_FILEIN INTO I_ORDERS.
    IF SY-SUBRC = 0.
    APPEND I_ORDERS.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET
    CLOSE DATASET V_FILEIN.
    IF SY-SUBRC <> 0.
    MESSAGE E002 WITH 'ERROR - CLOSING' V_FILEIN.
    ENDIF.
    ELSE.
    MESSAGE E002 WITH 'ERROR - COULD NOT OPEN' V_FILEIN.
    ENDIF.
    ENDIF.
    SORT AND REMOVE DUPLICATES FROM I_ORDERS
    SORT I_ORDERS BY VBELN POSNR.
    DELETE ADJACENT DUPLICATES FROM I_ORDERS.
    POPULATE I_OUTPUT
    LOOP AT I_ORDERS.
    SHIFT I_ORDERS-POSNR LEFT DELETING LEADING SPACE.
    CONCATENATE '0' I_ORDERS-POSNR INTO I_ORDERS-POSNR.
    SELECT SINGLE BRGEW VOLUM
    FROM VBAP
    INTO (VBAP-BRGEW, VBAP-VOLUM)
    WHERE VBELN = I_ORDERS-VBELN
    AND POSNR = I_ORDERS-POSNR.
    IF SY-SUBRC = 0.
    IF VBAP-BRGEW = 0.
    I_OUTPUT-CKWGT = 'X'.
    ENDIF.
    IF VBAP-VOLUM = 0.
    I_OUTPUT-CKVOL = 'X'.
    ENDIF.
    I_OUTPUT-VBELN = I_ORDERS-VBELN.
    I_OUTPUT-POSNR = I_ORDERS-POSNR.
    I_OUTPUT-GEWEI = 'ST'.
    I_OUTPUT-BRGEW = I_ORDERS-BRGEW.
    I_OUTPUT-VOLUM = I_ORDERS-VOLUM.
    APPEND I_OUTPUT.
    CLEAR: I_OUTPUT.
    ENDIF.
    V_RECIN = V_RECIN + 1.
    ENDLOOP.
    POPULATE BAPI DATA AND RUN BAPI
    CLEAR: ORDERHEADERINX, ORDERITEMIN, ORDERITEMINX,
    RETURN, BAPIRETURN.
    REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
    ORDERHEADERINX-UPDATEFLAG = 'U'.
    LOOP AT I_OUTPUT WHERE CKWGT = 'X' OR CKVOL = 'X'.
    V_RECVBAP = V_RECVBAP + 1.
    IF I_OUTPUT-VBELN <> V_VBELN AND SY-TABIX <> 1.
    V_RECORDER = V_RECORDER + 1.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    SALESDOCUMENT = V_VBELN
    ORDER_HEADER_INX = ORDERHEADERINX
    TABLES
    RETURN = RETURN
    ORDER_ITEM_IN = ORDERITEMIN
    ORDER_ITEM_INX = ORDERITEMINX.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'
    IMPORTING
    RETURN = BAPIRETURN.
    WRITE OUT RETURN
    LOOP AT RETURN.
    WRITE: / RETURN.
    ENDLOOP.
    WRITE: / BAPIRETURN.
    SKIP.
    CLEAR: ORDERITEMIN, ORDERITEMINX,
    RETURN, BAPIRETURN.
    REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
    ENDIF.
    ORDERITEMIN-ITM_NUMBER = I_OUTPUT-POSNR.
    ORDERITEMIN-UNTOF_WGHT = I_OUTPUT-GEWEI.
    IF NOT I_OUTPUT-CKWGT IS INITIAL.
    ORDERITEMIN-GROSS_WGHT = I_OUTPUT-BRGEW.
    ORDERITEMINX-GROSS_WGHT = 'X'.
    ENDIF.
    IF NOT I_OUTPUT-CKVOL IS INITIAL.
    ORDERITEMIN-VOLUME = I_OUTPUT-VOLUM.
    ORDERITEMINX-VOLUME = 'X'.
    ENDIF.
    APPEND ORDERITEMIN.
    ORDERITEMINX-ITM_NUMBER = I_OUTPUT-POSNR.
    ORDERITEMINX-UNTOF_WGHT = 'X'.
    ORDERITEMINX-UPDATEFLAG = 'U'.
    APPEND ORDERITEMINX.
    V_VBELN = I_OUTPUT-VBELN.
    ENDLOOP.
    RUN BAPI ON LAST ORDER
    IF NOT ORDERITEMIN IS INITIAL.
    V_RECORDER = V_RECORDER + 1.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    SALESDOCUMENT = V_VBELN
    ORDER_HEADER_INX = ORDERHEADERINX
    TABLES
    RETURN = RETURN
    ORDER_ITEM_IN = ORDERITEMIN
    ORDER_ITEM_INX = ORDERITEMINX.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'
    IMPORTING
    RETURN = BAPIRETURN.
    WRITE OUT RETURN
    LOOP AT RETURN.
    WRITE: / RETURN.
    ENDLOOP.
    WRITE: / BAPIRETURN.
    SKIP.
    ENDIF.
    WRITE OUT RECORD COUNT FROM FILE
    WRITE: / 'RECORD COUNT FROM FILE ', V_RECIN.
    SKIP.
    WRITE OUT RECORD COUNT FROM FILE
    WRITE: / 'RECORD COUNT OF LINES TO CHANGE ', V_RECVBAP.
    SKIP.
    WRITE OUT RECORD COUNT FROM FILE
    WRITE: / 'RECORD COUNT OF ORDERS TO CHANGE ', V_RECORDER.
    SKIP.
    TOP OF PAGE
    TOP-OF-PAGE.
    WRITE:/1(5) TEXT-H01, 6(8) SY-DATUM MM/DD/YY,
    100(8) TEXT-H02, 126(8) SY-PAGNO.
    WRITE:/1(5) TEXT-H03, 6(8) SY-UZEIT USING EDIT MASK '__:__:__',
    20(77) TEXT-H04,
    100(8) TEXT-H05, 108(25) SY-REPID.
    WRITE:/1(6) TEXT-H06, 8(12) SY-UNAME,
    20(4) TEXT-H07, 25(32) SY-HOST,
    100(13) TEXT-H08, 121(8) SY-SYSID,
    129 '/', 130(3) SY-MANDT.
    ULINE.
    SKIP
    <b>Reward points</b>
    Regards

  • Function module/ Bapi for Sales order change

    Hi Experts,
    I require to have a Bapi/ function module to change a existing sales order to insert value in the field VBAP-SOBKZ.
    Please suggest.
    Thanks,
    Shibaji.

    HI,
    I have identified this Bapi but this Bapi does not contain the relevant field to update. Can you suggest any other Function module/ Bapi to update the field.
    Thanks & Regards,
    Shibaji

  • How to change the characteristic value in a item of sales order by FM?

    Hi experts,
    I guess the FM BAPI_SALESORDER_CHANGE can implement my requirement. But I have made many testing program, that's all failed. I don't know which part is not correct. So could you give a very simple sample to me? Just change the characteristic value in a item of sales order, not do any change for other parts. Thanks in advanced.
    Regrads

    Hi Birendra,
    Thanks for you explain. I follow your guide to wirte abap program. But related characteristic value still not changed in SO main screen. could you give me some suggestion? Thanks a lot!
    type-pools: IBCO2,
                IBXX.
    data: l_CUOBJ type CUOBJ_VA,
          l_ibase type IBCO2_IBASE_REC,
          l_CONFIGURATION type IBCO2_INSTANCE_TAB2,
          w_CONFIGURATION type IBCO2_INSTANCE_REC2,
          l_ROOT_OBJECT type IBXX_BUSINESS_OBJECT.
    data: t_IBCO2_VALUE_TAB type IBCO2_VALUE_TAB,
          w_IBCO2_VALUE_REC type IBCO2_VALUE_REC.
    select single CUOBJ
      into l_CUOBJ
      from VBAP
      where VBELN = '0020030609'
        and POSNR = '000020'.
      CALL FUNCTION 'CUCB_GET_CONFIGURATION'
        EXPORTING
          INSTANCE                           = l_CUOBJ
        IS_BUSINESS_OBJECT                 =
        IV_MOMENT                          =
        IV_WITH_DB_INSTANCE                =
       IMPORTING
         IBASE                              = l_ibase
         CONFIGURATION                      = l_CONFIGURATION
        EO_CBASE_REF                       =
      EXCEPTIONS
        INVALID_INPUT                      = 1
        INVALID_INSTANCE                   = 2
        INSTANCE_IS_A_CLASSIFICATION       = 3
        OTHERS                             = 4
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    loop at l_CONFIGURATION into w_CONFIGURATION.
      l_ROOT_OBJECT = w_CONFIGURATION-OWNER.
    t_IBCO2_VALUE_TAB[] = w_CONFIGURATION-values[].
      read table w_CONFIGURATION-values into w_IBCO2_VALUE_REC with key ATINN = '0000000222'.
      w_IBCO2_VALUE_REC-ATWRT = 'TMP'.
      modify w_CONFIGURATION-values from w_IBCO2_VALUE_REC index sy-tabix.
      modify l_CONFIGURATION from w_CONFIGURATION index 1.
      clear: w_CONFIGURATION.
    endloop.
    CALL FUNCTION 'CUCB_SET_CONFIGURATION'
      EXPORTING
        ROOT_INSTANCE                      = l_CUOBJ
      IS_CBASE_HEADER                    =
      CHANGING
        CONFIGURATION                      = l_CONFIGURATION
    EXCEPTIONS
      INVALID_INPUT                      = 1
      INVALID_INSTANCE                   = 2
      INSTANCE_IS_A_CLASSIFICATION       = 3
      OTHERS                             = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'CUCB_CONFIGURATION_TO_DB'
      EXPORTING
        ROOT_INSTANCE                       = l_CUOBJ
        ROOT_OBJECT                         = l_ROOT_OBJECT
      FORCE_NEW_INSTANCE                  =
      IV_WITHOUT_COMMIT_UPDATE            = ' '
      IV_MATERIAL                         =
      IV_LOCATION                         =
      IV_TECHS                            =
    IMPORTING
      NEW_INSTANCE                        =
    TABLES
      EXP_NEW_NESTED_CUOBJS               =
    EXCEPTIONS
      INVALID_INSTANCE                    = 1
      INVALID_ROOT_INSTANCE               = 2
      NO_CHANGES                          = 3
      ALREADY_REGISTERED_FOR_UPDATE       = 4
      INSTANCE_IS_A_CLASSIFICATION        = 5
      OTHERS                              = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Update the price related to condtions in Sales Order

    Hi all,
    I want to update the price related to condtions in Sales Order from input file. I am using bapi 'BAPI_SALESORDER_CHANGE' to for this.
    the code for this
        wa_conditions-itm_number = wa_itab-itm_number.
        wa_conditions-cond_value = wa_itab-kbetr.
        wa_conditions-cond_type  = 'ZPSV'.
        wa_conditions-cond_count = wa_itab-kwmeng.
        APPEND wa_conditions TO it_conditions.
        wa_conditionsx-itm_number =  wa_itab-itm_number.
        wa_conditionsx-cond_count = wa_itab-kwmeng.
        wa_conditionsx-cond_value = 'X'.
        wa_conditionsx-cond_type  = 'ZPSV'.
        wa_conditionsx-updateflag = 'U'.
        APPEND wa_conditionsx TO it_conditionsx.
    But this is creating a new line in conditions instead of updating the existing line, I want to update the exsting line with new condition rate instead of creating a new line.
    i have tried by   lv_logic-pricing = 'B'.
    But it works when values are maintained in vk11.
    Please help me if you have any soultion for this.

    hi siya,
    plz refer to the following threads
    Re: problem using Bapi_Salesorder_Change
    http://www.sapfans.com/forums/viewtopic.php?p=160339&sid=bf9e3219db318d89596f7e911462416f
    i hope it helps.
    arjun

  • Change document in Sales order ( VERKBELEG )

    Hi
    We added new feild in VBAP table & the in the data element change document checkbox is also choosen .
    In the Sales order the user presses a button - a popup comes & data is selected & populated in this new feild .
    But inspite of change document being set & in the FM VERKBELEG_WRITE_DOCUMENT this data coming in data is not getting updated .Has anybody faced such problem & if so what is the solution to this
    best regards
    Deepak

    Try this, simple report... Here we check the new value of credit  status field VBUK-CMGST and if it is 'D' we know that someone used VKM* transaction to release the document. Also you need to format the sales order number with leading zeros so it occupies all 10 digits and pass it to CDHDR-OBJECTID field (and not CHANGENR field). In the below code I am using select option for sales order number, so I know it will be formatted with leading zeros and so select on CDHDR will be successful.
    *& Report  ZTV_TEST
    REPORT  ztv_test.
    TABLES: vbak, cdhdr.
    SELECT-OPTIONS: s_saldoc FOR vbak-vbeln OBLIGATORY,
                    s_udate FOR cdhdr-udate.
    RANGES: r_objid FOR cdhdr-objectclas.
    DATA: ls_cdhdr TYPE cdhdr,
          ls_cdpos TYPE cdpos.
    IF NOT s_saldoc IS INITIAL.
      LOOP AT s_saldoc.
        MOVE-CORRESPONDING s_saldoc TO r_objid.
        CONDENSE: r_objid-high, r_objid-low.
        APPEND r_objid.
      ENDLOOP.
    ENDIF.
    CHECK NOT r_objid[] IS INITIAL.
    SELECT *
      INTO ls_cdhdr
      FROM cdhdr
            WHERE objectclas = 'VERKBELEG' AND
                  objectid IN r_objid AND
                  udate IN s_udate AND
                  tcode LIKE 'VKM%'.
      SELECT SINGLE *
        INTO ls_cdpos
        FROM cdpos
          WHERE objectclas = ls_cdhdr-objectclas AND
                objectid = ls_cdhdr-objectid AND
                changenr = ls_cdhdr-changenr AND
                tabname = 'VBUK' AND
                fname = 'CMGST' AND
                value_new = 'D'.
      IF sy-subrc = 0.
        WRITE:/ ls_cdhdr-objectid(10), ls_cdhdr-username,
                ls_cdhdr-udate, ls_cdhdr-utime.
      ENDIF.
    ENDSELECT.

  • Fast change option in Sales order-Additiinal field required

    Dear al
    We want to add schedule line category field in Fast change option in Sales order as we have a requriment of changing schedule line category for more than 20 lines in sales order...After sales order is created ,we go and change the schedule line category ...
    Tried using MASS transaction but this doesn't have Schedule line category field.(VBEP table)
    Table name-VBEP
    Field name-ETTYP
    In VA05 also there is no option to change schedule line category mass update...
    Should we have to do in screen painter only for adding this field...
    Please confirm
    Regards
    Sudha

    Hi Sudha
    It would be better if you tell with which Ztable you have updated the data and how. It would be better if you share what you have done
    Regards
    Srinath

  • Order change management in Sales order(MTO Scenario)

    Dear All,
    Iam trying to map OCm functionality.How is 'Initial object' created based on changes to the direct assignment of change numbers by using direct assignment.What exactly is this?I have a sales order of 10 pc. against which a prod. order is also created for 10 pc. If there is a change in qty. of sales order from 10 pc. to 15 pc.Is it possible to refelect the same in existing Prod.Order using OCM or any other functionality.

    Hi
    order cahage management is tio track the changes made in production order .
    It is no way to update the production order with changes made in sales order.
    Regards
    YMREDDY

  • Create and Change functionality for Sales order

    Hii All,
                Can any one please suggest me any Standard program or BAPI or IDOC for Sales order, it should cover create as well as change fuctionality of Sales order.
    this is very urgent to me.
    Suitable Answer will be Rewarded.
    Thankyou,
    Shobha.

    For change you can use:
    BAPI_SALESORDER_CHANGE         Sales order: Change Sales Order
    For create you have the following choices:
    BAPI_SALESORDER_CREATEFROMDAT1 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDATA Create Sales Order, No More Maintenance
    BAPI_SALESDOCU_CREATEFROMDATA with business object 'BUS2032'
    The difference between the create ones is the functionality you get e.g. create_from_data2 is the 'most powerful' but you also have to provide the most data. It just depends on what you want it to do.
    In terms of IDOCS:
    message type:
    SALESORDER_CREATEFROMDAT201 or
    SALESORDER_CREATEFROMDAT202 or
    ORDERS05
    Hope that helps,
    Michael
    Here is an example we use, you might want to populate additional fields or leave fields out in case you want different data to be transferred to the IDOC - however some fields are mandatory.
    create the order header structure
      ls_header-doc_type   = ls_screen-order_type.
      ls_header-sales_org  = gc_vkorg_aa01.
      ls_header-distr_chan = gc_distr_aa.
      ls_header-division   = gc_divis_aa.
      ls_header-purch_no   = ls_screen-po_num.
      ls_header-po_method  = ls_screen-po_source.
      ls_header-ship_cond  = ls_screen-ship_cond.
    create partner input table (sold to)
      ls_partner-partn_role = gc_role_sold.
      ls_partner-partn_numb = ls_screen-sold_to.
      APPEND ls_partner TO lt_partner.
    create partner input table (ship to)
      ls_partner-partn_role = gc_role_ship.
      ls_partner-partn_numb = ls_screen-ship_to.
      APPEND ls_partner TO lt_partner.
    items are added by looping at a table
        ls_item-material = <fs_upload>-matnr.
        ls_item-req_qty  = <fs_upload>-quantity.
      process the quantity, it needs to be three decimals, because it
      will be moved into a string in the BAPI and divided by 1000 before
      it is moved back into a number field (1.500 => 001500 => 1.5)
        ls_item-req_qty = ls_item-req_qty * 1000.
      truncate remaining decimal places if exist (1.2525 => 1252.5 => 1252 => 1.252)
        ls_item-req_qty = trunc( ls_item-req_qty ).
        price is taken from the file
          ls_item-cond_type = gc_cond_so_upld_price.
          ls_item-cond_val1 = <fs_upload>-price.
        condition one (price) is multiplied by 10 in the BAPI
          ls_item-cond_val1 = ls_item-cond_val1 / 10.
        no discount
          ls_item-cd_type2   = gc_cond_so_upld_disc.
          ls_item-cd_value2  = 0.
        ls_item-item_categ = ls_screen-item_cat.
          APPEND ls_item TO lt_item.
    then BAPI is called
      CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA'
        EXPORTING
          order_header_in           = ls_header
          business_object           = gc_bus_obj
        IMPORTING
          SALESDOCUMENT             = lv_vbeln
          RETURN                    = ls_return
        tables
          order_items_in            = lt_item
          order_partners            = lt_partner.
      IF ls_return-type NE gc_msgty_error AND
         ls_return-type NE gc_msgty_abend.
      No errors where found
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ELSE.
      There was an error or abend
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ENDIF.

  • Change status for sales order in crmd_order

    Hi,
    I am creating a report which has to change for all sales order with status "Open" to status "Processed". Is there any function or bapi to do this ?? Supposing, there is no function, which tables do i have to change ???
    thanks in advance!!!
    Maria

    Mmmm it doesn't work... I have tried this:
        CALL FUNCTION 'CRM_STATUS_CHANGE_EXTERN_OW'
          EXPORTING
      CHECK_ONLY                = ' '
            OBJNR                     = i_crmd_orderadm_h-guid
            USER_STATUS               = 'I1003'
      SET_INACT                 = ' '
      IV_REF_KIND               =
      IV_OBJECT_TYPE            =
      IV_NO_1O_MAINTAIN         =
    IMPORTING
      STONR                     =
    EXCEPTIONS
       OBJECT_NOT_FOUND          = 1
       STATUS_INCONSISTENT       = 2
       STATUS_NOT_ALLOWED        = 3
       OTHERS                    = 4.
    If sy-subrc = 0.
    endif.
    But noting has change in tag Status in tx. CRMD_ORDER.. still have in "system status": In process and in "User status": Order Rep Processed.
    Thanks in advance !!!

  • Trigger partner determination when ship-to is changed on the sales order

    Hi,
    Here is my scenario...
    I am defaulting my rail carrier partner function based on the ship-to party partner function into the sales order using the standard configuration i.e. by maintaining SH as entry in the "source" field for rail carrier partner function of the sales document partner determination procedure. Every thing is fine until the ship-to party in the order is not changed by the user. when the user changes the ship-to party the carrier is not re-determined (the old rail carrier partner function which defaulted into the order from the old ship-to party record stays in the document). I know standard SAP doesn't re-determine partners. Can anyone came accross this issue?
    I would like to know if there is an user exit that i could use and write a code to trigger parter determination when a ship-to partner is changed in the sales order.
    -Sree.
    Edited by: SREE on Sep 15, 2008 4:40 PM

    Hi,
    Try to use user exit FORM USEREXIT_SAVE_DOCUMENT_PREPARE in program MV45AFZZ.
    Regards,

  • Program for mass change in the sales order.

    Hi,
      I have a requirement where If we make changes in  the availability check rule of the material master(for e.g. 02 to 01),then the same rule should be changed in the sales order as well.
      Though this will be changed for the new orders but is there any program which we can run manually or in the background in order to make changes in the old sales orders.
    Regards
    Karan

    Hi,
            U cannot change checking group or checking rule for availabillity check at sales order level, u can change requirements type.
            If u want to change requirements type determined into sales orders, which  r already created go to t.code MASS and select the object type sales orders and press execute, select sales order item data on tables tab,and select requirements type on fields tab and press execute.specify sales documents number from and to and item numbers, and press execute and specify the new value and press carryout mass change button and then save.
    with regards,
    kirankumar vemula

Maybe you are looking for