Updating a Salesorder at Item level

Hi All
I am trying to update a saleorder at item level(order quantity field) thru the function module BAPI_SALEORDER_CHANGE. I have 3 items in my saleorder. I am able to update the first item but I am unable to update the schedule_lines-req_qty(order quantity field) of the second and third item.
Can anyone plz suggest me how 2 overcome this prob.??
Thanks in Advance
Vijay.

Hi Kevin
Here is the code you were asking for.  I will repeat my problem.  The prob is: I am able to update the first item level but I am unable to update the req_qty field of the subsequent item levels.
Expecting an early reply.....
CODE:
data: salesdocument like bapivbeln occurs 0 with header line,
      order_header_in like bapisdh1 occurs 0 with header line,
      order_header_inx like bapisdh1x occurs 0 with header line,
      order_item_in like bapisditm occurs 0 with header line,
      order_item_inx like bapisditmx occurs 0 with header line,
      partners like bapiparnr occurs 0 with header line,
      schedule_lines like bapischdl occurs 0 with header line,
      schedule_linesx like bapischdlx occurs 0 with header line,
      partnerchanges like BAPIPARNRC occurs 0 with header line,
      return like bapiret2 occurs 0 with header line.
data : pur_ord_no like vbkd-vbeln.
parameters : puro_num like vbkd-bstkd.
start-of-selection.
*Retrieving salesorder number by passing the purchase order number.
select single vbeln from vbkd into pur_ord_no where bstkd = puro_num.
salesdocument-vbeln = pur_ord_no.
append salesdocument.
order_header_inx-updateflag = 'U'.
order_header_inx-sales_org = 'X'.
order_header_inx-distr_chan = 'X'.
order_header_inx-division = 'X'.
order_header_inx-sales_off = 'X'.
order_header_inx-purch_no_c = 'X'.
order_header_inx-req_date_h = 'X'.
order_header_inx-purch_date = 'X'.
append order_header_inx.
order_header_in-sales_org = 'JNJ1'.
order_header_in-distr_chan = '02'.
order_header_in-division = 'J1'.
order_header_in-sales_off = 'JNJ1'.
order_header_in-purch_no_c = 'XMLFileUpload6'.
order_header_in-purch_date = '20060101'.
order_header_in-req_date_h = '20060202'.
append order_header_in.
*partnerchanges-itm_number = '000030'.
*partnerchanges-updateflag = 'X'.
*partnerchanges-partn_role = 'AG'.
*partnerchanges-p_numb_old = '0000000011'.
*partnerchanges-p_numb_new = '0000000011'.
*append partnerchanges.
order_item_inx-updateflag = 'U'.
order_item_inx-material = 'X'.
order_item_inx-plant = 'X'.
order_item_inx-itm_number = '000020'.
append order_item_inx.
schedule_linesx-updateflag = 'U'.
schedule_linesx-req_qty = 'X'.
schedule_linesx-itm_number = '000020'.
SCHEDULE_LINESx-SCHED_LINE  = '0001'.
append schedule_linesx.
order_item_in-itm_number = '000020'.
order_item_in-material = '000000000000000877'.
order_item_in-plant = 'JNJ1'.
append order_item_in.
schedule_lines-sched_line = '0001'.
schedule_lines-itm_number = '20'.
schedule_lines-req_qty = 64.
append schedule_lines.
Calling the function module updating the salesorder.
call function 'BAPI_SALESORDER_CHANGE'
  exporting
    salesdocument               = salesdocument
    order_header_in             = order_header_in
    order_header_inx            = order_header_inx
  SIMULATION                  =
  BEHAVE_WHEN_ERROR           = ' '
  INT_NUMBER_ASSIGNMENT       = ' '
  LOGIC_SWITCH                =
  tables
    return                      = return
    order_item_in               = order_item_in
    order_item_inx              = order_item_inx
  PARTNERS                    =
   PARTNERCHANGES              = 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              = schedule_lines
    SCHEDULE_LINESX             = schedule_linesx
  ORDER_TEXT                  =
  ORDER_KEYS                  =
  CONDITIONS_IN                = conditions_in
  CONDITIONS_INX               = conditions_inx
  EXTENSIONIN                 =
    if sy-subrc ne 0.
      write: return-message,return-number,return-type.
    else.
      write: return-message,return-number,return-type.
      call function 'BAPI_TRANSACTION_COMMIT'
       EXPORTING
         WAIT          =
         IMPORTING
         RETURN        =
    endif.
