Step 1: I add custom field YYJ_4KSCAT in structure MEREP_OUTTAB_PURCHDOC
Step 2: then do that enhancement:
Tcode : ME2N/ME2W/...
program : LMEREPI02
Method : if_reader_mm~read_table
Code:
ENHANCEMENT 1 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.
Step 2: then do that enhancement:
Tcode : ME2N/ME2W/...
program : LMEREPI02
Method : if_reader_mm~read_table
Code:
ENHANCEMENT 1 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.