Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Field catalog not found - ALV problem

Former Member
0 Kudos

Hi All,

I am getting the termination message "Field catalog not found " when i am executing the following program..

&----


*& Report ZSCG_ALV_HIER

*&

&----


*&

*&

&----


REPORT zscg_alv_hier.

  • selection screen

TABLES : vbap, vbak.

SELECTION-SCREEN BEGIN OF BLOCK b1.

SELECT-OPTIONS : s_sorg FOR vbak-vkorg,

s_dchan FOR vbak-vtweg,

s_div FOR vbak-spart,

s_sdtyp FOR vbak-auart,

s_cust FOR vbak-kunnr,

s_date FOR vbak-erdat,

s_matnr FOR vbap-matnr.

SELECTION-SCREEN END OF BLOCK b1.

INCLUDE zscg_alv_hiertop.

INCLUDE zscg_alv_hierf01.

INITIALIZATION.

g_repid = sy-repid.

  • PERFORM e03_eventtab_build USING gt_events[].

START-OF-SELECTION.

  • get header data

SELECT vbeln kunnr FROM vbak

INTO TABLE t_temp

WHERE erdat IN s_date

AND auart IN s_sdtyp

AND vkorg IN s_sorg

AND vtweg IN s_dchan

AND spart IN s_div.

IF NOT t_temp[] IS INITIAL.

SELECT vbeln posnr matnr arktx zmeng netpr FROM vbap

INTO TABLE t_item

FOR ALL ENTRIES IN t_temp

WHERE vbeln =

t_temp-vbeln

AND matnr IN s_matnr.

ENDIF.

END-OF-SELECTION.

CLEAR : wa_temp, wa_item, wa_header.

LOOP AT t_item INTO wa_item.

AT NEW vbeln.

READ TABLE t_temp INTO wa_temp WITH KEY vbeln = wa_item-vbeln.

IF sy-subrc EQ 0.

wa_header-vbeln = wa_temp-vbeln.

APPEND wa_header TO t_header.

wa_item-kunnr = wa_temp-kunnr.

MODIFY t_item FROM wa_item TRANSPORTING kunnr WHERE vbeln =

wa_item-vbeln.

ENDIF.

ENDAT.

ENDLOOP.

  • construct the ALV display

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = g_repid

i_internal_tabname = 'T_HEADER'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = g_repid

i_bypassing_buffer = 'X'

i_buffer_active = ' '

CHANGING

ct_fieldcat = gt_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3

.

IF sy-subrc <> 0.

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

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

ENDIF.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = g_repid

i_internal_tabname = 'T_ITEM'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = g_repid

i_bypassing_buffer = 'X'

i_buffer_active = ' '

CHANGING

ct_fieldcat = gt_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3

.

IF sy-subrc <> 0.

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

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

ENDIF.

g_tabname_header = 'T_HEADER'.

g_tabname_item = 'T_ITEM'.

  • CLEAR gs_keyinfo.

gs_keyinfo-header01 = 'VBELN'.

gs_keyinfo-item01 = 'VBELN'.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

I_CALLBACK_PROGRAM = g_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • IS_LAYOUT =

IT_FIELDCAT = gt_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_DEFAULT = 'X'

I_SAVE = 'A'

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

i_tabname_header = g_tabname_header

i_tabname_item = g_tabname_item

  • I_STRUCTURE_NAME_HEADER =

  • I_STRUCTURE_NAME_ITEM =

is_keyinfo = gs_keyinfo

  • IS_PRINT =

  • IS_REPREP_ID =

I_BYPASSING_BUFFER = 'X'

I_BUFFER_ACTIVE = ' '

  • IR_SALV_HIERSEQ_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab_header = t_header

t_outtab_item = t_item

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.

-


&----


*& Include ZSCG_ALV_HIERTOP

&----


TYPE-POOLS : slis.

TYPES: BEGIN OF ty_header,

vbeln LIKE vbak-vbeln,

END OF ty_header,

BEGIN OF ty_item,

vbeln LIKE vbak-vbeln,

posnr LIKE vbap-posnr,"itm num

matnr LIKE vbap-matnr,"mat num

arktx LIKE vbap-arktx,"item text

zmeng LIKE vbap-zmeng,"qty

netpr LIKE vbap-netpr,

kunnr LIKE vbak-kunnr,

END OF ty_item,

BEGIN OF ty_item1,

posnr LIKE vbap-posnr,"itm num

matnr LIKE vbap-matnr,"mat num

arktx LIKE vbap-arktx,"item text