Thanks,
Vijay.

Similar Messages

  • Updating a Saleorder at Item Level

    Hi All
    I am trying to update a saleorder at item level(order quantity field) thru the function module BAPI_SALEORDER_CHANGE.  I have 3 items in my saleorder.  I am able to update the first item but I am unable to update the schedule_lines-req_qty(order quantity field) of the second and third item.
    Can anyone plz suggest me how 2 overcome this prob.??
    Thanks in Advance
    Vijay.

    Hi All
    I am trying to update a saleorder at item level(order quantity field) thru the function module BAPI_SALEORDER_CHANGE.  I have 3 items in my saleorder.  I am able to update the first item but I am unable to update the schedule_lines-req_qty(order quantity field) of the second and third item.
    Can anyone plz suggest me how 2 overcome this prob.??
    Thanks in Advance
    Vijay.

  • User Exit for Updating Delivery Plant at Item Level in Sales Order

    Hello Experts
    There is a requirement to determine the delivery plant for each item level and than update the items with newly determined plant.  There is a user exit MV45AFZZ routine FORM USEREXIT_MOVE_FIELD_TO_VBAP. to update the item level entries in Sales Order in VA01 or VA02. Is this the right place to do this?, if yes , do i need to perform any other standard logic (like re determine Shipping points , schedule lines ) for newly determined plant? If not , can you please suggest any other place , BADI or user exit to change the delivery plant of sales order.
    Thanks a lot....
    -Harkamal

    Best place is MV45AFZZ-USEREXIT_SAVE_DOCUMENT_PREPARE. Populates the values just before saving the document. You can have your own deriving logic. Make sure that peice of code is trigger only for Sales Order create or change (VA01/VA02).
    Are you kidding???  You do realize that this is AFTER all validations against configuration, ATP, pricing, etc. have been performed??!!!  Never, ever change a critical value like plant in the SAVE user exits...

  • Incoming Order IDOC - updating VBKD-IHREZ_E at item level

    Hi all,
    I am trying to update field VBKD-IHREZ_E at item level from an incoming Idoc with no success yet.
    Here is first exit to store requested data from the idoc ZXVEDU03
    IF segment-segnam =  'E1EDP19'.
        xvbap = dxvbap.
        MOVE segment-sdata TO lo_e1edp19 .
        IF lo_e1edp19-qualf = '001'.
          xvbap-ihrez_e = lo_e1edp19-idtnr.
          dxvbap = xvbap.
        ENDIF.
    ENDIF.
    Here is second exit to update the sales order field ZXVEDU04:
    CASE dlast_dynpro.
      WHEN '4002'.
    WHEN '4003'.
        READ TABLE dxbdcdata WITH KEY fnam = 'VBKD-IHREZ_E'.
        IF sy-subrc NE 0.
         DATA wa_tabix TYPE syst-tabix.
          MOVE sy-tabix TO wa_tabix.
         DATA wa_dxbdcdata TYPE bdcdata.
          MOVE 'VBKD-IHREZ_E' TO wa_dxbdcdata-fnam.
          MOVE zzxvbap-ihrez_e TO wa_dxbdcdata-fval.
          INSERT wa_dxbdcdata INTO dxbdcdata INDEX wa_tabix.
        ENDIF.
      ENDIF.
    ENDCASE.
    Field is not updated in sales order. I tried to put the same logic at header lever (dynpro 4002) and it does work (though all items have the same value)
    If a good soul could help, it would be very much appreciated.
    regards,
    Bruno
    Edited by: Bruno Monconduit on Mar 8, 2011 1:08 PM

    Hi all,
    actually I had to add some extra logic in the exit to go update IHREZ_E in another dynpro 5003.
    Hereafter code implemented (works fine)
    Regards,
    Bruno
    WHEN '5003'.
            DATA: lt_vbap LIKE xvbap.
            lt_vbap = dxvbap.
    changing screen to update field
            PERFORM dynpro_setzen IN PROGRAM saplveda
            USING 'BDC_OKCODE' '=T\11'.
           PERFORM dynpro_new(saplveda) USING programm_auftrag
           '4003' CHANGING dlast_dynpro.
            PERFORM dynpro_setzen IN PROGRAM saplveda
            USING 'BDC_OKCODE' '=/00'.
            PERFORM dynpro_setzen(saplveda) USING 'VBKD-IHREZ_E'
            lt_vbap-ihrez_e.
            PERFORM dynpro_setzen IN PROGRAM saplveda
            USING 'BDC_OKCODE' '=T\06'.
    back to screen 5003
            PERFORM dynpro_new IN PROGRAM saplveda
                               USING 'SAPMV45A'
                                        '5003'
                               CHANGING last_dynpro.
           PERFORM dynpro_setzen IN PROGRAM saplveda
           USING 'BDC_OKCODE' '/EBABA'.
    Edited by: Bruno Monconduit on May 25, 2011 6:32 PM

  • Updating Ekpo by adding item level Screen Exit

    Hi,
    I added 2 fields at the item level of the ME21N  Screen using the following screen exit.
    ( SAPMM06E 0111 CUSTSCR1 SAPLXM06 0111 Subscreen: PO item. )
    Now I just want to update EKPO table.,. How to proceed. any body know guide me.
    Thanks & Regards.
    Balajee.J

    Hi Mou,
    In this there are four methods
    1)ACTIVATE_TAB_PAGE
    2)TRANSFER_DATA_TO_SUBSCREEN
    3)TRANSFER_DATA_FROM_SUBSCREEN
    4)PASS_FCODE_TO_SUBSCREEN
    In thw first method pass the tabname,screen no,position all.
    fcaption = 'C Form Details'.
    fprogram = 'Z_VLO1N_HEAD'.
    fdynpro = '0200'. This is the screen created and kept all custom fields
    Here you the concept set and get data and move and get the values.
    TRANSFER_DATA_TO_SUBSCREEN
    set PARAMETER ID 'Z' FIELD  f_vbrk-ZCF.
    TRANSFER_DATA_FROM_SUBSCREEN
    get PARAMETER ID 'Z' FIELD   fvbrk-ZCF.
    Pass all these parameters it will resolve your issue.Check and post if need help.
    Regards,
    Madhu.

  • Updating Administrators(built-in) with item-level targeting on an enforced policy

    I need help with this. 
    In our Computers OU, we have an enforced GPO with a computer policy that adds local admins to the computers on our network. The policy is Computer Configuration >> Policies >> Windows Settings >> Security Settings >> Local Policies/User
    Rights Assignment >> Restricted Groups >> Group (BUILTIN\Administrators). For this example, we'll call this GPO #1.
    I need to add another user account as a local admin, but targeted to certain computers.
    I tried to edit GPO #1. I went into Computer Configuration >> Control Panel Settings > Local Users and Groups, and then added a Group with the settings >> Updating >> Administrators (built-in) & item-level targeting to the computers
    I wanted, but the setting always gets over-written by the setting that adds local admins. 
    I then tried to create a GPO with the Group update. Lets call this GPO #2. I enforced this rule, linked it to the OU, changed the order so that GPO #2 is above GPO #1, but this doesn't seem to be working.
    Is my inheritance order incorrect?
    1 is GPO #2
    2 is GPO #1
    Ideas anyone?

    > In our Computers OU, we have an enforced GPO with a computer policy that
    > adds local admins to the computers on our network. The policy is
    > Computer Configuration >> Policies >> Windows Settings >> Security
    > Settings >> Local Policies/User Rights Assignment >> Restricted Groups
    >  >> Group (BUILTIN\Administrators).
    Restricted Groups has 2 operation modes: Members and Member of. The
    first one clears out any existing members, and that's what you use right
    now. The second simply adds a group to another group and keeps all
    existing members, that's what you want to use for your additional computers.
     > I need to add another user account as a local admin, but targeted to
     > certain computers.
    To do so, you need to create a domain group that contains the related
    account(s). This domain group is "member of" local admins. And make sure
    this second GPO is linked higher (so it is processed _after_ the first
    one that clears out existing members).
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))
    Yes I know I can do this, but I can't use item-level targeting with this setup. I don't want the user account to be local admins for all computers. I only want it to be local admins for 4 of them.
    Wouldn't precedence take place in this OU if I have the GPO that adds another member as #1, and the GPO that deletes and adds as #2? It isn't working as I had thought it would.

  • Problem while updating notification at ITEM level ?

    Hi...
    I am doing an LSMW to update certain notifications at item level.
    The Function module which i am using for this purpose is ..
    IQS4_MODIFY_NOTIFICATION
    While updating the first line item of notification, it is successfully updated, but while updating the second line item of the notification and further line items, error is thrown stating .....
    "Notification is locked by the user"
    I want to release this lock of notification after every change in line item. How do i do this.
    Regards.
    Edited by: Akshay Raj on Oct 16, 2008 8:32 AM
    Edited by: Akshay Raj on Oct 16, 2008 8:43 AM

    Use userexit save_document_prepare in MV45AFZZ .
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Jun 12, 2008 6:51 PM

  • Item level parcel Tracking with external carriers through AII

    Hi folks,
    I am new to AII and am trying to explore the possibilities with the tools at hand.
    With flexible delivery processing, we have tight control over the goods statuses across customer and supplier. For example, EM would let the customer know that the goods left the warehouse and are on their way.
    Suppose I would like to integrate this information with the parcel tracking service of external carriers. The web services and web based tools such carriers offer are surprisingly immature. Some "global" companies are not able to provide seamless information, every carrier has their own standard and some do not provide public interfaces which could be used for customer-level tracking in a useful way (eg requiring authentication credentials of the warehouse clerk requesting the delivery).
    I am wondering whether AII could be enabled to orchestrate this information flow. If an appropriate EDI format would exist, the carriers could be requested to update AII on shipment item level with any new statuses through EDI. Now it's up to the supplier to present the information to the customer as need be. This would remove inconsistencies as mentioned above.
    Does this sound like a viable idea, are there EDI messages available for the task at hand and do you know of companies having successfully implemented something like this?
    cheers & thanks,
    Andi

    Hi Amit,
    thanks for trying to tie in!
    You are right in assuming that I mixed up the purpose of AII and EM. This is about making EDI-based information accessible to all partners involved, and therefore a case for EM.
    Probably it helps if I re-state my thoughts. The supplier sends an ASN to the goods recipient. Afterwards, the goods are transported by a logistics provider based on a transport order. Question is, how can the intermediate delivery statuses of the provider be captured and published? Web UIs of the Providers with a tracking URL seem a very unreliable way of doing it.
    I figured that IDoc IFTSTA seems to be the correct form for this kind of information to flow back from the carrier to the supplier and from there to the recipient.
    Does it seem to be a viable option to  incorporate the carrier data into EM for tracking purposes?
    Cheers & Thanks, Andi

  • Header data not getting updated in line item level

    Hi,
    We are trying to update Pricing date at header level but it is not gettting copied to item level.
    getting an message "The header business data does not apply to item xxxx"
    i have checked the item category and "business item" field is checked. and for the same sales order previously we were able to change the pricing date at header level and it got applied to item level but this time is is not getting applied.
    kindly suggest.

    If there are multiple line items which are having different data; in your case, Pricing Date, then in that case, when you try to change at header level, system will pop up this message.
    You can also have a look at the following note:-
    Note 336660 - Message V1403 in sales order with article order no
    G. Lakshmipathi

  • How to update item level Pricing  in CRMD_ORDER

    guys
    i am using FM : CRM_ORDER_MAINTAIN to update many fields in CRMD_ORDER t-code
    except for the Conditions Tab in item level i am able to update other fields...
    here is my code please let me know if i am missing something.....
    data: IT_PRIDOC TYPE CRMT_PRIDOC_COMT ,
            WA_PRIDOC TYPE CRMT_PRIDOC_COM,
            IT_COND_ADD TYPE PRCT_COND_EXTERNAL_INPUT_T ,
            WA_COND_ADD TYPE PRCT_COND_EXTERNAL_INPUT.
    *********FILL IT_PRIDOC
    Item Level Conditions Tab
    WA_PRIDOC-REF_GUID = WA_ORDERADM_I-GUID.
    WA_PRIDOC-REF_KIND = 'B' .
    wa_cond_add-KSCHL = '0PSV'.
    wa_cond_add-kbetr = '333.00'.
    wa_cond_add-kpein = '1'.
    INSERT wa_cond_add INTO TABLE it_cond_add.
    CLEAR wa_cond_add.
    WA_PRIDOC-COND_ADD = it_cond_add.
    CLEAR it_cond_add[].
    INSERT WA_PRIDOC INTO TABLE IT_PRIDOC .
    CLEAR WA_PRIDOC .
    *********FILL IT_INPUT_FIELDS
    WA_INPUT_FIELDS-REF_GUID = WA_ORDERADM_I-GUID.
    WA_INPUT_FIELDS-REF_KIND = 'B' .
    WA_INPUT_FIELDS-OBJECTNAME = 'PRIDOC'.
    even if v debug by putting break-poing on CRM_ORDER_MAINTAIN and do some changes in the pricing values .. the FM showes no changes in debug mode but values will be updated...
    expecting expert comments .
    Amshu

    i missed Handlers .. its working

  • Update Purchase order number in Sales order item level from inbound ORDCHG iDoc

    Hi Gurus,
    I want to update purchase order number from the iDoc 'ORDCHG' to sales order item level (sold to party purchase order number) i.e, VBAK-BSTKD.
    Which exit I need to use?  where to update?  Can you please help.
    Thank you in advance.
    Regards,
    San

    Finally Resolved the problem by writing 2 exits.
    one exit 'EXIT_SAPLVEDB_007'  for identify correct item in the sales order by updating the customer purchase order item number i.e., VBAP-POSEX.  if we update the POSEX field then it wont create new item instead, it will update the item which it is referring to .
    2nd exit for updating the purchase order number. 
    I have tried to pass the program name, screen number, field name, field value etc to bdcdata in the exit 'EXIT_SAPLVEDB_002'. but I observed that it is not going to that screen in the debugging.
    when I try E1EDP02 with QUALF '044' it will update ship-to party's purchase order number.  so to update ship-to party's purchase order number it is going to that screen. 
    so I have used that thing to update purchase order number in sold-to party's purchase order number.
    so when it is going that screen iam changing the field name 'VBKD-BSTKD_E' to 'VBKD-BSTKD' in bdcdata.  Then it is worked.
    This is the solution I found in my time.
    Any way it is solved.  Hope it will be helpful for others who will get this problem.

  • Updating VBKD at item level in User_exit_move_field_to_vbkd.

    Dear All,
    I saw several posts on the table VBKD and understand that business data is stored at header level normally with
    posnr = 00000  , until unless atleast once a change is made at item level in atleast one of its field.
    So Can we use Form User_exit_move_field_to_vbkd to update a field say shipping type (VSART) at item level ?
    As far as I've seen we don't get the item no in XVBKD and once i was  trying to update one such field at item level, it updated VBKD table but then I started getting weird messages when I used to open Sales order that Business header & Item Data not match.
    Please suggest, if this is a appropriate user exit if i want to update shipping type (VSART) at SO item level .
    Thanks in advance for help,
    Manu Parihar

    Use userexit save_document_prepare in MV45AFZZ .
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Jun 12, 2008 6:51 PM

  • FM for Updating Installation date in Contracts + sales orders Item level

    Hi
    Plesae give any FM for Updating Installation date in Contracts + sales orders Item level for contracts tab.
    Thanks and Regards,
    Vishnuvardhan....

    Have used the billing transaction to set a Default Billing date at time of blling.

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

  • Incoterms on Item level is not updated on STO.

    Issue: they have created a STO with wrog incoterm, now the issue is that the Incoterms on PO--> Item level is not updated if Incoterms on Header level is changed. I suggested them to change incoterm on item level manually, but user is saying the problem is that SAP doesn't change automatically Incoterms on item level if Incoterms on Header level are changed??
    What user is saying..Is this correct? or any thoughts/solution to fix this issue?
    Can anyone suggest me on this?
    Thanks & Regards
    Suresh Babu

    HI,
    Try this link
    How Incoterms gets defaulted for STO
    Regards
    KK

Maybe you are looking for

  • Express does not reconnect after reboot of Extreme

    My extreme is conencted (via ethernet) to my router (bridge mode) My Express is connected to Extreme to expand wireless network (bridge mode) However when i reboot the extreme, the Express is no longer visible I have to reboot as well. is this normal

  • Created searchBean map and stored on session fail!

    Hi : I met a problem while entering a jsp page , seems like its "Created searchBean map and stored on session" was missing , and not every time I can produce this error , it happened dynamically. Any idea about this ? ================================

  • Afp connecting

    Hi .. I have a "Afp can't connect" message at startup ... at sometime, I guess, I've asked to connect to my PBook from my desktop and now don't seem to be able to get rid of this message ... anyone any ideas please ? Many thanks Roger

  • Unable to read sequence number

    I get that error message in the inventory log. I have Netware 6 patch level 5, and ZFD 4.01b. Has anyone seen this, and know how to fix it? Thank you in advance.

  • Problem displaying output

    Hi, Below is my JSP code fragment: <% StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(new BufferedWriter(sw)); XMLDocument doc = domparser.getDocument("/html/jsp/SubMarket.xml"); InputStream styleSource = getClass().getResource