BAPI_PR_CHANGE : Add line items

I've read some contradicting posts regarding bapi: BAPI_PR_CHANGE. I was under the impression you could add line items to a requisition using this BAPI? Can it be said for certain it can not be done? The documentation is rather lacking.
Thanks!
Enrique Leon

it's very easy to do this with this BAPI.
If you have experiences with BAPI_PO_CHANGE you have done this within some minutes.
Here's some sample-coding. Maybe this will help you:
LOOP AT it_change_pr INTO wa_change_pr.
    ADD 10 TO lv_pr_counter.
    wa_pritem-preq_item      = lv_pr_counter.                "Item Number of Purchase Requisition
    wa_pritem-material       = wa_change_pr-orig_matnr.  "Materialnumber
    wa_pritem-plant          = lv_plant.                 "Plant
    wa_pritem-pur_group      = lv_pur_group.             "Purchasing Group
    wa_pritem-store_loc      = lv_store_loc.             "Storage Location
    wa_pritem-quantity       = wa_change_pr-menge.       "Purchase Requisition Quantity
    wa_pritem-unit           = wa_change_pr-meins.       "Purchase Requisition Unit of Measure
    wa_pritem-del_datcat_ext = lv_del_datcat.            "Date type (day, week, month, interval)
    wa_pritem-deliv_date     = lv_deliv_date.            "Item Delivery Date
    wa_pritem-fixed_vend     = wa_change_pr-lifnr.       "Fixed Vendor
    CLEAR: temp_matnr.
    CONCATENATE '0000000000' wa_change_pr-matnr INTO temp_matnr.
    SELECT SINGLE * FROM mbew
      WHERE matnr = temp_matnr
      AND   bwkey = wa_change_pr-werks.
    IF sy-subrc = 0.
      wa_pritem-preq_price   = mbew-stprs.                "Price in purchase requisition
      wa_pritem-price_unit   = mbew-peinh.                "Price Unit
    ENDIF.
    wa_pritem-purch_org  = lv_purch_org.                "Purchasing Organization
**    wa_pritem-po_unit    = wa_change_pr-meins.        "Purchase Order Unit of Measure
    wa_pritem-vend_mat   = wa_change_pr-matnr.          "Material number used by vendor
    wa_pritemx-preq_item      = lv_pr_counter.
    wa_pritemx-preq_itemx     = 'X'.
    wa_pritemx-material       = 'X'.
    wa_pritemx-plant          = 'X'.
    wa_pritemx-store_loc      = 'X'.
    wa_pritemx-pur_group      = 'X'.
    wa_pritemx-quantity       = 'X'.
    wa_pritemx-unit           = 'X'.
    wa_pritemx-del_datcat_ext = 'X'.
    wa_pritemx-deliv_date     = 'X'.
    wa_pritemx-fixed_vend     = 'X'.
    wa_pritemx-preq_price     = 'X'.
    wa_pritemx-price_unit     = 'X'.
    wa_pritemx-purch_org      = 'X'.
    wa_pritemx-vend_mat       = 'X'.
    APPEND wa_pritemx TO it_pritemx.
    APPEND wa_pritem TO it_pritem.
  ENDLOOP.
  CALL FUNCTION 'BAPI_PR_CHANGE'
    EXPORTING
      number                      = lv_banfn
*   PRHEADER                    =
*   PRHEADERX                   =
*   TESTRUN                     =
* IMPORTING
*   PRHEADEREXP                 =
TABLES
     return                      = it_change_return
     pritem                      = it_pritem
     pritemx                     = it_pritemx
*   PRITEMEXP                   =
*   PRITEMSOURCE                =
*   PRACCOUNT                   =
*   PRACCOUNTPROITSEGMENT       =
*   PRACCOUNTX                  =
*   PRADDRDELIVERY              =
*   PRITEMTEXT                  =
*   PRHEADERTEXT                =
*   EXTENSIONIN                 =
*   EXTENSIONOUT                =
*   PRVERSION                   =
*   PRVERSIONX                  =
*   ALLVERSIONS                 =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =

