Skip to Content
author's profile photo Former Member
Former Member

BAPI_REQUISITION_CHANGE or BAPI_PR_CHANGE

I AM FACING THIS PROBLEM

WHILE USING BAPI_REQUISITION_CHANGE or BAPI_PR_CHANGE I CAN CHANGE THE DATA BUT HOW TO ADD ANOTHER LINE ITEM TO EXISTING PR.

HELP NEEDED

REGARDS

HIREN K.CHITALIA

Add a comment
10|10000 characters needed characters exceeded

Related questions

8 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 11, 2006 at 05:30 AM

    Hi hiren,

    1. i have not used this bapi,

    2. but in tables parameter,

    while passing the internal table

    for line item,

    just add more items to this internal table

    and use this FM and check.

    it should work.

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 11, 2006 at 06:54 AM

    Hiren,

    There will be a Flag table where you indicate whether its a new item. Once you check that flag, BAPI will understand that its a new item

    I don't have the new of the table now.

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 28, 2006 at 02:51 PM

    Ravi,

    Can you identify what field in the structure BAPI_PR_CHANGE this is? Please?

    Thanks!

    Enrique Leon

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 01:34 PM

    Dear HIREN K.CHITALIA,

    Nice meeting you through forum.

    I have an requirement to update the Delivery text for the particular PR and for particular line item

    I tried with a function module BAPI_PR_CHANGE for delivery text change for PR with PR number and PRITEMTEXT structure by passing PR no, line item no, Text id & Text_line parameters, while executing, the return parameter it shows that the 'Purchase requisition changed' but its not getting reflected in the transaction (ME52N).

    Please let me know where i'm missing .

    Thanks,

    Senthil.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 21, 2008 at 08:29 AM

    Hi I want to set the block on the PR in ME52 Transaction.

    Can you suggest any function module or a bapi which does this.

    I tried the BAPI_PR_CHANGE but it does not help in setting the block field on PR.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Did you already succeed in setting the block on the purchase requisition using function module BAPI_PR_CHANGE?

      I have the same problem now.

      Thanks for helping me out.

      Edited by: Marina Janssens on Apr 29, 2009 8:40 AM

  • author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2009 at 11:04 AM

    Hi,

    increment PREQ_ITEM field in ur program for line item.

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      How can I change REQ_BLOCKED in BAPI_PR_CHANGE?

      I have a PR with items 00010 and 00020.

      I want to block the first one.

      So in item I set 00010 and REQ_BLOCKED = 1.

      In itemX I set 00010 and X for REQ_BLOCKED.

      I also tried with an X in PREQ_ITEMX but I don't succeed in blocking the first item.

      Regards

      Edited by: Marina Janssens on Apr 29, 2009 8:39 AM

  • Posted on Sep 05, 2014 at 04:58 AM

    Hi Hiren,

    I know its been very long time since you posted this query I recently came across the same requirement and have done the below coding which solves this issue. Please go through the below code for appending a new line iten in PR.

    REPORT ztest1234.


    PARAMETERS : p_banfn TYPE vbep-banfn OBLIGATORY.

    DATA:
    prheader LIKE bapimereqheader, "ok
    prheaderx LIKE bapimereqheaderx, "ok
    testrun TYPE bapiflag-bapiflag, "ok
    prnumber TYPE bapimereqheader-preq_no,
    prheaderexp LIKE bapimereqheader, "ok
    return LIKE bapiret2 OCCURS 0, "ok
    pritem LIKE bapimereqitem OCCURS 0, "ok
    pritemx LIKE bapimereqitemx OCCURS 0, "ok
    wa_pritemx TYPE bapimereqitemx,
    praccount LIKE bapimereqaccount OCCURS 0, "ok
    praccountproitsegment LIKE bapimereqaccountprofitseg OCCURS 0, "ok
    praccountx LIKE bapimereqaccountx OCCURS 0,
    praddrdelivery LIKE bapimerqaddrdelivery OCCURS 0,
    pritemtext LIKE bapimereqitemtext OCCURS 0,
    prheadertext LIKE bapimereqheadtext OCCURS 0,
    iv_banfn TYPE eban-banfn. "OK
    DATA: pritem1 TYPE bapimereqitemimp OCCURS 0 WITH HEADER LINE. "ok
    DATA: wa_pritem TYPE bapimereqitem.
    DATA : lv_linecnt TYPE n.

    iv_banfn = p_banfn.

    CALL FUNCTION 'BAPI_PR_GETDETAIL'
    EXPORTING
    number = iv_banfn
    account_assignment = 'X'
    item_text = 'X'
    header_text = 'X'
    delivery_address = 'X'
    * serial_numbers = serial_numbers
    * sc_components = components
    version = 'X'"version
    * services = services
    IMPORTING
    prheader = prheader
    TABLES
    * allversions = allversions
    * extensionout = extensionout
    prheadertext = prheadertext
    pritemtext = pritemtext
    praddrdelivery = praddrdelivery
    praccount = praccount
    * serialnumbers = serialnumbers
    * prcomponents = prcomponents
    * serviceoutline = serviceoutline
    * servicelines = servicelines
    * servicelimit = servicelimit
    * servicecontractlimits = servicecontractlimits
    * serviceaccount = serviceaccount
    * servicelongtexts = servicelongtexts
    pritem = pritem
    return = return
    EXCEPTIONS
    OTHERS = 0.

    CLEAR : wa_pritem.
    LOOP AT pritem INTO wa_pritem.
    MOVE-CORRESPONDING wa_pritem TO pritem1.
    APPEND pritem1.
    CLEAR : wa_pritem, pritem1.
    ENDLOOP.
    prheaderx-preq_no = 'X'.
    prheaderx-item_intvl = 'X'.

    CLEAR : lv_linecnt.
    DESCRIBE TABLE pritem LINES lv_linecnt.
    CLEAR : wa_pritem.
    READ TABLE pritem INTO wa_pritem INDEX 1.
    IF sy-subrc EQ 0.
    MOVE-CORRESPONDING wa_pritem TO pritem1.
    pritem1-preq_item = lv_linecnt + 1.
    APPEND pritem1.
    ENDIF.
    wa_pritemx-preq_item = lv_linecnt + 1.
    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 pritemx.


    CALL FUNCTION 'BAPI_PR_CHANGE'
    EXPORTING
    number = iv_banfn
    * prheader = prheader
    * prheaderx = prheaderx
    * testrun = testrun
    *IMPORTING
    * prheaderexp = prheaderexp
    TABLES
    * prheadertext = prheadertext
    * extensionin = extensionin
    * extensionout = extensionout
    * allversions = allversions
    * pritemtext = pritemtext
    * praddrdelivery = praddrdelivery
    * praccountx = praccountx
    * praccountproitsegment = praccountproitsegment
    * praccount = praccount
    * serialnumber = serialnumber
    * serialnumberx = serialnumberx
    * prcomponents = prcomponents
    * prcomponentsx = prcomponentsx
    * pritemsource = pritemsource
    * pritemexp = pritemexp
    pritemx = pritemx
    pritem = pritem1
    * prversion = prversion
    * prversionx = prversionx
    return = return
    * serviceoutline = serviceoutline
    * serviceoutlinex = serviceoutlinex
    * servicelines = servicelines
    * servicelinesx = servicelinesx
    * servicelimit = servicelimit
    * servicelimitx = servicelimitx
    * servicecontractlimits = servicecontractlimits
    * servicecontractlimitsx = servicecontractlimitsx
    * serviceaccount = serviceaccount
    * serviceaccountx = serviceaccountx
    * servicelongtexts = servicelongtexts
    EXCEPTIONS
    OTHERS = 01.



    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    wait = 'X'.

    WRITE :/ 'LineItem', pritem1-preq_item, 'Created for PR', p_banfn.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Abhishek,

      I have a requirement for changing the service line quantity, gross value, G/L Account and Cost Centre for purchase requisition.

      I have tried to use the BAPI_PR_CHANGE FM for the change but I am not getting necessary result. The data is not getting changed in the PR. I have made the following related post in the regard.

      It will be of great help if you can please help.

      Regards,

      Subhabaha Pal

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2014 at 05:17 AM

    Hi,

    For adding a new line item to Purchase Requisition, You must use BAPI_PR_CHANGE( it just performs like an Enjoy transaction) & then BAPI_TRANSACTION_COMMIT.

    While coding better use BAPI_PR_GETDETAIL to populate the data.

    BAPI_REQUISITION_CHANGE is only meant for changing the data for the existing line items and header, but this couldn't create a new line item.

    Regards,

    Prakash

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.