cancel
Showing results for 
Search instead for 
Did you mean: 

SET_TABLE_FOR_FIRST_DISPLAY usage

Former Member
0 Kudos

hi abapers,

i have created ALV GRID using REUSE_ALV_GRID_DISPLAY.

now i want to do using

CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY.

here i am using SLSI type pool.

My problem is what type of parameters i need to pass th method.

what type of parameters i need to pass and how can i know.

when i pass the IT_OUTTAB and IT_FIELDCATALOG parameters

it is givivng the error messgae IT_FIELDCATALOG not compatible.

please help me.

CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi abapers ,

i have used classes to display the alv grid report.

my problem is i am not getting displayed ouput.

while debugging i ma getting the output in IT_OUTTAB.

please help me where i am doing mistake in this.

REPORT Y_ALV_TEST

*report zrich_0002

no standard page heading

message-id zmm.

  • Tables.

tables: mara.

  • Global ALV Data Declarations

type-pools: slis.

  • Internal Tables

data: begin of itab occurs 0,

matnr type mara-matnr,

maktx type makt-maktx,

end of itab.

*data: itab1 like itab.

types: wa_fldcat type LVC_T_FCAT.

data: t_fldcat type wa_fldcat with header line.

  • Selection Screen

selection-screen begin of block b1 with frame title text-002 .

select-options: s_matnr for mara-matnr.

parameters: p_var(30) type c.

selection-screen end of block b1.

DATA: alv_grid type ref to cl_gui_alv_grid,

grid_custom_container type ref to cl_gui_custom_container,

grid_container type scrfname value'<b>MYGRID</b>'.

start-of-selection.

*CREATE OBJECT w_alv_grid.

CREATE OBJECT GRID_CUSTOM_CONTAINER

EXPORTING CONTAINER_NAME = GRID_CONTAINER.

CREATE OBJECT ALV_GRID

EXPORTING i_parent = GRID_CUSTOM_CONTAINER.

perform get_data.

perform call_alv.

*********************************************************************

  • Form GET_DATA

*********************************************************************

form get_data.

select maramatnr maktmaktx

into corresponding fields of table itab

from mara

inner join makt

on maramatnr = maktmatnr

where mara~matnr in s_matnr

and makt~spras = sy-langu.

*endselect.

endform.

************************************************************************

  • CALL_ALV

************************************************************************

form call_alv.

perform build_field_catalog.

CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY

  • EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

  • IS_LAYOUT = is_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

IT_OUTTAB = ITAB[]

IT_FIELDCATALOG = t_fldcat[]

  • 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.

************************************************************************

  • BUILD_FIELD_CATALOG

************************************************************************

form build_field_catalog.

t_fldcat-seltext = 'matnumber'.

t_fldcat-FIELDNAME = 'MATNR'.

t_fldcat-TABNAME = 'ITAB'.

t_fldcat-OUTPUTLEN = '18'.

append t_fldcat.

clear t_fldcat.

t_fldcat-seltext = 'matdecription'.

*wa_fieldcat-COL_POS

t_fldcat-FIELDNAME = 'MAKTX'.

t_fldcat-TABNAME = 'ITAB'.

t_fldcat-outputlen = '40'.

append t_fldcat.

endform.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Create a screen(say 9000).In its layout,drag and drop a custom container with name MYGRID.

In the PBo of the screen,uncomment the module in flow logic and paste the code

CREATE OBJECT GRID_CUSTOM_CONTAINER

EXPORTING CONTAINER_NAME = GRID_CONTAINER.

CREATE OBJECT ALV_GRID

EXPORTING i_parent = GRID_CUSTOM_CONTAINER.

perform get_data.

perform call_alv.

Kindly reward points if it helps.

Former Member
0 Kudos

hI USE THE SAME CODE YOU HAVE GIVEN WITH LITTLE CHANGE I MADE BY "CALL SCREEN 0300" STATEMENTS.