Similar Messages

  • Urjent-how to add line items in tcode-FBL3N

    Hi Experts,
      How to add line items customer, customer name,  vendor and vendor name in FBL3N.
    Thanks in advance.
    mahe
    Moderator message - Please do not use words like "urjent". Please ask a specific question. Please search the forum. This question has been asked and answered before. Post locked
    Edited by: Rob Burbank on Apr 29, 2009 11:27 AM
    Edited by: Rob Burbank on Apr 29, 2009 11:28 AM

    Hi,
    Check the BTE's:
    00001020     POST DOCUMENT:       Prior to final checks             SAMPLE_INTERFACE_00001020
    00001025     POST DOCUMENT:       Final checks completed       SAMPLE_INTERFACE_00001025
    00001030     POST DOCUMENT:       Posting of standard data     SAMPLE_INTERFACE_00001030
    00001050     POST DOCUMENT:       Accounting interface           SAMPLE_INTERFACE_00001050
    Thanks & Regards,
    Harish

  • EXIT to change / add line items during STO PO creation in T.Code ME21N

    Hi
    Can somebody suggest me a EXIT or a BADI  to change / add line items during STO PO creation in T.Code ME21N.
    The requirement is as below.
    When the user enters a material no ( which has a BOM created in CS01), and presses enter or saves the PO, i need to get the sub components of the BOM and populate them as the next line items.
    This is because the user needs to create the delivery with reference to the PO. In the delivery, the BOM material needs to be populated with all the sub components of the BOM.
    I tried to do it using EXIT_SAPMM06E_013 in which i am able to change / add the line items in the XEKPO and YEKPO internal tables. The entries are available in the internal table when the EXIT is executed.
    But when the PO is posted internally, the item is not changed/added.
    Thanks in advance.
    Guna.

    Hi,
    Try BADI "ME_PROCESS_PO_CUST".
    cheers,

  • RWIN to automatically add line items in FI document

    Hi all!
    I wish to know if is possible to automatically add line items in a FI document via RWIN and how.
    My final goal is the following:
    A user try to create an FI document with FB01 transaction.
    He/She insert the appropriate line items manually.
    He/She press the "Simulation" button
    In simulation screen there are user's line items, PLUS some more that are necessary in some circumstances.
    Is it possible to achieve this scenario?

    Hi Marinos,
    i think it's  possible via table <b>TRWPR</b> and an
    appropriate function module but it's hold for a modification by SAP.
    other possible solutions:
    - user exit ?
    - interface ( e.g. Intranet-appl. / excel)
      and posting via RFBIBL00 / BAPI
    regards Andreas

  • Automatically add line-items to Sales order

    Hello,
    Our client needs us to add line items to sales orders. The requirement is such that, when the users enter a material on a line item, they wish to see few more materials automatically added as new line items -- item category to be maintained as "Free" items. This appears similar to automatically getting BOM-sub-items for materials which have BOMs maintained. The client is not willing to maintain BOMs for materials in question. They instead have asked us to maintain sub-item materials in a Z-table and then fetch those to populate the subsequent line-items on the sales order.
    So far, we have tried to fiddle around with the XVBAK and XVBAP internal tables in sales exit (MV45AFZZ) and also tried to use BAPI within the same exit. Both methods do not work.
    Could you please guide us ? Thank you.
    Regards,

    Hi,
    I think you can try with product proposal(Item Proposal). T.Code:VA51.
    Using this one can create list of items to be proposed at the time sales order processing.
    Item proposal contains list of items with or without default quantities those were frequently ordered by the customer. You can create any no of items in an Item proposal.Like wise you can create any no.of item proposals.
    But,You can assign only one item proposal per customer in sales tab of the CMR.So that when ever you are creating order for that customer you can access those materials which are listed in an Item proposal completely or selectively,with or without default quantities.
    The items which are proposed from an Item proposal are always changeable.
    Item proposal makes sales order processing simple and fast.
    Only the thing here is it will not automatically explode like in case of BOM.You have to manually select those items from an item proposal.
    Regards,
    Revan
    Edited by: REVAN on Dec 23, 2008 10:55 AM

  • Automatically add line-items to sales orders

    Hello,
    Our client needs us to add line items to sales orders. The requirement is such that, when the users enter a material on a line item, they wish to see few more materials automatically added as new line items -- item category to be maintained as "Free" items. This appears similar to automatically getting BOM-sub-items for materials which have BOMs maintained. The client is not willing to maintain BOMs for materials in question. They instead have asked us to maintain sub-item materials in a Z-table and then fetch those to populate the subsequent line-items on the sales order.
    So far, we have tried to fiddle around with the XVBAK and XVBAP internal tables in sales exit (MV45AFZZ) and also tried to use BAPI within the same exit. Both methods do not work.
    Could you please guide us ? Thank you.
    Regards,

    Ist method:
    Maintain one Ztable with the fields of Material and sub materials.
    write BDC to create order,before entering the material  number check if material is existed in Ztable or not.
    If it exist take that material and added as a another line item.
    if not exist create like normal line item.
    2 nd method:
    Ask your MM functional consultant to maintain supression of materials concept.

  • How to add line item to sales order item table?

    Kindly help me the with the below requirement .
    Add line item to sales order(va01) dynamically on click of button. The button is also custom created push button.
    In the above requirement I have added the pushbutton to va01 tcode. But when I click on that button I need to add line item to sales order item table.
    I tried a lot but I am not successful. If possible can u please help on this.
    Regards,
    Rachel

    Hi!
    It's quite easy even in the standard SAP to add a line item for a customer order, I don't think it worth to develop a new button for this.
    However if you wanted to add a line automatically, the you can do the following in the program MV45AFZZ, FORM USEREXIT_SAVE_DOCUMENT.
    You can use similar code, but with some modifications.
    DATA: lv_posnr.
    LOOP AT xvbap.
    MOVE xvbap-posnr TO lv_posnr.   "get the last posnr
    ENDLOOP.
    ADD 10 TO lv_posnr.
    MOVE 'XYZ' TO xvbap-matnr.   "enter your material number here
    MOVE lv_posnr TO xvbap-posnr.
    * fill additinal field data in XVBAP if necessary
    MOVE 'I' TO xvbap-updkz.                  "Insert line
    APPEND xvbap.
    Regards
    Tamá

  • System should not allow to add line items in delivery

    Hi,
    1) system should not allow to add line items in delivery( in reference to sales order or STO)
    2) sales order/STO should not be changed if delivery exists
    how to control the above
    Alec

    Hi Lakxmi,
           I found answer for 1st point from you are old answers.
          can you throw somelight on 2nd point.
    Thanks
    Anil

  • To add line items to sales order using User exit.

    Hi ,
    I have to add line items to sales order .
    I have tried adding the code in usr exit move field _VBAP // Check VBAP and in savedocument _prepare . But in all the places I dont see it in VA01 . I can see it in the VA02 and VA03 . But I am not able to save the order as they have made the flooring term as mandatory field, and I am supposed to populate the XVBKD structure for this.
    Pls tell me whts the procedure like say , should I popluate the XVBKD / XVBAP / and should i use the bapi_SALES_ITEM_CHECK to populate the structures at the save_document prepare.

    Hi,
    1. It is not possible to delete records using DTW, only importing new records or updating existing ones are supported. These are the only valid operations via DTW.
    2. It is possible to delete the contents of an edit text field by using the character / or -1. However it is not possible to clear an entire row/line using this notation.
    Thanks & Regards,
    Nagarajan

  • User Exit to add line item in Purchase Order

    Hi SAP Gurus,
    Can any body tell me which user exit is used to add the line items in Purchase Order. I want to link the Packaging material (material type - VERP) to the header material (Material type - FERT) in PO for order type NB or UB. Because our requirement is what, when we enter the finished material in PO then packaging material linked with that finished material should automatically comes into PO as a line item.
    Please help me for the same.
    Thanks in Advance.
    Regards,
    Sujay

    Hi,
    You can use Function Module for this requirement.
    BAPI_PO_GETDETAIL1
    Bye,
    Muralidhara

  • How To Add Line Items to Workflow Document Template

    Hi Gurus,
    ive made a Workflow which has few containers referencing VBKPF, VBSEGS, and constructed two methods which one of them gets the table VBKPF data into MyStructure and the second the data into MyStructure2.
    Inside of the workflow i made two container operations and assigned those two methods to VBKPF and VBSEGS containers.
    The Problem is that VBSEGS is a (multi) line item table and it doesnt show me the data inside of the document template.
    What could be the solution for this scenario
    Thanks, Points for Reward

    Hi,
    i checked the swo1 methods and it looks good. I didnt change the binding that ive implemented, and some values are getting showed, but still they do not correspond to the BO element (concerning Acct.Doc.Nr)
    My binding is:
    Display Document Task:
    #######Workflow -> Step Display Parked Doc
    **************BO FIPP -> &_WI_OBJECT_ID&
    #######Workflow <- Step Display Parked Doc
    **************Empty
    Document Template:
    #######Workflow -> Step Create Doc From Template
    **************&_WORKITEM& -> &FLOWITEM&
    **************DC8BA2ADFCEA4EF18D2F00145EDCE7A4 -> &TEMPLATE&
    #######Workflow <- Step Create Doc From Template
    **************&WF_DOCUMENT_0001& <- &_WI_OBJECT_ID&
    **************&_WF_INITIATOR& <- &_WI_ACTUAL_AGENT&
    As ive explained earlier i have a Container VBSEGS with abap table vbsegs, which is filled using method ReturnMe2 with MyStruct2 structure.
    Regards
    Laurynas Prikockis

  • Add Line Item In Sales Order VA01

    HI All,
    I  have new requirement in creation of sales order . Here we have free promotion sales . Here if customer buy one material then he will get some other material as free .In standard sap we can give only one line item as free not more than that .
    Here our requirement is more than one line item . I suggested them maintain all the free materials in one Ztable when ever the original material  will come for  sales order then i have to fetch these materials from ztable  automatically and it should create sales order. I started doing this using user exit  FORM USEREXIT_MOVE_FIELD_TO_VBAP.
    These are the below links i checked in our sdn.
    Adding Line items to sales order on creation using User-Exit in VA01.
    Please give me some idea on this .
    Regards,
    Madhu.

    Hi Asik,
    Thanks for your reply.In my case i can not got for Bom  because the schemes will change for every ten days. I think Bom  creation will fill a lot of data but it wont solve my issue.
    Regards,
    Madhu.

  • Add line item to FB60 at SAVE

    Hi All,
               I have a very unique requirement where i have to create accounting document through FB60. Now when we create line items we will click click check box to calculate tax. We have maintained ztable for tax calculation. Lets say i have 100 USD at header and created line item 10 and 20 with amount as 60 and 40. But after tax calculation it becomes 65 and 40. Here i cannot post the document. So when i hit enter it should create n new line item to balance by -10 so that i can save the document.
       Can you please let me know how to proceed if anyone has worked on such scenario ever. I tried lloking for exits and BADIs but they does not seems helping me.

    Hi,
    have a look at badi AC_DOCUMENT.
    Best regards.

  • Unable to add line item to a Service Ticket!

    Hi Expets,
    I am facing some difficulty in adding a line item to a service ticket. The service ticket is not getting saved.I think I am missing some parameter to be passed to CRM_ORDER_MAINTIAN.Please find below my coding:
      lv_product_i-ref_handle = '0000000002'.
      lv_product_i-process_qty_unit = 'EA'.
      INSERT lv_product_i INTO TABLE lt_product_i.
      ls_orderadm_i-header = lv_header_guid.
      ls_orderadm_i-ordered_prod = 'SERVICEITEM_SG5'.
      ls_orderadm_i-handle = '0000000002'.
      ls_orderadm_i-mode = 'A'.
      INSERT ls_orderadm_i INTO TABLE lt_orderadm_i.
      ls_input_fields-ref_handle = '0000000001'.
      ls_input_fields-objectname = 'ORDERADM_I'.
      CLEAR ls_field_names.
      ls_field_names-fieldname = 'MODE'.
      APPEND ls_field_names TO ls_input_fields-field_names.
      ls_field_names-fieldname = 'ORDERED_PROD'.
      APPEND ls_field_names TO ls_input_fields-field_names.
      INSERT ls_input_fields INTO TABLE lt_input_fields.
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        EXPORTING
          it_product_i      = lt_product_i
        CHANGING
          ct_orderadm_i     = lt_orderadm_i
          ct_input_fields   = lt_input_fields
        EXCEPTIONS
          error_occurred    = 1
          document_locked   = 2
          no_change_allowed = 3
          no_authority      = 4
          OTHERS            = 5.
    I am also calling the save and commit BADI's after this, but somehow its not working for me.
    Can anyone please help me out on this or provide some pointers?
    Thanks and Regards,
    Rohit

    Hi,
    I have tried everything, still its not working.
    First I tried creating a Service Ticket and adding the line item at one go.Then I was getting status error:
    System error: An attempt has been made to create a status object
    with the object number DE20131333937DF180C5001372F65D25.  However,
    a status object with this number exists already.
    Code sample given below:
      CALL FUNCTION 'BAPI_BUSPROCESSND_CREATEMULTI'
        TABLES
          header          = itab_header
          item            = itab_item
          partner         = itab_partner
          status          = itab_status
          text            = itab_text
          return          = itab_return
          service_os      = itab_service
          input_fields    = itab_input_fields
          created_process = itab_created_process.
    Then I tried creating a service ticket first and adding item later.Then there was no dump, but item details are not getting saved. Code sample given below:
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        EXPORTING
          it_product_i      = lt_product_i
        CHANGING
          ct_orderadm_i     = lt_orderadm_i
          ct_input_fields   = lt_input_fields
        EXCEPTIONS
          error_occurred    = 1
          document_locked   = 2
          no_change_allowed = 3
          no_authority      = 4
          OTHERS            = 5.
    Can anybody please help me out on this? What is the correct approach?
    Thanks and Regards,
    Rohit

  • Add line items programatically (Bid invitation)

    Hi all,
    I've created a bid invitation and would like to add items programatically. Is there a standard method I can use? I started to analyse SAP standard program and try to find  
    out the functions I can call to do the task... Am I going to the wrong direction?
    Thanks in advance for your help.
    Franck

    Thanks for your quick answer Vadim,
    How do you generate the new item guid. Do you know the function module that does that? In debug, I noticed that a simple numeric value is put in the field and it's later translated but I didn't find the function that does the translation.
    Regards,
    Franck

