Create new line item while saving a new order

I have a requirement to create a new line item with different item category while creating an order.
i.e
if the item category is ICT1, then create a new line item like item 1 but with item category ICT2.
Also in the conditions tab, we need to update the condition type with  different values for both existing and new item.
All this has to be in VA01 i.e on save.
I tried to append lines of structure XVBAP at SAVE_DOCUMENT _PREPARE by changing the item no and item caegory. This works fine. But, how can I get other table details like XKOMV(which stores pricing condition details) for the new item?
Please can you suggest any other exit/subroutine for this?
or any other alternative solutions

Hi,
Try to use this EXIT:
'EXIT_SAPMM06E_013'     Update Customer's Own Data in Purchasing Document
The Badi and exit contains same parameter.
Thanks,
AMS

Similar Messages

  • Add New Line item while creating a new PO in ME21N

    Hi All,
    I have a requirement to add a new line item when user is pressing enter on the Line item 1 based on some condition.
    I am using the BADI 'ME_PROCESS_PO_CUST' and Method is 'PROCESS_ITEM'.
    I have tried lots of options and also look for method 'Create_Item ' but not able to understand what exactly I need to pass in that method.
    Can somebody elaborate on it if somebody has work on it? Even sample code will also help me.
    Thanks in advance.
    With regards
    Sachin Gupta

    Hi Sachin,
    Please find the sample code :
    METHOD if_ex_me_process_po_cust~process_item .
      DATA: ls_mepoitem TYPE mepoitem,
            ls_customer TYPE mepo_badi_exampl,
            ls_tbsg     TYPE tbsg.
    * here we check customers data
      ls_mepoitem = im_item->get_data( ).
      IF ls_mepoitem-loekz EQ 'D'.
    * a physical deletion of the item was carried out. therrefor we have to
    * delete customer data on the level of the item
        ls_customer-ebeln = ls_mepoitem-ebeln.
        ls_customer-ebelp = ls_mepoitem-ebelp.
        CALL FUNCTION 'MEPOBADIEX_SET_DATA'
          EXPORTING
            im_data                    = ls_customer
            im_physical_delete_request = 'X'.
      ELSE.
    * update/insert operation
        CALL FUNCTION 'MEPOBADIEX_GET_DATA'
          EXPORTING
            im_ebeln = ls_mepoitem-ebeln
            im_ebelp = ls_mepoitem-ebelp
          IMPORTING
            ex_data  = ls_customer.
    * check customers data
    * check field badi_bsgru. This should be carried out only for new items. Once the PO is posted the
    * field should no longer be changeable. This is done in Method FIELDSELECTION_ITEM.
        IF im_item->is_persistent( ) EQ mmpur_no.
          IF ls_customer-badi_bsgru IS INITIAL.
    * Place the cursor onto field badi_bsgru. The metafield was defined in BAdI ME_GUI_PO_CUST,
    * Method MAP_DYNPRO_FIELDS.
            mmpur_metafield mmmfd_cust_01.
            mmpur_message_forced 'W' 'ME' '083' text-002 '' '' ''.
          ELSE.
    * check whether the field is valid
            SELECT SINGLE * FROM tbsg INTO ls_tbsg WHERE bsgru EQ ls_customer-badi_bsgru.
            IF NOT sy-subrc IS INITIAL.
              mmpur_metafield mmmfd_cust_01.
              mmpur_message_forced 'E' 'ME' '083' text-004 '' '' ''.
    * invalidate the object
              CALL METHOD im_item->invalidate( ).
            ENDIF.
          ENDIF.
        ENDIF.
    Try to check the import and export paremeters to pass the vales.
    I hope this may helpfull.
    Thank you,
    Thanks,
    AMS

  • User exit - VA01 - Adding new line items while Sales Order Creation

    Hi All ,
    I have a requirement where : in VA01 , i have to add new line items using USER EXIT or BADI.
    The scenario is : we maintain Characteristics for Material. When we select a particular characteristics, Factor and length will be displayed in a Popup. we can specify the Factor and lenght.
    Here , if i specify Factor as 10 and lenght as 1000. the Material has to be cut / split into 10 items of 1000 mts each. and the ITEMs table control should get 10 ITEMS .
    How to add new items using User exit or Badi in VA01 while creating a sales order.
    i have identified the user exit . What code should be used to add new line items.
    kindly help me in solvng this.
    Waiting for your replies.
    Thanks in advance.
    Suki.

    hi
    wich user exit do you take for that ???

  • Adding new line item while save

    Hi all,
    use an implementation of BADI  ME_PROCESS_REQ_CUST in the MM-Purchase-Requisition, method IF_EX_ME_PROCESS_REQ_CUST~POST while save.
    based on the line items available(USER ENTERED) i have to add few more line items based on the account assignment category and quantity while save.
    How to create new line items (copying the existing line item and change the quantity ) and save the requestion with the additional line items. I used this code. while calling the method CRETE_ITEM  create based on the object REF_ITEM  in the MY_STATE.
    the REF_ITEM object is Initial . so while creation the empty object is created.
    kindly help to give tips/details  to handle.
    Coding:
    data: l_item_list TYPE MMPUR_REQUISITION_ITEMS,
    l_item TYPE MMPUR_REQUISITION_ITEM,
    l_item_akt TYPE mereq_item,
    l_item_ref TYPE ref to IF_PURCHASE_REQUISITION_ITEM.
    l_item_list = im_header->get_items().
    loop at l_item_list into l_item.
    l_item_akt = l_item-item->get_data( ).
    IF l_item_akt-MENGE > 1 AND
           l_item_akt -KNTTP = 'A'.
          DO l_item_akt -MENGE TIMES.
             l_item-item= IM_HEADER->CREATE_ITEM( IM_ITEM =  l_item-item).
            INSERT  l_item INTO TABLE IT_ITEMS_list.
    %%%%%  here i checked useing    get data  method  i am not getting any data other than relesing procedure data.
    I used SET_DATA method to set the data. even I am not getting data.
    endloop.
    (Debugging the code, I manage by doubleclicking while create Item  method the fieldcontent of l_item (e.g ) to show the content of the class-attribute my_state. This works only if the field “Interface” in the Debugger is empty because then I see the attributes of the class. If the field Interface is filled with “IF_PURCHASE_REQUISITION_ITEM”, there aren’t any attributes shown.)
    Thanks in advance for your kind help!!
    Nicole

    I searched sdn and found this not possible.

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

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

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

  • Adding new line item directly to PO

    Hi,
    We have a requirement for adding a new line item directly within the Purchase Order in SRM (without using the shopping cart). We are using the FM BBP_PD_PO_UPDATE for this purpose. However, we are getting the following error while updating. " BUFFER TABLE NOT UP-TO-DATE". Please provide assistance in order to resolve this issue.
    Regards,
    Arun

    We achieved  based on the Security roles to identify if the user is Requester or Purchaser or Manager and Webdynpro changes by the portal team to activate the Change and Order button based on the required business rules.
    Transaction Code for PO Change to be added to the security role.
    Requisitioner:  Any user with out any existing A012 relationship with any existing Organizational units on the current date:
    Manager:  Any user having A012 relationship with any existing Organizational units on the current date.
    If the Authorization object checked programmatically results the value of "PUR" then the standard SAP code for "Purchaser" has to be executed.
    Some additional Info :
    Control list of PO using BADI BBP_WF_LIST - Change Work lists and Search Results Lists   Method:  BBP_WF_LIST
    Badi -BBP_AUTHORITY_CHECK for any additional authorisation checks
    Hope this helps.
    Thanks
    Balaji

  • User Exit during Sales Order Creation - New Line Item needed

    I have a situation during the process of sales order creation. If a Material in a line item has say 27 EA and the Base Unit is EA. But the Sales Unit is CSE. Then whenever the user enters 27 EA and presses enter he should get two line items.
    The first line item needs to convert to maximum number of CSE posible and the rest will be the second line item with the remaining EA. The order isn't important but that is what is needed. Question is how do I approach this problem and code my user exit accordingly and where do I code it.
    I was looking at SAPMV45A and saw the program MV45AIZZ which is meant as a user exit for any PAI event handling. If anybody has encountered this kind of requirement can you please share your view on this.
    I will definitely reward points for useful answers.
    Clark

    Hello Mahendra
    The requirement is as follows :
    PART 1:
    Sales Order Enter: 
    1.     When a line item is entered on a sales order (VA01 or VA02), at enter, check the sales unit of measure (VBAP-VRKME).
    •     Do not check line items where item category (VBAP-PSTYV) = TANN, TAPS or ZTAP.  TANN are free goods that should not be considered for consolidation.  TAPS & ZTAP are lower level materials as a result of product selection.  They will be attached to a higher-level material with an item category of TAX, which is relevant for consolidation.
    •     Do not check items where VRKME <> EA
    2.     If VRKME = EA, go to MARM for MATNR.
    3.     Go to record where alternate unit of measure (MEINH) = CSE, get the value from the numerator field (UMREZ).
    4.     Divide the order quantity (VBEP-WMENG) by UMREZ.
    5.     If the result is greater than 1.0, the customer has ordered more than one case and a new line item needs to be added to the sales order for the case quantity.
    6.     Add a new line to VBAP for the same material with the case quantity.  If not a whole value, the remainder of eaches (bottles) should update the qty on the first item on VBAP.
    •     Part 1 is relevant for order types ZCA, ZOR, ZSO, RE, ZSM
    PART 2:
    Batch Job to run prior to the Delivery Due List:
    1.     Read VBUK for Delivery Status (LFSTK) = A (delivery not processed).  Get all of the document numbers (VBELN).
    2.     Go to VBEP for those document numbers to get the goods issue date for the order.  There will be many records in VBEP for the same sales order.  Look at all orders with a goods issue date (WADAT) of next day.
    3.     Go to VBAK for those document numbers to see if there are multiple sales orders for the same Sold To party (KUNNR).
    4.     For customers who have more than one order in VBAK, search all line items (for all orders).  If there are no duplicate materials across sales orders, do nothing.
    •     Do not check line items where item category (VBAP-PSTYV) = TANN, TAPS or ZTAP.  TANN are free goods that should not be considered for consolidation.  TAPS & ZTAP are lower level materials as a result of product selection.  They will be attached to a higher-level material with an item category of TAX, which is relevant for consolidation.
    •     Do not check line items where reason for rejection (VBAP-ABGRU) is not blank
    5.     If there are duplicate materials, go through the same logic as in part 1.  If the quantity across the sales orders adds up to greater than one case, add the appropriate quantity to a new line item on the first sales order.   If there is a remainder qty, update the line item on the first sales order with this qty. In this case, the quantities on the second sales order needs to be closed out with a reason for rejection code of 50, ‘Line Item Consolidation’. If there is no remainder,  update the qty on this item directly.
    •     Part 2 is relevant for order types ZOR, ZCA, ZSM
    •     This batch job will have to be run manually for Day Pick orders.  The end of this program should automatically kick off the delivery due list for Day Pick orders, shipping condition 02.
    Business Justification:
    The business requires that like order line items be consolidated to one line item prior to the order going to the warehouse for picking.  This will aid in picking at the warehouse as well as result in the customer invoice not reflecting more than one line item for the same material.  In the case where the customer has truly ordered more than a case, i.e;, 1 case, 2 bottles, the documents in SAP will still reflect 2 lines.

  • Create a new line item in sales order

    Hi,
    I have to create a new line item in a sales order. The scenario is that if we donot find the desired quantity from a plant. Then we have to go ahead and pick the remaining quantity from another plant and automatically create a new line item.The new plant is picked from a custom table so u need not worry about it.
    According to me I will have to use the BAPI for it but one constraint is that while creating a sales order the order number assignment is not done until saved. So what can be done in the case if its a new document.
    Kindly let me know if there is any appropriate user exit or if someone has worked on a similar requirement.
    thanks
    Varun

    Hi,
    Thanks for your response. I have tried to use these exits already but the problem dat comes here is dat when we try to use the BAPI we donot have any sales document created in the first instance(i.e. while creating an order) so the BAPI returns error and when i tried to populate the itabs in the program directly the new values just wont get processed.
    I think like: in case its a new document and we face this scenario I can just terminate the document creation and create a new document using the BAPI with proper plant assignments.But i am doubtful about the stability of this process.
    Kindly comment.
    Thanks
    Varun

  • How to create a new line item automatically in CRMD_ORDER

    Hi,
    While creating a sales order in CRMD_ORDER, after user enters a line item say 'xxxx' and press 'Enter', we need to create a new line item say 'yyyy' dynamically.  Any ways of how to achieve this functionality?
    thanks in advance,
    amar.s

    Hi Amar
    You can use structured products:
    Step1:COMM_PR01
    Open Product xxxx > Relationships > Tab Component > Select Relationship type = STRSET Set > Assing product yyyy
    Step2: IMG > CRM > Transactions > Define Item Categories
    Open you item category and in Structure scope field select option A Single-Level Explosion of structured products
    Step3: IMG >  CRM > Transactions > Define Item Category Determination
    create new entry
    Transaction type =
    Item   category group = Category group of xxxx product
    main item cat = item cat of xxxx product
    item cat =  item cat of yyyy product
    now when you enter product xxxx , product yyyy will be automatically added
    Hope it helps
    Rupesh

  • ME21N add new line item when creating a PO

    Hi guys,
    I am new to badi & oop.
    I want to add a PO line item after clicking the save button in ME21n.
    I found the BADI IF_PURCHASE_ORDER_MM.
    I have coded in the method POST by using method create_item.
    However, it still does not work? Any ideas how to use this method to create the new line item or any sample code?
    Please help! points will be rewarded.
    Many thanks...

    Hi Sen,
    You mean by executing the BAPI call? Maybe you did understand my question wrongly.
    What my requirement is that, user will be keying in details for PO and its line item in ME21N.
    And upon saving, need to auto add in an additional line to the PO. Eg user key in 3 line items, the BADI/userexit suppose to add a new line item to it.
    The bapi that you proposed, creates PO from d scratch right?
    I guess it can't just create an PO item with that bapi unfortunately.
    Any other help? I need a help in coding this create_item method in interface class IF_PURCHASE_ORDER_MM.
    Please help.. I have an urgent requirements.
    Many thanks in advance.

  • Reconfigure sales BOM deletes line item and creates new line item

    We are having issue with Sales BOM. Once sales BOM is reconfigure, line item is automatically deleted and creates new line item. These changes are not captured by reporting tool. Is it standard SAP behavior? if its not standard behavior, how to fix this issue?

    Hi,
    If i am not wrong, i assume you are using site instead of plant.   If it is plant , then "yes", we can have a order with same material being line item 10 and 20 with different plants.  Reg delivery, if the plants are configured to a same shipping point then you will have one delievery.  if the plants are configured for a different shipping point , then delivery will be split up.
    Reward if it helps,
    Thanks & regards,
    CLN

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

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

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

  • New Line Item to be created in sale order

    Hi,
    Client requires a new line item to be created in sale order for particular regions only..
    Scenario 1 :
    For a particular region Additional Tax shud be calculated on Basic Price .
    Scenario 2 :
    For a particular region Cess on Vat need to incorporated.
    Client wants to maintain condition records in Cond Type :UTXJ and also the client shall maintain a 2 different Tax Codes for above each scenarios,  In future in case Additional Tax or Cess on Vat is applicable to other regions it shud get posted in their respective G/L's
    Plz suggest...
    Thanx...

    It would be wonderful had you shared your suggestion in this forum itself rather sending to personal mail ids which is against the rules and regulations of this forum.
    I request you to dont do that please.

  • How do i create a new line item (say 20) in reference to line item 10

    Hi all,
    I am trying to map a scenario where i want to create a new line item with reference to an existing line item. Where do i get this option in SD, and how could i go about it?
    Thanks & Regards
    Ravi

    > In ECC6 if u go to VA01 and enter the SP and SH,
    > Press Propose Item Icon, then one window will pop-up
    > asking for Sale Document Number, enter the Number and
    > select- selection list, there  u will get all the
    > line item of the Sale Doc. Select and copy Material
    Hi i am on SAP 4.7. How could be the same handled here?

  • Substitution to create new line item

    Hi,
    I am looking for a way of creating an additional line item when posting an FI document (incoming payment) based on one of the documents actual line items.
    (well, actually the customer is looking for this...) ;o)
    Something like:
    IF line item account number EQ 1234 THEN
       Check how many invoices are paid by this transaction
       Check something in SD via the invoice number for all line items
       Based on findings, create a new line item.
    END IF.
    Can I do this via a substitution and user exit?
    Did anyone ever do something like this?
    Thanks in advance!
    Dirk

    Hi,
    Good evening and greetings,
    I dont think it is possible through substitution...Please go through the following
    FBICRC002POPULATE_LINEITEMS
    Please reward points if found useful
    Thanking you
    With kindest regards
    Ramesh Padmanabhan

Maybe you are looking for