DOUBLE CLICK ON '0300' THEN CRAETE THE SCREEN, DRAW A CUSTOM CONTAINER AND GIVE THE NAME AS <b>MYGRID</b>. ITS WORKING..GIVE POINT IF IT HELPS YOU.

REPORT zanid_test

no standard page heading

message-id zmm.

  • Tables.

tables: mara.

  • Global ALV Data Declarations

type-pools: slis.

  • Internal Tables

data: begin of itab occurs 0,

matnr type mara-matnr,

maktx type makt-maktx,

end of itab.

*data: itab1 like itab.

types: wa_fldcat type LVC_T_FCAT.

data: t_fldcat type wa_fldcat with header line.

  • Selection Screen

selection-screen begin of block b1 with frame title text-002 .

select-options: s_matnr for mara-matnr.

parameters: p_var(30) type c.

selection-screen end of block b1.

DATA: alv_grid type ref to cl_gui_alv_grid,

grid_custom_container type ref to cl_gui_custom_container,

grid_container type scrfname value'MYGRID'.

start-of-selection.

*CREATE OBJECT w_alv_grid.

CREATE OBJECT GRID_CUSTOM_CONTAINER

EXPORTING CONTAINER_NAME = GRID_CONTAINER.

CREATE OBJECT ALV_GRID

EXPORTING i_parent = GRID_CUSTOM_CONTAINER.

perform get_data.

perform call_alv.

CALL SCREEN '0300'.

*********************************************************************

  • Form GET_DATA

*********************************************************************

form get_data.

select maramatnr maktmaktx

into corresponding fields of table itab

from mara

inner join makt

on maramatnr = maktmatnr

where mara~matnr in s_matnr

and makt~spras = sy-langu.

*endselect.

endform.

************************************************************************

  • CALL_ALV

************************************************************************

form call_alv.

perform build_field_catalog.

CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY

  • EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

  • IS_LAYOUT = is_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

IT_OUTTAB = ITAB[]

IT_FIELDCATALOG = t_fldcat[]

  • 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.

************************************************************************

  • BUILD_FIELD_CATALOG

************************************************************************

form build_field_catalog.

t_fldcat-seltext = 'matnumber'.

t_fldcat-FIELDNAME = 'MATNR'.

t_fldcat-TABNAME = 'ITAB'.

t_fldcat-OUTPUTLEN = '18'.

append t_fldcat.

clear t_fldcat.

t_fldcat-seltext = 'matdecription'.

*wa_fieldcat-COL_POS

t_fldcat-FIELDNAME = 'MAKTX'.

t_fldcat-TABNAME = 'ITAB'.

t_fldcat-outputlen = '40'.

append t_fldcat.

endform.<b></b>

Answers (3)

Answers (3)

andreas_mann3
Active Contributor
0 Kudos

Hi,

define as follows:

DATA fcat TYPE  lvc_t_fcat.
...
CALL METHOD grid->set_table_for_first_display
...
        changing
                   it_fieldcatalog   = fcat
                   it_outtab        =  gridtab.

regards Andreas

athavanraja
Active Contributor
0 Kudos

to know the type of parameter to pass to to transaction se24 type in the calss name (CL_GUI_ALV_GRID) click display.

now place the cursor in the method name (set_table_for_first_display) and click button <b>parameter</b>. you will now see the parameters and the associated types. Your variable should be of those associated types.

Hope this is clear.

Regards

Raja

Vinod_Chandran
Active Contributor
0 Kudos

Hi,

You can get many examples from here.

http://www.sapgenie.com/abap/controls/alvgrid.htm

Cheers

Vinod

Former Member
0 Kudos

Hi,

Check this,you should pass the FIELDCAT Table with gt_FIELDCAT[].

CALL METHOD gr_alvgrid->set_table_for_first_display

EXPORTING

is_layout = gs_layout

CHANGING

<b>it_outtab = gt_list[]

it_fieldcatalog = gt_fieldcat[]</b>

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4 .

Thanks,

Ruthra.