cancel
Showing results for 
Search instead for 
Did you mean: 

Additional Output fields for ME2N?

Former Member
0 Kudos

We have created a Z field which exists on the item level of our POs (table EKPO). It is available in the search criteria of our ME2N report, but not in the output. Does anyone know of a way to add additional fields to the output of ME2N? Thanks so much.

Jim

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member

Hi. Just append a structure to MEREP_OUTTAB_PURCHDOC and add your Z field and it will work for all the ME2 reports.

Regards,

Dave.

Former Member
0 Kudos

I would add something to this. Let's say you want a new report field, say a field from MARA or something. And assume this field is not already in EKPO or EKKO. You can add it to the structure. But where do you add the ABAP code to populate the information????????????????

If the field is in EKPO or EKKO, it is as simple as adding it to the structure. Piece of cake.

There must be an enhancement for this but I haven't found it yet.

Former Member
0 Kudos

ANSWER ON HOW TO POPULATE FIELDS YOU ADDED TO STRUCTURE MEREP_OUTTAB_PURCHDOC THAT ARE NOT PART OF THE EK* TABLES LIKE EKPO, EKKO, EKET, etc.

1) Go into include program, LMEREPI02

2) Show IMPLICIT ENHANCEMENTS (Edit>Enhancement Operations>Show Implicit Enhancement Options

3) Find method "if_reader_mm~read_table" in the code

4) Create an enhancement point just before the ENDMETHOD statement

5) You should know what structure you are working with; all report data will be in <OUTTAB>

SAMPLE CODE TO PUT THERE:

FIELD-SYMBOLS <ZZZZ_OUTLINE> TYPE merep_outtab_purchdoc.

IF my_struct_name = 'MEREP_OUTTAB_PURCHDOC'.

LOOP AT <OUTTAB> ASSIGNING <ZZZZ_OUTLINE>.

      • YOUR FIELD WILL BE IN THIS INTERNAL TABLE SO YOU CAN DO ANYTHING YOU WANT WITH IT

ENDLOOP.

ENDIF.

former_member198900
Participant
0 Kudos

Lot of thanks Ken G, I follow your code and solved the same problem.

1st I add custom field YYJ_4KSCAT in structure MEREP_OUTTAB_PURCHDOC

then do that enhancement:

Tcode: ME2N/ME2W/...

program: LMEREPI02

Method: if_reader_mm~read_table

Code:

ENHANCEMENT ZME2W_CUSTOM_FIELDS.    "active version

*

   FIELD-SYMBOLS: <ZZ_CUSTOM> TYPE MEREP_OUTTAB_PURCHDOC.

   DATA: idx TYPE sy-tabix.

   IF my_struct_name EQ 'MEREP_OUTTAB_PURCHDOC'.

     LOOP AT <OUTTAB> ASSIGNING <ZZ_CUSTOM>.

       idx = sy-tabix.

       READ TABLE <ekko> into ls_ekko WITH KEY  ebeln = <ZZ_CUSTOM>-ebeln.

       clear lt_ekpo[].

       my_any_ekpo->read_lines( exporting im_key   = ls_ekko-ebeln

                                importing ex_table = lt_ekpo ).

       READ TABLE lt_ekpo into ls_ekpo WITH KEY  ebeln = <ZZ_CUSTOM>-ebeln

                                                 ebelp = <ZZ_CUSTOM>-ebelp.

         <ZZ_CUSTOM>-YYJ_4KSCAT = ls_ekpo-j_4kscat.

         MODIFY <OUTTAB> FROM <ZZ_CUSTOM> INDEX idx .

     ENDLOOP.

   ENDIF.

ENDENHANCEMENT.

Former Member
0 Kudos

Or use BADI ME_CHANGE_OUTTAB_CUS instead of using an implicit enhancement

former_member192897
Active Contributor
0 Kudos

For that you Need to Modify the ME2N Report Program by copying it to Z Report.

Former Member
0 Kudos

Hi,

Since it is quite simple to set up the query joining two main tables EKKO and EKPO, I would suggest to set up such simple query in either SQVI or SQ01/SQ02 instead of customizing the standard program of ME2N transaction.

Cheers,

HT

Former Member
0 Kudos

in that case copy the progrm of ME2N and add your required cahnges and use that program

you can not add the field in ME2N without coremod