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: 

REUSE_ALV_LIST_DISPLAY

Former Member
0 Kudos

Hi,

I am using the below code to get ALV output. It is displaying the output but not the field names in heading. Please list the error or correction to be made.

TYPE-POOLS:

SLIS.

DATA:

T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

FS_FIELDCAT LIKE LINE OF T_FIELDCAT,

FS_LAYOUT TYPE SLIS_LAYOUT_ALV ,

W_FIELDNAME(20),

W_PROG TYPE SY-REPID.

DATA:

BEGIN OF t_spfli OCCURS 0,

checkbox,

CELL TYPE SLIS_T_SPECIALCOL_ALV,

pernr(8) type c,

rate(4) type c,

rate_sap(4) type c,

END OF t_spfli.

DATA:

FS_CELL LIKE LINE OF T_SPFLI-CELL.

loop at itab_exists.

move-corresponding itab_exists to t_spfli.

append t_spfli.

endloop.

FS_FIELDCAT-FIELDNAME = 'PERNR'.

FS_FIELDCAT-REF_TABNAME = 'T_SPFLI'.

FS_FIELDCAT-COL_POS = 1.

FS_FIELDCAT-KEY = 'X'.

FS_FIELDCAT-HOTSPOT = 'X'.

APPEND FS_FIELDCAT TO T_FIELDCAT.

CLEAR FS_FIELDCAT .

FS_FIELDCAT-FIELDNAME = 'RATE'.

FS_FIELDCAT-REF_TABNAME = 'T_SPFLI'.

FS_FIELDCAT-COL_POS = 2.

FS_FIELDCAT-KEY = 'X'.

FS_FIELDCAT-HOTSPOT = 'X'.

APPEND FS_FIELDCAT TO T_FIELDCAT.

CLEAR FS_FIELDCAT .

FS_FIELDCAT-FIELDNAME = 'RATE_SAP'.

FS_FIELDCAT-REF_TABNAME = 'T_SPFLI'.

FS_FIELDCAT-COL_POS = 3.

FS_FIELDCAT-KEY = ' '.

FS_FIELDCAT-EDIT = 'X'.

APPEND FS_FIELDCAT TO T_FIELDCAT.

FS_CELL-FIELDNAME = W_FIELDNAME .

FS_CELL-COLOR-COL = 6.

FS_CELL-NOKEYCOL = 'X'.

APPEND FS_CELL TO T_SPFLI-CELL.

FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.

FS_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.

FS_LAYOUT-COLTAB_FIELDNAME = 'CELL'.

W_PROG = SY-REPID.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_PROG

IS_LAYOUT = FS_LAYOUT

IT_FIELDCAT = T_FIELDCAT

TABLES

T_OUTTAB = T_SPFLI

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

FS_FIELDCAT-REF_TABNAME = 'T_SPFLI'.

Here you are giving the Internal table name. But here you should give database table name which contains that field.

Otherwise: do like this

FS_FIELDCAT-FIELDNAME = 'RATE'.

FS_FIELDCAT-seltext_l = 'field label for RATE'.

Here no need of ref_tabname.

Regards

Sandeep REddy

3 REPLIES 3

Former Member
0 Kudos

add this field in u're catalog

ts_fieldcat-coltext = "here put the name that u want appear in ALV"

Former Member
0 Kudos

Hi,

FS_FIELDCAT-REF_TABNAME = 'T_SPFLI'.

Here you are giving the Internal table name. But here you should give database table name which contains that field.

Otherwise: do like this

FS_FIELDCAT-FIELDNAME = 'RATE'.

FS_FIELDCAT-seltext_l = 'field label for RATE'.

Here no need of ref_tabname.

Regards

Sandeep REddy

ouhamoumustapha
Active Participant
0 Kudos

Hi,

add this line to ur field catalog

FS_FIELDCAT-FIELDNAME = 'PERNR'.

FS_FIELDCAT-REF_TABNAME = 'T_SPFLI'.

FS_fieldcat-seltext_l = 'TEXXXXT'.

FS_FIELDCAT-COL_POS = 1.

FS_FIELDCAT-KEY = 'X'.

FS_FIELDCAT-HOTSPOT = 'X'.

APPEND FS_FIELDCAT TO T_FIELDCAT.

<REMOVED BY MODERATOR>

Mustapha

Edited by: Alvaro Tejada Galindo on Jun 9, 2008 3:58 PM