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: 

field catlog

Former Member
0 Kudos

I want to know abt field catlog ?if it is there with example, it will be better......

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sasi,

the field catalog is used in ALVs to describe the structure of the fields to be displayed in the ALV along with the positions of the fields (column positions) and technical attributes (like description, data type and length) of every field.

if your ALV has the same structure as that of a data dictionary structure or even an internal table, u can construct the field catalog by calling the REUSE_ALV_FIELDCATALOG_MERGE function module to build it auto.

Have a look at programs with patter BCALV* for more help on this and a where used list on the above function module.

Regards,

Aditya

7 REPLIES 7

Former Member
0 Kudos

HEllo,

Check this sample program.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bd4330fe-0701-0010-03be-f64659b8...

Please reward for helpful answers:

Vasanth

Former Member
0 Kudos

Go to the function module 'REUSE_ALV_LIST_DISPLAY'.

In that read documentation abt the IT_fieldcat ( Import parameter) and try to execute the following code..

tables spfli.

type-pools: slis.

DATA W_FCODE TYPE SLIS_EXTAB-FCODE.

*

*data: t_spfli TYPE SPFLI OCCURS 0 WITH HEADER LINE.

*

*select * from spfli into table t_spfli.

data : t_excluding TYPE SLIS_T_EXTAB .

*

*W_fcode = '&ETA'.

*append w_fcode to t_excluding.

*W_fcode = '&OUP'.

*append w_fcode to t_excluding.

*W_fcode = '&ODN'.

*append w_fcode to t_excluding.

*W_fcode = '&ILT'.

*append w_fcode to t_excluding.

*W_fcode = '&LFO'.

*append w_fcode to t_excluding.

*call function 'REUSE_ALV_LIST_DISPLAY'

  • EXPORTING

  • I_STRUCTURE_NAME = 'SPFLI'

    • IS_LAYOUT =

    • IT_FIELDCAT =

    • IT_EXCLUDING = T_EXCLUDING

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

data : fs_col type SLIS_LAYOUT_ALV.

data:

begin of fs_work,

check type c,

col(4) type c,

light type c value '1',

carrid type spfli-carrid,

connid type spfli-connid,

fltime type spfli-fltime,

distance type spfli-distance,

cell type slis_t_specialcol_alv,

end of fs_work.

DATA FS_CELL like line of fs_work-CELL.

parameters :

p_row type i default 5,

p_cellr type i default 6,

p_cellc type i default 3.

field-symbols <fs>.

data:

t_table like standard table

of fs_work

initial size 0.

data :

t_fieldcat TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV,

wa_fieldcat type slis_fieldcat_alv.

AT SELECTION-SCREEN .

select carrid

connid

fltime

DISTANCE

from spfli

into corresponding fields of table t_table.

if p_row not between 1 and sy-dbcnt

or p_cellr not between 1 and sy-dbcnt.

message 'Specified Row doesnot exist in the table' type 'E'.

endif.

start-of-selection.

*wa_fieldcat-row_pos = 2.

wa_fieldcat-col_pos = 3.

wa_fieldcat-fieldname = 'FLTIME'.

*wa_fieldcat-tabname =

*wa_fieldcat-currency

*wa_fieldcat-cfieldname

*wa_fieldcat-ctabname

*wa_fieldcat-ifieldname

*wa_fieldcat-quantity

*wa_fieldcat-qfieldname

*wa_fieldcat-qtabname

*wa_fieldcat-round

*wa_fieldcat-exponent

*wa_fieldcat-key = 'X'.

*wa_fieldcat-key_sel = ' '.

*wa_fieldcat-icon = 'X'.

*wa_fieldcat-symbol

*wa_fieldcat-checkbox

wa_fieldcat-just = 'C'.

*wa_fieldcat-no_sign

*wa_fieldcat-no_zero = 'X'.

*wa_fieldcat-no_out = 'X'.

*wa_fieldcat-no_convext

*wa_fieldcat-edit_mask

*wa_fieldcat-emphasize = 'C400'.

*wa_fieldcat-fix_column = 'X'.

*wa_fieldcat-do_sum = 'X'.

*wa_fieldcat-no_sum = 'X'.

*wa_fieldcat-hotspot = 'X'.

*wa_fieldcat-tech

wa_fieldcat-outputlen = 6.

