additional fields in me2n is showing blank value if we run program RM06EN00
I have added Vendor material number (IDNLF) and Requisitioner Name (AFNAM) in the report ME2n using below logic.
- 1) For ME2N and ME2 report, we need to do implicit enhancement in the include LMEREPD02.
- 2) To add the fields AFNAM(Requisitioner) and IDNLF (Vendor Material Number) , we need to add these fields into structure (MEREP_OUTTAB_PURCHDOC) via Append Structure .
Field names in structure should start with zz.
- 3) Now if you run ME2N and ME2L , you can see the AFNAM and IDNLF fields in these reports.
- 4) To display the values in these fields , we need to do Implicit Enhancement.
- 5) Go to se38-à Enter the Include Name
- 6) Check for method BUILD_BASE_LIST and double click on this method.
- 7) Then click on spiral icon(Enhance Button) and then Goto EDITà Enhancement Operations -à show Implicit Enhancement.
- 8) Go to ENDMETHOD statement of this method.
- 9) Right click on Doted line and Goto Enhancement Operations à Create Implementation
- 10) Then system will ask you for Type of Enhancement. We need to select the “Code” option.
- 11) Then one popup will come wherein we need to enter the “Enhancement Name”.
- 12) Then write the below code into this Enhancement.
TYPES: BEGIN OF TY_EKPO,
EBELN TYPE EBELN,
AFNAM TYPE AFNAM,
IDNLF TYPE IDNLF,
EBELP TYPE EBELP,
END OF TY_EKPO.
DATA : IT_EKPO TYPE STANDARD TABLE OF TY_EKPO,
WA_EKPO LIKE LINE OF IT_EKPO.
IF SY-TCODE = 'ME2N' OR SY-TCODE = 'ME2L'.
SELECT EBELN AFNAM IDNLF EBELP FROM EKPO
INTO TABLE IT_EKPO
WHERE EBELN = IM_EKPO-EBELN.
IF SY-SUBRC = 0.
READ TABLE IT_EKPO INTO WA_EKPO WITH KEY EBELP = IM_EKPO-EBELP.
re_outtab_purchdoc-ZZAFNAM = WA_EKPO-AFNAM.
re_outtab_purchdoc-ZZIDNLF = WA_EKPO-IDNLF.
If i run ME2N report then i can see these two fields in the report with value.
But if i run standard program if ME2N (RM06EN00) then i can not see value in these two fields.
Include LMEREPD02 which contains the enhancement is not getting called in the report RM06EN00.
This is because,in your code you have added if sy-tcode = "me2n" or "me2l",
when you execute through se38, sy-tcode will be "se38".
Put the condition accordingly.
Maybe add if sy-rapid = RM06EN00 too in the condition.