How to Add Custom Field in SAP Standard Report ME5A & ME2N
In SAP implementation, it is often necessary to add
custom fields in standard reports such as
ME5A
(Purchase Requisition List) and
ME2N
(Purchase Order List).
This guide explains step-by-step how to enhance these reports using
append structure and
BADI ME_CHANGE_OUTTAB_CUS.
Step 1: Append Structure
- For report ME5A: append structure in
MEREP_OUTTAB_EBAN
. - For report ME2N: append structure in
MEREP_OUTTAB_PURCHDOC
.
Step 2: Implement BADI ME_CHANGE_OUTTAB_CUS
After appending the structure, create a new implementation in
BADI ME_CHANGE_OUTTAB_CUS
to populate the values
of the custom fields. Custom logic should be added in the method
IF_EX_ME_CHANGE_OUTTAB_CUS~FILL_OUTTAB
.
ABAP Code Example
METHOD if_ex_me_change_outtab_cus~fill_outtab.
FIELD-SYMBOLS:
<fs_tabrel> TYPE merep_outtab_purchdoc,
<fs_eban> TYPE merep_outtab_eban.
CASE im_struct_name.
WHEN 'MEREP_OUTTAB_PURCHDOC'. "PO
" --- custom logic for Purchase Order report (ME2N) ---
...
WHEN 'MEREP_OUTTAB_EBAN'. "PR
" --- custom logic for Purchase Requisition report (ME5A) ---
...
ENDCASE.
ENDMETHOD.
Best Practices
- Always use append structure to keep SAP standard intact.
- Ensure your BADI implementation only fills relevant fields.
- Use
SELECT SINGLE
or caching to avoid performance issues.
Conclusion
By using append structure and
BADI ME_CHANGE_OUTTAB_CUS, you can add
custom fields to standard reports ME5A
and
ME2N
without modifying SAP standard programs.
This method is safe, flexible, and recommended by SAP best practices.
No comments:
Post a Comment