*wa_fieldcat-offset

wa_fieldcat-seltext_l = 'Airline Carrierid'.

wa_fieldcat-seltext_m = 'Carrier ID'.

wa_fieldcat-seltext_s = 'Aircarrid'.

*wa_fieldcat-ddictxt

*wa_fieldcat-rollname

*wa_fieldcat-datatype

*wa_fieldcat-inttype

*wa_fieldcat-intlen

*wa_fieldcat-lowercase = 'X'.

*wa_fieldcat-ref_fieldname = 'CARRID'.

wa_fieldcat-ref_tabname = 'SPFLI'.

*wa_fieldcat-roundfieldname

*wa_fieldcat-roundtabname

*wa_fieldcat-decimalsfieldname

*wa_fieldcat-decimalstabname

*wa_fieldcat-decimals_out

*wa_fieldcat-text_fieldname

*wa_fieldcat-reptext_ddic = 'SPFLI DATA'.

*wa_fieldcat-ddic_outputlen = 8.

append wa_fieldcat to t_fieldcat.

CLEAR WA_FIELDCAT.

*wa_fieldcat-row_pos = 2.

wa_fieldcat-col_pos = 4.

wa_fieldcat-fieldname = 'DISTANCE'.

wa_fieldcat-no_zero = 'X'.

*wa_fieldcat-outputlen = 6.

*wa_fieldcat-key = 'X'.

wa_fieldcat-emphasize = 'C700'.

*wa_fieldcat-symbol = 'X'.

*wa_fieldcat-input = 'X'.

*wa_fieldcat-no_out = 'X'.

*wa_fieldcat-tech = 'X'.

*wa_fieldcat-lowercase = 'X'.

*wa_fieldcat-do_sum = 'X'.

*wa_fieldcat-just = 'C'.

wa_fieldcat-ref_tabname = 'SPFLI'.

append wa_fieldcat to t_fieldcat.

CLEAR WA_FIELDCAT.

*wa_fieldcat-row_pos = 2.

wa_fieldcat-col_pos = 1.

wa_fieldcat-fieldname = 'CARRID'.

*wa_fieldcat-outputlen = 6.

*wa_fieldcat-emphasize = 'C700'.

*wa_fieldcat-hotspot = 'X'.

*wa_fieldcat-icon = 'X'.

*wa_fieldcat-col = 'C401'.

*wa_fieldcat-symbol = 'X'.

wa_fieldcat-key = 'X'.

*wa_fieldcat-fix_column = 'X'.

*wa_fieldcat-do_sum = 'X'.

*wa_fieldcat-lzero = 'X'.

*wa_fieldcat-input = 'X'.

*wa_fieldcat-just = 'R'.

wa_fieldcat-ref_tabname = 'SPFLI'.

append wa_fieldcat to t_fieldcat.

CLEAR WA_FIELDCAT.

*wa_fieldcat-row_pos = 2.

wa_fieldcat-col_pos = 2.

wa_fieldcat-fieldname = 'CONNID'.

wa_fieldcat-outputlen = 6.

wa_fieldcat-emphasize = 'C700'.

*wa_fieldcat-hotspot = 'X'.

*wa_fieldcat-icon = 'X'.

*wa_fieldcat-col = 'C401'.

*wa_fieldcat-symbol = 'X'.

*wa_fieldcat-key = 'X'.

*wa_fieldcat-fix_column = 'X'.

*wa_fieldcat-do_sum = 'X'.

*wa_fieldcat-lzero = 'X'.

*wa_fieldcat-input = 'X'.

wa_fieldcat-just = 'R'.

wa_fieldcat-ref_tabname = 'SPFLI'.

append wa_fieldcat to t_fieldcat.

CLEAR WA_FIELDCAT.

  • Getting the column name for the cell to be colored...

loop at t_fieldcat into wa_fieldcat where col_pos eq p_cellc.

fs_cell-fieldname = wa_fieldcat-fieldname.

fs_cell-color-col = 5.

append fs_cell to fs_work-cell.

endloop.

if sy-subrc ne 0.

message 'Column position does not exist' type 'I'.

endif.

clear wa_fieldcat.

modify t_table index p_cellr from fs_work transporting cell.

  • Assigning the layout options to the layout structure...

fs_work-col = 'C910'.

fs_col-info_fieldname = 'COL'.