Maybe you are looking for

  • Use sender from payload: Sender not in payload

    Hi, I am currently facing problems with a IDoc -> XI -> Proxy(XI) sceanrio. The Idoc is received by XI without any problems. No message mapping is required for this scenario. However, the message keeps getting stuck in the Inbound queue (SMQ2). The s

  • Bluetooth Headeset Pairs - but then drops...

    I have tried this with several different bluetooth headsets. I successfully pair my device and bluetooth headset, can make calls, everything works fine.  Once I am off of a call for longer than 2-3 minutes the bluetooth connection is lost.  I look on

  • [SOLVED] Access media from both Windows and Arch?

    I'm hoping to get a new laptop around summer time, allowing me to sort any niggles out before I start uni in september. I've been using Arch Linux for a while, and really like it now - it totally stopped by habit of distro-hopping anyway However, I'm

  • OWB Mapping and Sqlloader error.

    Hi All, OWB Config Details is as follows: Oracle 9i Warehouse Builder Client: 9.2.0.2.8 Oracle 9i Warehouse Builder Repository: 9.2.0.2.0 I developed a mapping which involves a source text file delimited by comma with following structure. Deptno,Dnam

  • Premiere elements 10 crashes on startup error DirectoryRegistry.cpp-283

    I bought premiere elements 10 yesterday on mac app store and until now i wasnt able to use it. It crashes on the startup and this error apears. [/Users/ramyadav/perforce/premiere/elements/molecules/pre10-bullseye/molecule-17/MediaCore /ASL/Foundation