Application Development and Automation 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: 
Read only

Field Catalog error

Former Member
0 Likes
547

Hi ABAPers,

I have defined an internal table I_ACV in the following manner.

DATA: BEGIN OF i_acv_new OCCURS 0.

INCLUDE STRUCTURE zzscmm003.

DATA: multi(1) TYPE c,

z_ebeln TYPE ekko-ebeln,

z_elikz TYPE ekpo-elikz,

END OF i_acv_new.

DATA: i_acv LIKE i_acv_new OCCURS 0 WITH HEADER LINE.

now , while creating the field catalog, the function module doesnt work. The field catalog is blank.

REFRESH gt_fieldcat.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'I_ACV'

i_inclname = sy-repid

CHANGING

ct_fieldcat = gt_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

ENDIF.

Any way in which this can be worked around?

Help is much appreciated.

Thanks in advance.

4 REPLIES 4
Read only

Former Member
0 Likes
521

HI,

Please concentrate on Bold part below

it eill helpful to come out from ur problem.

&----


*& Report ZMV_ALV_GRID

REPORT ZMV_ALV_GRID.

TYPE-POOLS : SLIS.

TABLES : KNA1.

TYPES : BEGIN OF ty_kna1 ,

kunnr LIKE kna1-kunnr,

name1 LIKE kna1-name1,

land1 LIKE kna1-land1,

END OF ty_kna1.

DATA: it_kna1 TYPE TABLE OF ty_kna1,

WA_KNA1 TYPE TY_KNA1.

DATA : it_fieldcat TYPE slis_t_fieldcat_alv,

wa_fieldcat TYPE slis_fieldcat_alv.

DATA : wa_layout TYPE slis_layout_alv .

DATA : it_events TYPE slis_t_event ,

wa_events TYPE slis_alv_event.

DATA : it_listheader TYPE slis_t_listheader,

wa_listheader TYPE slis_listheader,

it1_listheader TYPE slis_t_listheader,

wa1_listheader TYPE slis_listheader.

data : num type sy-pagno.

INITIALIZATION.

PERFORM getevents using it_events.

PERFORM desinlayout.

START-OF-SELECTION.

PERFORM desinfieldcat.

PERFORM datafetching.

PERFORM display.

&----


*& Form getevents

----


FORM getevents USING P_IT_EVENTS TYPE SLIS_T_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = P_IT_EVENTS

EXCEPTIONS

LIST_TYPE_WRONG = 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.

READ TABLE p_it_events INTO wa_events WITH KEY name = 'TOP_OF_PAGE'.

wa_events-form = 'TOP_OF_PAGE'.

MODIFY it_events FROM wa_events TRANSPORTING form WHERE name = wa_events-name.

READ TABLE p_it_events INTO wa_events WITH KEY name = 'END_OF_LIST'.

IF sy-subrc = 0.

wa_events-form = 'END_OF_LIST'.

MODIFY it_events FROM wa_events TRANSPORTING form WHERE name = wa_events-name.

ENDIF.

ENDFORM. " getevents

&----


*& Form top-of-page

----


FORM TOP_OF_PAGE.

wa_listheader-typ = 'H'.

wa_listheader-info = 'Customer Details'.

APPEND wa_listheader TO it_listheader.

CLEAR wa_listheader.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_listheader

i_logo = 'EDSLOGO'

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

REFRESH it_listheader.

ENDFORM. "top-of-page

&----


*& Form end-of-page

----


FORM END_OF_LIST.

wa1_listheader-typ = 'H'.

wa1_listheader-info = 'Address Details'.

append wa1_listheader to it1_listheader.

clear wa1_listheader.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it1_listheader

  • i_logo =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

REFRESH it1_listheader.

ENDFORM. "end-of-page

&----


*& Form desinlayout

----


FORM desinlayout .

wa_layout-zebra = 'X'.

wa_layout-colwidth_optimize = 'X'.

*wa_layout-edit = 'X'.

  • wa_layout-edit_mode = 'X'.

ENDFORM. " desinlayout

*&----


*

*& Form desinfieldcat

*----


*

FORM desinfieldcat .

    • wa_fieldcat-row_pos = 1.*

wa_fieldcat-col_pos = 1.

wa_fieldcat-fieldname = 'KUNNR'.

wa_fieldcat-seltext_l = 'Cust Num'.

wa_fieldcat-datatype = 'CHAR'.

wa_fieldcat-outputlen = 10.

wa_fieldcat-tabname = 'IT_KNA1'.

wa_fieldcat-key = 'X'.

    • wa_fieldcat-hotspot = 'X'.*

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

    • wa_fieldcat-row_pos = 2.*

wa_fieldcat-col_pos = 2.

wa_fieldcat-fieldname = 'NAME1'.

wa_fieldcat-seltext_l = 'Name'.

wa_fieldcat-datatype = 'CHAR'.

wa_fieldcat-outputlen = 35.

wa_fieldcat-tabname = 'IT_KNA1'.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

    • wa_fieldcat-row_pos = 3.*

wa_fieldcat-col_pos = 3.

wa_fieldcat-fieldname = 'LAND1'.

wa_fieldcat-seltext_l = 'Country'.

wa_fieldcat-datatype = 'CHAR'.

wa_fieldcat-outputlen = 10.

wa_fieldcat-tabname = 'IT_KNA1'.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

ENDFORM. " desinfieldcat----


*& Form datafetching

&----


FORM datafetching .

SELECT kunnr name1 land1

FROM kna1

INTO TABLE it_kna1

  • WHERE kunnr IN s_kunnr.

UP TO 30 ROWS.

ENDFORM. " datafetching

&----


*& Form display

&----


  • text

----


FORM display .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = SY-REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

IS_LAYOUT = WA_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = IT_EVENTS

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = IT_KNA1

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.

ENDFORM. " display

Rewards points if helpful.

Read only

0 Likes
521

HI Ganesh,

Thanks for your reply.

However, the internal table I use has a table included and i cant define ith catalog for all of them one by one.

Is there any way else this can be handled?

Much Thanks!

Read only

Former Member
0 Likes
521

Hi,

You can solve this, instead of using include structure zzscmm003

declare the all fields of that structure in your i_acv_new internal table.

For example

DATA: BEGIN OF i_acv_new OCCURS 0.

  • INCLUDE STRUCTURE zzscmm003.

*zzscmm003-field1,*

*zzscmm003-field2,*

*zzscmm003-field3, ......So on*

multi(1) TYPE c,

z_ebeln TYPE ekko-ebeln,

z_elikz TYPE ekpo-elikz,

END OF i_acv_new.

Read only

vinod_vemuru2
Active Contributor
0 Likes
521

Hi Senyah,

U have use LIKE Key word in ur table definition. Then only it will build the field cat. If it is still not working then Remove the INCLUDE structure and include all the fields. Even here also u have to use LIKE. Because field cat FM will refers to dictionary.

But with out using LIKE it is not possible. But use LIKE key work only in case of ALV internal table as it is not advisable to use. But here there is no way. We have to use it.

Thans,

Vinod.