fs_col-box_fieldname = 'CHECK'.

fs_col-coltab_fieldname = 'CELL'.

*fs_col-no_vline = 'X'.

*fs_col-lights_fieldname = 'LIGHT'.

*fs_col-no_totalline = 'X'.

*fs_col-no_subchoice = 'X'.

fs_col-numc_sum = 'X'.

fs_col-no_input = 'X'.

fs_col-f2code = '&OUP'.

FS_COL-key_hotspot = 'X'.

modify t_table index p_row from fs_work transporting col.

call function 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_STRUCTURE_NAME =

IS_LAYOUT = fs_col

IT_FIELDCAT = T_FIELDCAT

  • IT_EXCLUDING = t_excluding

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IR_SALV_LIST_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

tables

t_outtab = t_table

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.

former_member181962
Active Contributor
0 Kudos

Field catalog is an internal table which describes how each column in an ALV report should look like. It tells what should be the output length of the column, what should be th eheading text for that field, should it be input enabled or not, etc.

For examples look at BCALV programs in se38 transaction.

Regards,

Ravi

Former Member
0 Kudos

Hi Sasi,

the field catalog is used in ALVs to describe the structure of the fields to be displayed in the ALV along with the positions of the fields (column positions) and technical attributes (like description, data type and length) of every field.

if your ALV has the same structure as that of a data dictionary structure or even an internal table, u can construct the field catalog by calling the REUSE_ALV_FIELDCATALOG_MERGE function module to build it auto.

Have a look at programs with patter BCALV* for more help on this and a where used list on the above function module.

Regards,

Aditya

Former Member
0 Kudos

field catalog fills the header for the output of ALV. It helps us put the order of the coloumns that we want in our report. The below extract code caqn help u understand better. In case u want a full code do revert back.

&----


*& Form fill_field_catalog

&----


  • text

----


FORM fill_field_catalog.

PERFORM build_catalog USING:

'LAND1' 'TBL_FINAL' text-026 'C' '01',

'DATE' 'TBL_FINAL' text-020 'C' '02',

'TEXT' 'TBL_FINAL' text-021 'C' '03',

'INDICATOR' 'TBL_FINAL' text-027 'C' '04',

'WAERS' 'TBL_FINAL' text-022 'C' '05',

'WRBTR' 'TBL_FINAL' text-023 'N' '06'.

ENDFORM. " fill_field_catalog

&----


*& Form build_catalog

&----


  • text

----


FORM build_catalog USING p_fieldname

p_table

p_short

p_type

p_col.

st_alv_fieldcat-fieldname = p_fieldname.

st_alv_fieldcat-tabname = p_table.

st_alv_fieldcat-seltext_s = p_short.

st_alv_fieldcat-seltext_m = p_short.

st_alv_fieldcat-seltext_l = p_short.

st_alv_fieldcat-col_pos = p_col.

IF p_type EQ 'C'.

st_alv_fieldcat-key = 'X'.

ELSE. "move packed info to right

st_alv_fieldcat-just = 'R'."L-Left R- Right C-center

ENDIF.

st_alv_fieldcat-outputlen = '15'.

IF st_alv_fieldcat-fieldname EQ 'TEXT'.

st_alv_fieldcat-outputlen = '40'.

ENDIF.

APPEND st_alv_fieldcat TO w_alv_fieldcat.

CLEAR st_alv_fieldcat.

ENDFORM. " build_catalog

&----


*& Form alv_grid_display

&----


  • text

----


FORM alv_grid_display.

  • optimize width

st_alv_settings-no_colwopt = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_alv_repid

i_callback_top_of_page = w_alv_top_of_page "'TOP_OF_PAGE'

i_background_id = 'ALV_BACKGROUND'

i_grid_settings = st_alv_settings

is_layout = st_alv_layout

it_fieldcat = w_alv_fieldcat

it_sort = tbl_alv_sort

is_variant = st_alv_variant

it_events = w_alv_events

i_save = 'A'

TABLES

t_outtab = tbl_final

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.

ENDFORM. " alv_grid_display

If found useful reward with points

Former Member
0 Kudos

Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields).

A field catalog is required for every ALV list output.

The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module

Supports the creation of the field catalog for the ALV function modules based either on a structure or table defined in the ABAP Data Dictionary, or a program-internal table.

Former Member
0 Kudos

done