Problem in CRM_ORDER_MAINTAIN for updating amount in line items

Hi abapers,
I have  a scenario as follows: i want to update amount  for line items  in a transaction. i use the bapi crm_order_maintain followed by CRM_ORDER_SAVE and bapi transaction _commit . The problem is i loop the itab by passing the trnstn id , prdct code  and new amount.
i applied the logic as given by rita tan (thread no 4)
link:[Re: Update Pricing Document with CRM_ORDER_MAINTAIN]
as per the logic i delete the existing value and insert the new amount . this works fine in the first  loop and in second loop it deletes the existing record but does not insert the new value . It doesn't even give error too. what may be the problem.
here's a snapshot of the code i have written:
loop at itab.
SELECT SINGLE * FROM CRMD_ORDERADM_H
          WHERE OBJECT_ID = WA_ZCMR_UPDATE-Z_OBJECTID
          AND PROCESS_TYPE = P_TYPE.
                SELECT SINGLE * FROM CRMD_ORDERADM_I
              WHERE HEADER = CRMD_ORDERADM_H-GUID
              AND ORDERED_PROD = WA_ZCMR_UPDATE-PRODUCT_CODE.
              SELECT SINGLE * FROM CRMD_LINK
                WHERE GUID_HI = CRMD_ORDERADM_H-GUID
                AND OBJTYPE_SET = '18'.
                SELECT  * FROM  PRCD_COND
                  INTO CORRESPONDING FIELDS OF TABLE IT_PRCD_COND
                  WHERE KNUMV = CRMD_LINK-GUID_SET
                  AND KPOSN = CRMD_ORDERADM_I-GUID
                  AND KSCHL = 'ZR12'.
                  READ TABLE IT_PRCD_COND
                  INTO WA_PRCD_COND INDEX 1.
                    DELETE  FROM PRCD_COND
                    WHERE KNUMV = WA_PRCD_COND-KNUMV
                      AND KPOSN = WA_PRCD_COND-KPOSN
                     AND KSCHL = 'ZR12'.
                      COMMIT WORK.
                      WA_PRIDOC-REF_HANDLE = '0000000001'.
                      WA_PRIDOC-REF_GUID = CRMD_ORDERADM_I-GUID.
                      WA_PRIDOC-REF_KIND = 'B' .
                      WA_COND_ADD-KSCHL = 'ZR12'.
                      WA_COND_ADD-KBETR = WA_ZCMR_UPDATE-NET_VALUE.
                      WA_COND_ADD-KPEIN = '1'.
                      WA_COND_ADD-WAERS = 'INR'.
                      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 .
                      WA_CT_INPUT_FIELDS1-REF_HANDLE = '0000000001'.
                     WA_CT_INPUT_FIELDS1-REF_GUID = CRMD_ORDERADM_I-GUID.
                      WA_CT_INPUT_FIELDS1-REF_KIND = 'B' .
                      WA_CT_INPUT_FIELDS1-OBJECTNAME = 'PRIDOC'.
                     INSERT WA_CT_INPUT_FIELDS1  INTO TABLE IT_CT_INPUT_FIELDS1.
                      CLEAR WA_CT_INPUT_FIELDS1.
                      AT END OF Z_OBJECTID.
                        CALL FUNCTION 'CRM_ORDER_MAINTAIN'
                          EXPORTING
                            IT_PRIDOC         = IT_PRIDOC
                          CHANGING
                            CT_INPUT_FIELDS   = IT_CT_INPUT_FIELDS1
                          EXCEPTIONS
                            ERROR_OCCURRED    = 1
                            DOCUMENT_LOCKED   = 2
                            NO_CHANGE_ALLOWED = 3
                            NO_AUTHORITY      = 4
                            OTHERS            = 5.
CALL FUNCTION 'CRM_ORDER_SAVE'
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
endat.
endloop.
Please help out.
Regards,
Navin
Edited by: navin.c on Jan 7, 2010 10:09 AM

Check the link below. This should help
Re: Change Order Quantity in CRM Sales Order