zmeng LIKE vbap-zmeng,"qty

netpr LIKE vbap-netpr,

kunnr LIKE vbak-kunnr,

END OF ty_item1,

BEGIN OF ty_temp,

vbeln LIKE vbak-vbeln,

kunnr LIKE vbak-kunnr,

END OF ty_temp.

DATA : t_header TYPE STANDARD TABLE OF ty_header,

wa_header LIKE LINE OF t_header,

t_item TYPE STANDARD TABLE OF ty_item,

wa_item LIKE LINE OF t_item,

t_item1 TYPE STANDARD TABLE OF ty_item,

wa_item1 LIKE LINE OF t_item,

t_temp TYPE STANDARD TABLE OF ty_temp,

wa_temp LIKE LINE OF t_temp,

g_tabname_header TYPE slis_tabname,

g_tabname_item TYPE slis_tabname,

g_repid LIKE sy-repid.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,

gs_layout TYPE slis_layout_alv,

gs_keyinfo TYPE slis_keyinfo_alv,

gt_sp_group TYPE slis_t_sp_group_alv,

gt_events TYPE slis_t_event,

gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

.

Please help me out with regard to this.

Thanks in advance,

Sharat

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

Since the table is T_ITEM is the user defined table u can't use the FM 'REUSE_ALV_FIELDCATALOG_MERGE'.

So u have to code like this to built the field catalog

DATA: L_FIELDCAT TYPE SLIS_FIELDCAT_ALV. " For column heading

CLEAR : IT_FIELDCAT,

IT_FIELDCAT[].

  • Sales Order Number

CLEAR L_FIELDCAT.

L_FIELDCAT-TABNAME = 'G_T_OUTTAB'.

L_FIELDCAT-FIELDNAME = 'VBELN'.

L_FIELDCAT-SELTEXT_M = TEXT-002.

L_FIELDCAT-COL_POS = 1.

L_FIELDCAT-KEY = 'X'.

APPEND L_FIELDCAT TO IT_FIELDCAT.

CLEAR L_FIELDCAT.

  • Position Number

CLEAR L_FIELDCAT.

L_FIELDCAT-TABNAME = 'G_T_OUTTAB'.

L_FIELDCAT-FIELDNAME = 'POSNR'.

L_FIELDCAT-SELTEXT_M = TEXT-003.

L_FIELDCAT-COL_POS = 2.

L_FIELDCAT-KEY = 'X'.

APPEND L_FIELDCAT TO IT_FIELDCAT.

CLEAR L_FIELDCAT.

Hope this will solve the problem.

Don't forget to award the points

REgards,

Vasanth

3 REPLIES 3

Former Member
0 Kudos

The field catalog is not being created successfully using the REUSE funtion. Use a break point and see the output of the REUSE_ALV_FIELDCATALOG_MERGE.

If possible try to create a structure on SE11 and use that to create the field catalog.

Regards

Ravi

Note : Please mark the helpful answers

Former Member
0 Kudos

Hello,

Since the table is T_ITEM is the user defined table u can't use the FM 'REUSE_ALV_FIELDCATALOG_MERGE'.

So u have to code like this to built the field catalog

DATA: L_FIELDCAT TYPE SLIS_FIELDCAT_ALV. " For column heading

CLEAR : IT_FIELDCAT,

IT_FIELDCAT[].

  • Sales Order Number

CLEAR L_FIELDCAT.

L_FIELDCAT-TABNAME = 'G_T_OUTTAB'.

L_FIELDCAT-FIELDNAME = 'VBELN'.

L_FIELDCAT-SELTEXT_M = TEXT-002.

L_FIELDCAT-COL_POS = 1.

L_FIELDCAT-KEY = 'X'.

APPEND L_FIELDCAT TO IT_FIELDCAT.

CLEAR L_FIELDCAT.

  • Position Number

CLEAR L_FIELDCAT.

L_FIELDCAT-TABNAME = 'G_T_OUTTAB'.

L_FIELDCAT-FIELDNAME = 'POSNR'.

L_FIELDCAT-SELTEXT_M = TEXT-003.

L_FIELDCAT-COL_POS = 2.

L_FIELDCAT-KEY = 'X'.

APPEND L_FIELDCAT TO IT_FIELDCAT.

CLEAR L_FIELDCAT.

Hope this will solve the problem.

Don't forget to award the points

REgards,

Vasanth

Former Member
0 Kudos

Please define your field catalog as ex->TS_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV.

Thanks,

Gaurav