Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

'Field Catalog not Found' - ALV Grid using CustomContainer+Fcat

The Following piece of code throws 'Field Catalgo not found'

Please give me necessary changes in the code.

Thanks & Regards

Harsha Ch.

&----


*& Report ZCHK_ALV_CUSCONT1 *

*& *

&----


*& *

*& *

&----


REPORT zchk_alv_cuscont1 .

DATA itab LIKE STANDARD TABLE OF mara WITH HEADER LINE.

SELECT matnr meins mbrsh FROM mara INTO CORRESPONDING FIELDS OF TABLE itab UP TO 10 ROWS.

CALL SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

DATA fcat1 TYPE lvc_t_fcat WITH HEADER LINE.

DATA fcat TYPE STANDARD TABLE OF lvc_s_fcat.

DATA: c1 TYPE REF TO cl_gui_custom_container.

DATA: a1 TYPE REF TO cl_gui_alv_grid.

CREATE OBJECT c1 EXPORTING container_name = 'CC_ALV'.

CREATE OBJECT a1 EXPORTING i_parent = c1.

PERFORM populate_fcat.

PERFORM generate_grid.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Form POPULATE_FCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM populate_fcat .

fcat1-reptext = 'MATNR'.

fcat1-fieldname = 'MATNR'.

fcat1-col_pos = '1'.

APPEND fcat1.

CLEAR fcat1.

fcat1-reptext = 'MEINS'.

fcat1-fieldname = 'MEINS'.

fcat1-col_pos = '2'.

APPEND fcat1.

CLEAR fcat1.

fcat1-reptext = 'MBRSH'.

fcat1-fieldname = 'MBRSH'.

fcat1-col_pos = '3'.

APPEND fcat1.

CLEAR fcat1.

ENDFORM. " POPULATE_FCAT

&----


*& Form GENERATE_GRID

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM generate_grid .

CALL METHOD a1->set_table_for_first_display

  • EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

I_STRUCTURE_NAME = 'MARA'

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

  • IS_LAYOUT =

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = itab[]

  • IT_FIELDCATALOG = fcat

  • IT_SORT =

  • IT_FILTER =

  • EXCEPTIONS

  • INVALID_PARAMETER_COMBINATION = 1

  • PROGRAM_ERROR = 2

  • TOO_MANY_LINES = 3

  • others = 4

.

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. " GENERATE_GRID

Tags:
Former Member
Former Member replied

Hi,

I looks like you have named the field catalog parameter incorrectly, shouldn't it be fcat1 in your example?

CALL METHOD a1->set_table_for_first_display

EXPORTING 
I_BUFFER_ACTIVE = 
I_BYPASSING_BUFFER = 
I_CONSISTENCY_CHECK = 
I_STRUCTURE_NAME = 'MARA'

IS_VARIANT = 
I_SAVE = 
I_DEFAULT = 'X' 
IS_LAYOUT = 
IS_PRINT = 
IT_SPECIAL_GROUPS = 
IT_TOOLBAR_EXCLUDING = 
IT_HYPERLINK = 
IT_ALV_GRAPHICS = 
IT_EXCEPT_QINFO = 
CHANGING
it_outtab = itab[]

IT_FIELDCATALOG = fcat   *<------------ this should be FCAT1*
IT_SORT = 
IT_FILTER = 
EXCEPTIONS 
INVALID_PARAMETER_COMBINATION = 1 
PROGRAM_ERROR = 2 
TOO_MANY_LINES = 3 
others = 4

Darren

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question