Enhance purchasing reports with new fields
I work as both a functional and technical consultant and have been faced many times with the requirement to add customer fields to purchasing reports like ME28, ME2L or ME2N.
Adding the last purchase price to ME28 is especially frequent, and in the past (to my shame) I’ve made custom changes to RM06EF00. I’ve also searched for the best way to enhance these reports in SCN and have come across many forum posts where a lot of people validated my old ways.
This is the correct (SAP Sponsored) way to do it, and it’s available from EHP4 onwards.
Many purchasing reports share the BADI ME_CHANGE_OUTTAB_CUS, which takes in dynamic parameters according to the calling report.
There is only one method called FILL_OUTTAB, which takes as input parameter the output structure name in IM_STRUCT_NAME, and the real data in CH_OUTTAB.
The first thing is to declare a field-symbol with the correct structure provided in IM_STRUCT_NAME, and create an IF that validates if the structure is the expected one (remember this BADI runs for various reports with various output structures).
This is the specific example for ME28. All that is left is:
- Add the custom code inside the IF, which fills the customer fields in <fs_tabrel>;
- Add the customer fields to the structure in SE11 (in this case MEREP_OUTTAB_PURCHDOC_REL for ME28). Use append structures.
Here is the simple, standard, and clean way to enhance your purchasing reports and at the same time centralize all enhancements in the same BADI. Happy maintenance and upgrades.
Nice document...
Surely it will help me to add a custom field in ME2N report...
I will implement it in my organization...
Hi Joao Sousa,
It is very helpful and implementable in our life...
Thanks for sharing..
Keep it up ..
Regards.
M.Ozgur Unal
Hi ,
You worked technically also. Ohhh..... great.
It's very use ful document.
Regards,
Ravindra
Hi,
We used to refer the BAdI: ME_CHANGE_OUTTAB_CUS to technical team to add new fields to ME2* reports. But never checked how they coded / developed the field. Your document gives that idea too.
Nice document and thanks for sharing.
Regards,
AKPT
hi,
Cool, BADI is the correct way. Thanks for sharing.
ray
Hi Joao,
this is very helpful information.
I had done similar thing like you 2 days ago adding Gross Value (EKPO-BRTWR) to one of the Appends of the Structure MEREP_OUTTAB_PURCHDOC.
The new Field is visible in report Transactions: ME2L/ *M / *N if 'ALV' Scope of List is chosen in the selection screen of a report. It needs to be moved from Column Set to Displayed Columns and saved as a specific User Layout.
As Gross Value is an existing Field on SAP standard Table EKPO, no code needs to be done in the related BAdI.
Tks,
Alina.
Thank you for yourr sharing.It is very useful!
It was very useful for me. Thank you!
Very informative.
Any information on, if a new selection screen parameters needs to be added and data selection needs to happen using the newly added screen field?
Yes, it's a simple and clean way to achieve such kind of enhancement. Thanks for sharing!
I did the same for ME2N
João parabéns me ajudou muito a fechar a demanda que eu tinha!