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.

Similar Messages

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

  • 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

  • Adding new line item in SC after it is added to PR or PO

    Hi Experts,
    Our customer wants that if line item is added to PR and PO on ECC side, it should be added to SC as well. I am sure you can't change apporved SC for which follow on document is created. But if someone did similar kind of requirement.
    Here is requirement.
    >  SC has 2 line items.
    >  PR is created in ECC for 2 line items after SC is apporved.
    > User added 3rd line item in PR on ECC side.
    > Customer wants this line item should be added to SC as well.
    Please advise.
    Regards,
    Kamal

    Hi,
    In Classic Scenario: This is not possible .when you are adding a P.O in ECC it will not reflect in
    SRM.
    In Extended Classic scenario: In SRM  only P.O is  created .You can add a new line items (or) change
    because P.O in SRM Server is the main P.O.
    Moreover in this also Shopping cart will not update. Once Shopping cart is approved you can do any changes
    Please check which scenario your client is using.
    Regards
    G.Ganesh Kumar

  • 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

  • Adding new line item to the Purchase Requisition

    Hi Guys,
    I have created the PR using the BAPI_PR_CREATE. Now I want to add the new line item to already created PR. I tried with BAPI_PR_CHANGE and BAPI_REQUISITION_CHANGE but nothing worked for me.
    Can anyone help me in this.
    Thanks in advance
    Edited by: jayakrishna.k on Feb 16, 2011 12:07 PM

    Hi,
    Please try MEMASSRQ or change by ME52N
    Regards,
    Manish Jain

  • Adding new line item to Delivery

    When I try to post (Add) a delivery document based on a sales order that has a line item added that did not belong to the sales order I get the following error "[OACT] No matching records found (ODBC -2028)".  Looking in the DI API documentation I see that the Document_Lines object has a mandatory AccountCode property.  How do I go about getting the appropriate account code for the added line item?  The help documentation shows some sample code (included below), which doesn't make much sense to me. 
    Dim sStr As String
        Dim vRs As SAPbobsCOM.Recordset
        Dim vBOB As SAPbobsCOM.SBObob
        Dim vCH As SAPbobsCOM.ChartOfAccounts
        Set vCH = Vcmp.GetBusinessObject(oChartOfAccounts)
        Set vBOB = Vcmp.GetBusinessObject(BoBridge)
        Set vRs = Vcmp.GetBusinessObject(BoRecordset)
        Set vRs = vBOB.GetObjectKeyBySingleValue(oBusinessPartners, "CardName", "aaa", bqc_Equal)
        ' When working with segmentation use this function
        ' to find the account key in the ChartOfAccount object
        Set vRs = vBOB.GetObjectKeyBySingleValue(oChartOfAccounts, "FormatCode", "125100000100101", bqc_Equal)
        'The Recordset retrieves the value of the key (for example, sStr = _SYS00000000010).
        sStr = vRs.Fields.Item(0).Value
        'Use the sStr value to set the AccountCode
    Where does the FormatCode value of "125100000100101" come from?  Why the first call to GetObjectKeyBySingleValue?  It doesn't appear the results are being used?
    Any help would be greatly appreciated!
    Thanks,
    Jason Eiler
    BTW - I'm developing with/for SAP Business One version 2004 (or 6.7 of the DI API).

    Hi Jason,
    First of all:
    The displayed account code must be translated into the internally used code ("_SYS...") when using segmentation - when not using segemntation it is just internal code = displayed code.
    The code displayed is just a sample to give you a hint in case you are already familiar with the SAP Business One application.
    Therefore the sample code does not talk about where you got e.g. the value for FormatCode from ("FormatCode" is e.g. a field in table OACT where the account name with segments is (redundantly) stored without separators).
    The user should know on which account he/she wants to book a line on; maybe you might want to give some help to the user by displaying a dialog with suitable - or preselected accounts?
    In addition I am sure you know how to assign a string value to a string property - without explicitly writing it, right?
    HTH,
    Frank

  • BOM Change - Delete an item(s) and insert new line items

    Hi,
    We need to mass update BOMs like for some of the existing BOM's we need to delete some line items and insert new line items. We want to use the BOMMAT04 IDOC in LSMW but I'd like to know couple of things before I go ahead with that approach
    For instance, I've a finished good material 12345678 and it has three components
                          a) Item 0010 Material 30101010 of quantity 10
                          b) Item 0020 Material 30101011 of quantity 11
                          C) Item 0030 Material 30101012 of quantity 12
    Now, I'd like delete Item 0010 and add a new item 0040 Material 30101013 of quantity 13. 
    In the segment E1STKOM, there is LOEKZ (Deletion Flag) but I dont want to flag for deletion but instead delete the whole line item and add a new line item.
    Is there any way to achieve this using BOMMAT04 IDOC? If not, can you please suggest me a better way to do it
    Any help is greatly appreciated
    Thanks,
    Srinivas

    Dear Srinivas,
    1.IF you want to change for an individual BOM,use CS02,select the item which you want to delete,select the entire and click on
    delete button and then add new line items and save.
    2.For Mass changes of BOM you can use CS20.
    3.Check these functional module's also if you want to change using a report,
    CS_BI_BOM_CHANGE_BATCH_INPUT   Change bill of material via batch input    
    CSEP_MAT_BOM_SELECT_CHANGE     API Bills of Material: Select BOM(s)    
    CS_CL_P_BOM_MASS_CHANGE     
    CS_CL_S_BOM_CHANGE_COMPLETE 
    Check and revert back,.
    Regards
    Mangalraj.S

  • How to add new line item to PO using BAPI_PO_CREATE1

    Hi,
    I have a purchase order with 2 line items, now i want to add new line item to the same PO using BAPI_PO_CREATE1.
    Here new line item should be created with reference PR line item.But this PR line item is Dynamic it get generated once the Sales order line item get changed.
    Please let me know how can i pass the PR doc no, PR line item no as reference to create the new PO line item.
    Thanks
    Bhuvana

    Hi,
    I think you need to use BAPI: BAPI_PO_GETDETAIL, then BAPI:BAPI_PO_CHANGE.
    BAPI_PO_CREATE1 equals ME21N, but adding new line item needs to be done in ME22N.
    Cheers,

  • PR...New line item not to be added

    Hi,
    I have a PR where release process is at line item. After approval (Release of the PR) the system does not allow any chnages to the PR Line item . BUt it allows to add new line item to the PR. How do we check that the new line item cannot be added to the PR.
    Regards
    Nandini

    Hi
    You can restrict changes to the PR after release by customisation. On OMGQ go to release indicator> choose the release indicator which once it is effected you do not want any changes...select the "details"  then  "changes after start of release process" - on the field changeability..enter " 1"  for cannot be changed.
    This will work perfectly since no additional items can be entered once the PR is approved. if you only restrict by changing the field selection screen, additional items can still be added.
    if for any reason you want  to make changes to the PR then the approver must reset the release.
    regards
    Nrikah

  • Pricing Date on New Line Item Added to Order

    We have a requirement, for example, if we create an order for 07/19/2010, the pricing date comes in as 07/19/2010 which is correct.  The customer calls back and wants to add a line item or 2, to the order on 07/22/2010.  The new line items are priced as of the original pricing date 07/19/2010.  How do we automatically update the new line items with today's pricing date instead of the old date.  Is there an automated way to do this thru configuration.  Or do we need to use user exits:
    MV45AFZZ - USEREXIT_PRICING_PREPARE_TKOMK
    MV45AFZZ - USEREXIT_PRICING_PREPARE_TKOMP
    Thanks,
    Mark

    Hi,
    There is no automatic way to populate the pricing date for item when item is added at later point of time. In this case, the pricing date at header is copied to the item.  This cannot be achived by configuration.
    As you have mentioned, you have to use the user exits relevant for pricing. The user exits you have mentioned are not correct for this purpose. The purpose of these user exits are different. You need to find the correct one with the help of an ABAPer.

  • Unable to add a new line item to a sales document when hitting save

    Dear All,
    When ever the end user save the sales quotation document, a new line item has to add automatically with a default item with some quantity.
    I am trying to solve this issue with user exit USEREXIT_SAVE_DOCUMENT_PREPARE in SAPMV45A. But it is not allow me to do so. Is there any solution?
    Thanks in advance.
    Regrads,
    Suresh Yerra.

    Write the proper code in USEREXIT_SAVE_DOCUMENT_PREPARE, it will solved.

  • Adding a new line item using BAPI_OUTB_DELIVERY_CHANGE

    Hi,
    I have a requirement to add a new line item to outbound delivery to the existing line items using the FM BAPI_OUTB_DELIVERY_CHANGE.Pls suggest how to do it.
    Thanks in advance.
    Anand

    Hi,
    Did you Check IN SCN like [THIS|Re: BAPI_OUTB_DELIVERY_CHANGE Help - Add new line item].
    Regards,
    Rahul

  • 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

Maybe you are looking for