Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_PR_CHANGE

chin_yunonn
Explorer
0 Kudos

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

8 REPLIES 8

madhu_vadlamani
Active Contributor
0 Kudos

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

0 Kudos

HI,

I am still new to abap, I have gone through the documentation that provided which I found in se37 -> function module documentation, however, that is not sufficient for me to identify.

I am sure the documentation you are referring to is more details. Could you please advice me where can I get that ?

But I would appreciate if there is any solution for my case too.

Thanks.

0 Kudos

Please search properly before posting.

check this thread

Nabheet

0 Kudos

Hi,

I have gone through that thread previously as well, if you noticed my code which i post, I am actually following them and the way of doing are similar. I tested around with se37 test sequence as well as a customize program to run with the BAPI.

From one of the thread I found and study, [; , (second last reply) I follow the way of doing as well.

However,I still have no luck on getting the BAPI to work, thats why im wondering if there are any additional things are required such as config or did I miss out anything.

Thanks.

0 Kudos

Does it throw any error message or something..?

Please provide the detials of which fields are you passing to the BAPi

Nabheet

0 Kudos

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.

chin_yunonn
Explorer
0 Kudos

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

0 Kudos

hi, how to Create a new BADI Implementation for ME_BAPI_PR_CUST.

I try to create one. but when call bapi BAPI_PR_CHANGE,it don't get in the break-point.

can u help me? thanks a lot!