Skip to Content

BAPI_PR_CHANGE

Hi all,

Im adding one customize Zfield in eban table under the structure ci_ebandb for customer fields. I add the same fields for structure ci_ebandbx as well as for BAPIUPDATE as component type.

I search through the forum and pass in the values as suggested :

DATA : lt_ext TYPE TABLE OF bapiparex,
       ls_ext TYPE bapiparex,
       ls_try TYPE bapi_te_mereqitem,
       lt_try TYPE TABLE OF bapi_te_mereqitem,
       ls_tryx TYPE bapi_te_mereqitemx,
       lt_tryx TYPE TABLE OF bapi_te_mereqitemx.

*Construct Changing Item
ls_try-preq_item = '00010'.
ls_try-zclmno = '700'.
MOVE 'BAPI_TE_MEREQITEM' TO ls_ext-structure.
MOVE ls_try to ls_ext-valuepart1.
APPEND ls_ext to lt_ext.

*Construct Changing Item Indicator
ls_tryx-preq_item = '00010'.
ls_tryx-zclmno = 'X'.
MOVE 'BAPI_TE_MEREQITEMX' TO ls_ext-structure.
MOVE ls_tryx to ls_ext-valuepart1.
APPEND ls_ext to lt_ext.

However, the bapi - BAPI_PR_CHANGE is not working, my Zfield is not updated, it is still blank , I was just wondering if I should pass in other value as well such as item or am I passing in a wrong way ?

I did use BAPI_TRANSACTION_COMMIT as well but it is still not updating. Seriously need help as I found several threads but none of them can solve my issue.

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jan 19, 2012 at 05:26 AM

    Hi Yun,

    Welcome to SCN.Did you gone through the documentation of that bapi.It is explained clearly what need to pass.

    Regards,

    Madhu.

    Edited by: madhurao123 on Jan 19, 2012 10:56 AM

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      Yes, I check with the bapi return as well, it actually return me 2 successful messages:

      Purchase requisition XXXXXXXX changed

      Instance XXXXXXXX of object type PurchaseRequisition has been changed.

      I noticed the ERDAT(Changed On) field is updated to today's date as well. That's why i think the normal field in eban table is working fine but not the customize field.

      Im passing PR number, header and Item to the BAPI.

      The header and Item are getting from BAPI_PR_GETDETAILS. I do a move corresponding to the structure of the 2 data which suit BAPI_PR_CHANGE. Currently the PR number im putting it manually. The indicator for ls_headerx because the BAPI requires it if I pass in the header. Im not too sure if the BAPI needs that but I tried it without passing header, it the same result.

      CALL FUNCTION 'BAPI_PR_GETDETAIL'
        EXPORTING
          number                      = lv_num
       IMPORTING
         PRHEADER                    = ls_header
       TABLES
         pritem                      = lt_item
          extensionout                = lt_ext
      .
      ls_headerx-PREQ_NO = 'X'.
      ls_headerx-PR_TYPE = 'X'.
      ls_headerx-GENERAL_RELEASE = 'X'.
      ls_headerx-CREATE_IND = 'X'.
      ls_headerx-ITEM_INTVL = 'X'.
      ls_headerx-LAST_ITEM = 'X'.
      
      LOOP AT lt_item INTO ls_item .
      MOVE-CORRESPONDING ls_item to ls_new_item.
      ENDLOOP.
      APPEND ls_new_item to lt_new_item.
      
      ls_new_itemx-preq_item = '00010'.
      ls_new_itemx-PREQ_ITEMX = 'X'.
      APPEND ls_new_itemx to lt_new_itemx.
      
      CALL FUNCTION 'BAPI_PR_CHANGE'
        EXPORTING
          number                       = lv_num
         PRHEADER                     = ls_header
         PRHEADERX                    = ls_headerx 
       TABLES
         return                       = return
         PRITEM                       = lt_new_item
         PRITEMX                      = lt_new_itemx
         extensionin                  = lt_ext
                .

      Thanks.

  • Posted on Jan 20, 2012 at 01:59 AM

    Hi All,

    I have solved myself. After some times of debugging and tuning.

    1)I used BAPI_PR_GETDETAIL to get the PR data first (header and item).

    2)Call the BAPI_PR_CHANGE and pass in the following things:

    *Construct Changing Item
    ls_try-preq_item = '00010'.
    ls_try-zclmno = '600'.
    MOVE 'BAPI_TE_MEREQITEM' TO ls_ext-structure.
    MOVE ls_try to ls_ext-valuepart1.
    APPEND ls_ext to lt_ext.
    
    *Construct Changing Item Indicator
    ls_tryx-preq_item = '00010'.
    ls_tryx-zclmno = 'X'.
    MOVE 'BAPI_TE_MEREQITEMX' TO ls_ext-structure.
    MOVE ls_tryx to ls_ext-valuepart1.
    APPEND ls_ext to lt_ext.
    
    CALL FUNCTION 'BAPI_PR_CHANGE'
      EXPORTING
        number                       = lv_num
       PRHEADER                     = ls_header
       PRHEADERX                    = ls_headerx
     TABLES
       return                       = return
       PRITEM                       = lt_new_item
       PRITEMX                      = lt_new_itemx
       extensionin                  = lt_ext
              .

    3) Call BAPI_TRANSACTION_COMMIT.

    4)Create a new BADI Implementation for ME_BAPI_PR_CUST, put in the code CH_STRUC = IM_CONTAINER for method MAP2I_EXTENSIONIN will do.

    5)Note :* My problem is that I receive the extension from BAPI_PR_GETDETAIL and append the data I want to update to the extension again. Once I comment it out, it work perfectly.

    Thanks.

    Edited by: yunonn on Jan 20, 2012 4:33 AM

    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.