‎2007 Dec 12 1:59 PM
‎2007 Dec 12 2:02 PM
Hi sai,
1. when we display alv,
2. a) column headings
b) each column widths,
c) blue color for key field
d) format of display
3. All such information,
we have to provide.
4. This information is contained
in an internal table (called field catalogue)
5. This information is
gather from the fields of the internal table
and using data-dictionary.
regards,
amit m.
‎2007 Dec 12 2:08 PM
Hi,
fieldcatalog is used to register your column to be display in ALV report and you can set the format for each column.
goto se11 -> type group = 'slis'
find = 'SLIS_T_FIELDCAT_ALV' -> attributes for field catalog as a format of each column
The field cataog is a table of type LVC_T_FCAT that contains information on the fields to be displayed. Thru this we can change the properties and can set new one...like Hotspot edit and all the things...
when we display alv,
a) column headings
b) each column widths,
c) blue color for key field
d) format of display
Field Catalog is a way to seperate presentation and logic. We pass the data to ALV with the help of a itab but to display and format the data Field Catalog is used.
check the report BCALV_FIELDCAT_TEST to explore various options in field catalog.
Define fieldcatalog like this
fieldcattab TYPE slis_t_fieldcat_alv WITH HEADER LINE.
You can fill ur fieldcatalog like this
CLEAR fieldcattab.
fieldcattab-col_pos = 1.
fieldcattab-fieldname = 'ZEILE'.
fieldcattab-tabname = 'T_MSEG'.
fieldcattab-fix_column = 'X'.
fieldcattab-seltext_l = 'Item'.
Now pass ur field catalog in Function module
REUSE_ALV_LIST_DISPLAY
sample code:
If u have defined it in a table u can creaet teh fied catalog directly as belwo:
http://www.sapdevelopment.co.uk/reporting/alv/alv_variousfcat.htm
*For Function module ALV (report)
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'MARA'
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
In case if u want SUM for a certain field alone, U have to change the fieldcatalog accordingly. See the below example, i would like to disaply only he below two fields from the MARA table, in tahtc ase code as below.
So there s no need to specify all the 180 fields only the relevant fields u can chage.
FORM f9300_modify_field_cat TABLES p_fieldcat STRUCTURE lvc_s_fcat.
FIELD-SYMBOLS: <lfs_fieldcat> TYPE lvc_s_fcat.
LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.
CASE <lfs_fieldcat>-fieldname.
WHEN 'MATNR'.
<lfs_fieldcat>-hotspot = 'X'.
<lfs_fieldcat>-key = 'X'.
WHEN 'NTGEW'.
<lfs_fieldcat>-do_sum = 'X'.
WHEN OTHERS.
<lfs_fieldcat>-no_out = 'X'.
ENDCASE.
ENDLOOP.
Regds
Sivaparvathi
Please reward points if its useful.