Similar Messages

  • Problem in CRM_ORDER_MAINTAIN for updating qty in more than 1 line item .

    Hi abapers,
    I am using BAPI CRM_ORDER_MAINTAIN to update quantity. Its updating the quantity properly if there is single line item for a transaction .If more than 1 line item is there then its throwing an exception* "Document is being distributed - changes are not possible"*.
    Scenario:
    I have a itab  which is having 2 line items for a transaction. i run a loop pass the pass the required parameters in CRM_ORDER_MAINTAIN ,do CRM_ORDER_SAVE , BAPI_TRANSACTION_COMMIT for the 1st line item. When i run the 2nd loop, in  CRM_ORDER_MAINTAIN it gives an exception saying NO_CHANGE_ALLOWED for the same transactions 2nd line item. leaving the quantity unchanged for both the line items. What may be the problem?
    Note: We cannot say how many line items are there for an transaction. so no chance of grouping all items at a time and saving at a time.
    Regards,
    Navin

    Hi Navin,
    Why its not possible to use CRM_ORDER_SAVE only once. I think its possible. Call CRM_ORDER_MAINTAIN in loop for all the line item in transaction and after that call CRM_ORDER_SAVE once. Pls follow the below sample code.
    loop at it_item.
    call CRM_ORDER_MAINTAIN. (Here append data for all the line items and miantin the transaction).
    emdloop.
    After endloop call CRM_ORDER_SAVE. Also you can add some wait after CRM_ORDER_SAVE, In order to avoid locking issue.
    PLs let me know where you are trying to use CRM_ORDER_MAINATIAN ? In any BADI or Z program ?
    Regards,
    Amol.

  • MIRO - Business Area not getting updated in Vendor Line item

    Hello friends,
    I am posting Vendor invoice in MIRO transaction.
    After Posting if i see the financial document generated,
    Business area has not got updated in Vendor Line item.
    What could be the problem ?
    Please help me out.
    Hari Prasath

    Hi Kale,
    Make sure the field Business area is not supressed in tx. OB14. for the GL account in line item 001.
    On the other hand, have a look to the note and kba below:
    41294 - Business area in customer/vendor item
    Kba 1727802 - Business area not getting populated in sales/ purchase tax

  • Partial goods receipt for PO with multiple line items

    Hello All,
    While doing MIGO, for a PO with multiple line items, if one line item is having error, will we be able to go ahead with goods receipt? Or entire material document is blocked for doing MIGO?
    We will be doing a development - in case if there is problem in goods receipt (checking of any parameter, and if it is missing - we will be posting error message)...is it possible to ahead with next line item and still post the material document?
    If partial goods receipt if possible for PO with multiple line items, how do we do it?
    Regards,
    RJS

    Hi
    While doing MIGO, for a PO with multiple line items, if one line item is having error, will we be able to go ahead with goods receipt? Or entire material document is blocked for doing MIGO?
    No. You cannot post the MIGO, if even one of the PO line item is having problem or giving error.
    We will be doing a development - in case if there is problem in goods receipt (checking of any parameter, and if it is missing - we will be posting error message)...is it possible to ahead with next line item and still post the material document?
    If you skip a line irem and do GR with next line item, how will you match quantity & value with the vendor Invoice at LIV ?
    If partial goods receipt if possible for PO with multiple line items, how do we do it?
    Partial goods receipt is possible for PO line items. That means, if PO has 100 qty for line item 1 then you can do GR for 50 now and 50 later depending on the vendors delivery.
    Hope this is what you mean by "Partial Goods Receipt".
    Edited by: Arun R on May 10, 2010 2:03 PM

  • User defined Characterestics not being updated in actual line items

    Gurus!
    I am using Accounting Based COPA only.
    I have defined a user based characteristic for which I am using user exit to derive.
    However, this charaterstic is not getting updated in actual line items.
    The derivation is working correctly at Sales order and Invoicing documents. (account assignment tab).
    Where could I be going wrong??
    Regards
    Saurabh

    Hi,
    Please check the settlement rule of the sales order and check whether the relevant characteristics have been maintained in the settlement rule of PSG. If not, you may have to include the same.
    Trust this helps much.
    Cheers

  • Delivery Qty Zero for STO with 2 line item

    Hi Guys,
    I have a problem when create delivery for STO with 2 line item which contain material with BOM. I have create delivery with tcode VL10G refer to Purchase Order and Delivery successfully created, but delivery qty was zero or empty. I try to fill the dlv qty same with STO Qty but  popup message "Only 0 PC for the material available", I have check the stock and there is a stock exist for the material.
    I need help for this problem.
    Regards
    Gunawan

    Hi,
    Please check if inbound delivery is already created for that Qty
    Thanks
    Diwakar

  • Surcharge on Net not update in PO line item

    Hi,
      we had a problem in Surcharge on Net calculated as per condition value.  Some PO,s Surcharge+ Net value update in PO line item, some PO's not updating.
    I have checked all the configuration part. Validity periods maintained upto 9999.
    Info records valid, Vendor valid.
    Please help me.
    Regards,
    Sridhar

    Hi,
    I have checked EKPO table and I found  If Surcharge on net calculated then Item effects commitment filed (XOBLR) Updated. Otherwise surchage on net failure to calculate XOBLR not update in Table level.
    Is there any way to update XOBLR field?
    Regards,
    Sridhar

  • How to Restrict Single Delivery Date for PO with Multiple Line Items

    Dear Experts,
    How to Restrict Single Delivery Date for PO with Multiple Line Items.
    System needs to through Error Message if User Inputs Different Delivery Dates for PO with Multiple Line Items in ME21N Tcode.
    Can we achive this by Some Enhancement in SAP or Not ???
    If so how to do it.
    Any Inputs is highly appreciated.
    Thanks and Regards,
    Selvakumar. M

    Hi Selvakumar,
    we can resrict the PO to have a single delivery date in all the line items by means of giving a error message or overwiting the delivery date keyed/determined in the line item.
    You can use the BADI -> ME_PROCESS_PO_CUST. In which you need to implement the method PROCESS_SCHEDULE.
    (for technical aid - This method will be called for each and every PO line item, From the imporing parameter im_schedule we can get all the details of current PO line, even we can change the data in the current PO line. )
    Regards,
    Madhu.

  • How to Find Out The Production Order Number For The Sales Order Line Items

    Hi All,
    I want to know the number of production orders for each sales order line item. I know the sales order number .Can anyone tell me how the tables can be linked to get all the production order numbers for each sales order line item.

    I think it depends on your configuration. But check fields KDAUF and KDPOS in table AUFK.  or in table AFPO.
    Regards,
    Rich HEilman

  • Standard report for FI Special Ledger Line Item report

    is there any standard report for FI Special Ledger Line Item report

    Hi
    GD23 for Display of SPL Document
    GD13 for Trail Balance of SPL
    GCAC for Ledger Comparision
    GVTR Balance Carry forward in SPl.
    Assign Points if useful.

  • Availability Check at Multiple Plants for the Sales Order line Item.

    Hi Friends,
    We are having two plants, Plant A and Plant B. Plant A is used to issue the orders to the vendors and stock them, while Plant B is used to manufacture the Product and Stock.
    When we create the sales order, we want to check the Current Stock Plus Incomming Purchase order stock for plant A and also check current stock plus Production orders in plant B.
    for ex if the current stock is 100 in Plant A and No physical stock in Plant B but there are some production orders for 400 Qty which will be ready in 1 week.
    If i create a sales order for 500 qty which is scheduled for delivery 10 days later.  then we want to commit to the customer ( Looking at both the plants stock situation )  the system should check the stock availability for both the plants and automatically create two different line items , Line item 1 for plant A and line item 2 for plant b.
    I know there is a user exit for Multiple plant selection USEREXIT_PLANT_SELECTION  in program RV03VFZZ. The Description of the USer exit says ( This user exit may be used to provide a list of plants for which availability is to be checked)  But we have never used this one. Will this user exit do exactly what i want ??
    Did any of you, have used the above User exit in your implementations ? If so please let me know whats the purpose of this user exit
    Your reply is much appreciated.
    Thanks & Regards
    Srinivas

    Hi
    I dont know about the userexit which you are referring about
    But this is not available in R3 The system makes a Availability Check only in the plant which has got determined in the item details shipping tab and stops there
    The same is available in APO
    If there are 2 plants say 1000 and 2000
    In sales order the plant determined is 1000 and there is no stock
    In R3 system stops there
    But in APO  system checks the plant 2000 and if stocks are available it creates an STO in the background automatically from 2000 to 1000 if configured accordingly
    Even if the material is maintained in 10 plants the system will make a  Availability Check at all 10 plants and act accordingly
    Regards
    Raja

  • Field Char(255) for texts in accounting line item

    Hi Experts,
    I need a field with type/len char(255) for texts in accounting line item.
    I know I can use Long Text (EENO_DYNP-ZEILE) but it is not shown in TCode FAGLL03 and that is my need.
    Please help me.
    Best regards,
    Itajaci Júnior

    Hi Paul,
    Thanks for your reply.
    I already have these fields active, but unfortunately the sum of their sizes is not enough. Also, I would have to split the text into four fields and I think that it is not the best option for the customer.
    One more time, thanks for your answer.
    Any other ideas? It can be a Z field. The most important is that it be shown in Tcode FAGLL03.
    Regards,
    Itajaci Júnior

  • Creating inbound delivery for the purchase order line items

    Hi Experts,
    Please let me know how can I create inbound delivery for the purchase order line items?  Say, I have a purchase order with 5 line items in it.  I wanted to create an inbound delivery for only 2 line items at this point of time.  Which SAP Standard transaction I have to use and what all  data I need to populate?  I would appreciate any help on this and will reward the right answer.  Please let me know.
    Thank you in advance.
    with regards,
    Muthu Ganapathy.

    Hi,
    While creating the inbound delivery (VL31N), intially all the items will be shown, see the advance shipping notfication - from the vendor for which he has send confirmation & rest items you can delete simply & save. & next time when the vendor sends rest advance shipping notifcation (confirmation), you can receive them.
    Hope this answers your query.
    Regards
    Irfan.

  • MIRO: Is displaying VAT amount at line item level possible?

    Hello,
    Total Tax Amount is available in the header of a MIRO document, but is it possible to show the VAT Amount at line item level? i.e. as another column in the grid?
    Thanks.

    Hi,
    You can not see VAT amount at Item level in MIRO.It will be allways at header level.
    Regards,
    Manish

  • 102 combines all the GR qty for the same part # line item in the PO

    I had a question on the behavior of movement 102 in SAP
    In earlier versions, SAP combines all the GR qty for the same part # line item in the PO both in MIGO & in MB01.
    Is a change in functionality in ECC which combines all the qty or is there any config that we are missing?

    Hi,
    Check your PO item details....is there GR based IV active in your current PO? I know, it should have effect on LIV only but, still trying to see a possibility if it has any impact on GR reversals too....
    Regards
    Message was edited by:
            Gopala Turaga

Maybe you are looking for