11-05-2014 5:08 AM
I am trying to create field catalog for list display in ALV report. While declaring internal table of type SLIS_T_FIELDCAT_ALV error is being shown that "it is unidentified " Why is it so? Suggest me most effficient way of creating field catalog.
11-05-2014 5:14 AM
Hi ,
Just try to define the Type pool before declaring internal table. I think it will work. Since the structure of SLIS_T_FIELDCAT_ALV is defined in type pool "SLIS".
ie, TYPE-POOLS:slis.
Regards,
Sajeesh
11-05-2014 5:14 AM
Hi ,
Just try to define the Type pool before declaring internal table. I think it will work. Since the structure of SLIS_T_FIELDCAT_ALV is defined in type pool "SLIS".
ie, TYPE-POOLS:slis.
Regards,
Sajeesh
11-05-2014 5:21 AM
Hi,
You can create field catalog in the following way :-
Decleration
Type-pool :SLIS
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
CONSTANTS : c_one TYPE char1 VALUE 1,
c_two TYPE char1 VALUE 2,
c_zempid TYPE char6 VALUE 'ZEMPID', (name of the field to be displayed)
c_zfname TYPE char6 VALUE 'ZFNAME',
Create Field Catalog
PERFORM field_cat USING : c_one c_zempid text-001, (Create the text value for the field)
c_two c_zfname text-002,
Field Catalog decleration
FORM field_cat USING p_c_one TYPE c
p_c_zempid TYPE c
p_text_020 TYPE c.
wa_fieldcat-col_pos = p_c_one.
wa_fieldcat-fieldname = p_c_zempid.
wa_fieldcat-seltext_m = p_text_020.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
Call the FM for ALV display.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE text-005 TYPE 'E'.
ENDIF.
Hope it helps.
11-05-2014 5:43 AM
Hi, is there any specific reason for using the variables for col_pos instead of entering direct values like wa_fieldcat-col-pos = 2 ?
11-05-2014 6:32 AM
Hi Manan,
Its a better custom to use variables/constants to store constant values or to avoid hard-coding the values at the point where we are assigning it to some other variables.
ie, We are using text elements for error messages rather than hard-coding it.
Regards,
Sajeesh
11-05-2014 6:41 AM
Hi Manan,
As Sajeesh pointed out it is always better to assign some variables than hard coding the values in the report.
Regards,
Srish
11-05-2014 5:28 AM
Hello Manan,
Use function module REUSE_ALV_FIELDCATALOG_MERGE to create a fieldcatalog.
Also define TYPE-POOLS: slis in your report to use the type group SLIS.
Regards,
Thanga