Skip to Content
0
Former Member
Apr 03, 2009 at 08:23 AM

Field Catalog Not Found in ALV

27 Views

Hi Experts,

I am trying to exceute the below code its shows the Field CataLog Not Found

Code is:

TYPE-POOLS:slis.

TABLES:ekpo,mseg.

TYPES: BEGIN OF ty_ekpo,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

matnr TYPE ekpo-matnr,

menge TYPE ekpo-menge,

END OF ty_ekpo.

TYPES: BEGIN OF ty_mseg,

ebeln TYPE mseg-ebeln,

ebelp TYPE mseg-ebelp,

matnr TYPE mseg-matnr,

menge TYPE mseg-menge,

bwart TYPE mseg-bwart,

END OF ty_mseg.

TYPES: BEGIN OF ty_final,

ebeln TYPE ebeln,

ebelp TYPE ebelp,

qtysup TYPE MENGE_D,

qtyact TYPE MENGE_D,

qtyrej TYPE MENGE_D,

END OF ty_final.

DATA: it_mseg TYPE TABLE OF ty_mseg WITH HEADER LINE,

it_ekpo TYPE TABLE OF ty_ekpo WITH HEADER LINE,

it_final TYPE TABLE OF ty_final WITH HEADER LINE.

DATA: wa_fieldcat TYPE slis_fieldcat_alv,

it_fieldcat TYPE slis_t_fieldcat_alv.

DATA:wa_mseg LIKE LINE OF it_mseg,

wa_ekpo LIKE LINE OF it_ekpo ,

wa_final LIKE LINE OF it_final.

SELECT-OPTIONS: p_ebeln FOR ekpo-ebeln.

START-OF-SELECTION.

SELECT ebeln ebelp matnr menge FROM ekpo

INTO TABLE it_ekpo

WHERE ebeln IN p_ebeln.

IF it_ekpo[] IS NOT INITIAL.

SELECT ebeln ebelp matnr menge bwart FROM mseg

INTO TABLE it_mseg

FOR ALL ENTRIES IN it_ekpo[]

WHERE ebeln EQ it_ekpo-ebeln

AND ebelp EQ it_ekpo-ebelp

AND bwart EQ '122'.

ENDIF.

LOOP AT it_mseg .

READ TABLE it_ekpo WITH KEY ebeln = it_mseg-ebeln.

IF sy-subrc EQ 0.

it_final-qtyrej = it_mseg-menge.

it_final-qtysup = it_ekpo-menge.

it_final-ebeln = it_mseg-ebeln.

it_final-ebelp = it_mseg-ebelp.

ENDIF.

IF sy-subrc EQ 0.

it_final-qtyact = ( it_final-qtysup ) - ( it_final-qtyrej ).

ENDIF.

APPEND it_final.

ENDLOOP.

wa_fieldcat-fieldname = 'EBELN'.

wa_fieldcat-tabname = 'IT_FINAL'.

wa_fieldcat-seltext_l = 'Purchase Doc'.

wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.

wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.

wa_fieldcat-col_pos = 1.

wa_fieldcat-outputlen = 10.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'EBELP'.

wa_fieldcat-tabname = 'IT_FINAL'.

wa_fieldcat-seltext_l = 'Item'.

wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.

wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.

wa_fieldcat-col_pos = 2.

wa_fieldcat-outputlen = 5.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'QTYSUP'.

wa_fieldcat-tabname = 'IT_FINAL'.

wa_fieldcat-seltext_l = 'QuatitySupply'.

wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.

wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.

wa_fieldcat-col_pos = 3.

wa_fieldcat-outputlen = 13.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'QTYACT'.

wa_fieldcat-tabname = 'IT_FINAL'.

wa_fieldcat-seltext_l = 'QualityAccepted'.

wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.

wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.

wa_fieldcat-col_pos = 4.

wa_fieldcat-outputlen = 13.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'QTYREJ'.

wa_fieldcat-tabname = 'IT_FINAL'.

wa_fieldcat-seltext_l = 'QualityRejected'.

wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.

wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.

wa_fieldcat-col_pos = 5.

wa_fieldcat-outputlen = 13.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

DATA: repid LIKE sy-repid.

repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = repid

TABLES

t_outtab = it_final[]

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks In Advance

Poorna