cancel
Showing results for 
Search instead for 
Did you mean: 

Clear some fields when copying a PR to Create a new PR

masna_7
Participant
0 Kudos
111

Hi Experts,

 

I have a requirement where when creating a PR by copying another PR values, all the fields would normally be copied into the new PR. But, I have a requirement to clear two field values, 1. EBAN-BEDNR 2. Custom Field. 

So, when copying a PR, these two values should not be copied. Is there any way that I can clear these values before copying ?

 

Thanks and Regards.

View Entire Topic
raymond_giuseppi
Active Contributor
0 Kudos

Did you already look at BAdI ME_PROCESS_REQ_CUST or BADI ME_REQ_POSTED to find an event/method triggered at copy?

masna_7
Participant
0 Kudos

Yes Raymond,

I found a place to place my code, but how can I change these two values ?
Please note that this should not be done using BAPI_PR_CHANGE, because this triggers and outbound Idoc. When saving a PR, I have a code to trigger an Idoc to the external system. So, when we use this BAPI_PR_CHANGE and COMMIT for it, this will also trigger the outbound Idoc because I used the BAPI ME_REQ_POSTED to trigger an Idoc. This will create inconsistency in the System.

 

I found the exit EXIT_SAPLMEREQ_007 for MEREQ001 which contains item data in im_eban, but, I am unable to change this im_eban values, any idea on how to achieve this ?

Regards.

masna_7
Participant
0 Kudos

Update : I just found out that im_eban in exit EXIT_SAPLMEREQ_007 is not modifiable. Now, I need to find a way to clear both these values from BADIs. How would I know which structure or internal table entries need to be changed ?

 

raymond_giuseppi
Active Contributor
0 Kudos

This Enhancement is provided mostly for customer fields, so should not be very useful.

Better use BAdi ME_PROCESS_REQ_CUS, in an event such as PROCESS_ITEM you can read current data, previous data of new PR and current data of referenced PR, so you should be able to update some fields even standard ones.

  • Look at methods GET_DATA, GET_PREVIOUS_DATA and SET_DATA on received parameters IM_ITEM and IM_REF_ITEM
  • Just insure not to clear twice the field (if user input manually same value) you could set some attributes of the implementing class, reset it in a method such as OPEN or CLOSE.
masna_7
Participant
0 Kudos
Thanks, then in BADI ME_PROCESS_REQ_CUST or ME_REQ_POSTED, how would I know which structure or internal table to change so that these values would not be Copied ?