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: 

alv report

MohitSingh
Product and Topic Expert
Product and Topic Expert
0 Kudos
143

iam getting all the field name in columns but data is not being displayed.

please review my code.

type-pools:slis.

tables: YTMOHIT_01.

data: itab type standard table of YTMOHIT_01.

data: wa type YTMOHIT_01.

data report_id like sy-repid.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: s_emplid FOR ytmohit_01-emp_id.

SELECTION-SCREEN END OF BLOCK b1.

report_id = sy-repid.

start-of-selection.

SELECT * FROM ytmohit_01 into table itab WHERE emp_id in s_emplid.

DATA: i_field_cat TYPE slis_t_fieldcat_alv .

DATA: lw_field_cat LIKE line of i_field_cat.

lw_field_cat-fieldname = 'emp_id'.

lw_field_cat-seltext_l ='employee id'.

APPEND lw_field_cat TO i_field_cat.

lw_field_cat-fieldname = 'fname'.

lw_field_cat-seltext_l ='firstname'.

APPEND lw_field_cat TO i_field_cat.

lw_field_cat-fieldname = 'lname'.

lw_field_cat-seltext_l ='lastname'.

APPEND lw_field_cat TO i_field_cat.

lw_field_cat-fieldname = 'occu'.

lw_field_cat-seltext_l ='occupation'.

APPEND lw_field_cat TO i_field_cat.

lw_field_cat-fieldname = 'joindate'.

lw_field_cat-seltext_l ='joindate'.

APPEND lw_field_cat TO i_field_cat.

lw_field_cat-fieldname = 'mnsal'.

lw_field_cat-seltext_l ='monthly salary'.

APPEND lw_field_cat TO i_field_cat.

lw_field_cat-fieldname = 'cuky'.

lw_field_cat-seltext_l ='currency'.

APPEND lw_field_cat TO i_field_cat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'report_id'

IT_FIELDCAT = i_field_cat

TABLES

t_outtab = itab

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF sy-subrc <> 0.

endif.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
119

Please use upper case in fieldcatlog and coding should be readble,i made some modfication and i did not test it.

REPORT zxyz.

type-pools:slis.

tables: YTMOHIT_01.

data: itab type standard table of YTMOHIT_01.

data: wa type YTMOHIT_01.

data report_id like sy-repid.

DATA: i_field_cat TYPE slis_t_fieldcat_alv .

DATA: lw_field_cat LIKE line of i_field_cat.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: s_emplid FOR ytmohit_01-emp_id.

SELECTION-SCREEN END OF BLOCK b1.

initilization.

report_id = sy-repid.

start-of-selection.

SELECT * FROM ytmohit_01 into table itab WHERE emp_id in s_emplid.

end-of-selection.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'EMP_ID'.

lw_field_cat-seltext_l ='employee id'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'FNAME'.

lw_field_cat-seltext_l ='firstname'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'LNAME'.

lw_field_cat-seltext_l ='lastname'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'OCCU'.

lw_field_cat-seltext_l ='occupation'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'JOINDATE'.

lw_field_cat-seltext_l ='joindate'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'MNSAL'.

lw_field_cat-seltext_l ='monthly salary'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'CUKY'.

lw_field_cat-seltext_l ='currency'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = report_id

IT_FIELDCAT = i_field_cat

TABLES

t_outtab = itab

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF sy-subrc <> 0.

endif.

Thanks

Seshu

2 REPLIES 2

Former Member
0 Kudos
119

hi,

DO the follwing changes.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = report_id

IT_FIELDCAT = i_field_cat[]

TABLES

t_outtab = itab[]

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

Former Member
0 Kudos
120

Please use upper case in fieldcatlog and coding should be readble,i made some modfication and i did not test it.

REPORT zxyz.

type-pools:slis.

tables: YTMOHIT_01.

data: itab type standard table of YTMOHIT_01.

data: wa type YTMOHIT_01.

data report_id like sy-repid.

DATA: i_field_cat TYPE slis_t_fieldcat_alv .

DATA: lw_field_cat LIKE line of i_field_cat.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: s_emplid FOR ytmohit_01-emp_id.

SELECTION-SCREEN END OF BLOCK b1.

initilization.

report_id = sy-repid.

start-of-selection.

SELECT * FROM ytmohit_01 into table itab WHERE emp_id in s_emplid.

end-of-selection.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'EMP_ID'.

lw_field_cat-seltext_l ='employee id'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'FNAME'.

lw_field_cat-seltext_l ='firstname'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'LNAME'.

lw_field_cat-seltext_l ='lastname'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'OCCU'.

lw_field_cat-seltext_l ='occupation'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'JOINDATE'.

lw_field_cat-seltext_l ='joindate'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'MNSAL'.

lw_field_cat-seltext_l ='monthly salary'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

lw_field_cat-tabname = 'YTMOHIT_01'

lw_field_cat-fieldname = 'CUKY'.

lw_field_cat-seltext_l ='currency'.

APPEND lw_field_cat TO i_field_cat.

clear lw_fieldcat_cat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = report_id

IT_FIELDCAT = i_field_cat

TABLES

t_outtab = itab

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF sy-subrc <> 0.

endif.

Thanks

Seshu