You are on page 1of 3

ALV GRID OOPS methodology

1. Building blocks of ALV are Data internal table, Field catalog (int. table of
type LVC_T_FCAT), Layout structure (of type LVC_S_LAYO), Event handler
(event handler class is required to handle events generated from ALV
instance) and Additional data (for sorting, filtering, button deactivation etc).
2. There are three steps to generate ALV Automatic, SemiAutomatic and
Manual Generation.
3. Generating Field catalog
a. Field REF_FIELD is filled in , if the field in the data internal table is diff.
from that in Data Dictionary.
b. Field CHECKBOX needs to be filled in, if you want to display
checkboxes in the output.
c. Field DO_SUM is used to perform column summing .
d. Field EMPHASIZE is used for setting pre-defined colors for
emphasizing. It is in Cxyz format. X color number , Y intensified
display on/off , Z inverse display on/off.
e. Field HREF_HNDL defines the handle to which the URL is linked. You
must maintain the target address to this table of type LVC_S_HYPE.
f. Field NO_OUT is used to hide key fields.
g. Field KEY is used to keep a field as key and to freeze the field during
horizontal scrolling.
h. Field NO_MERGING, if set, will prevent cells of same value to be
merged during sorting.
i. Field STYLE can be used to display columns like buttons, link etc. It
should be mapped to constants like MC_STYLE..
j. Field JUST (applicable to CHAR & NUMC) for justifying the output (L, R
or C).
k. Field LZERO(applicable to only NUMC) is used for displaying Leading
zeroes.
l. Field NO_SIGN is used to high negative signs.
m. Field NO_ZERO is used for keeping cells empty incase of zero values.
4. If you are passing values in parameter I_STRUCTURE_NAME and filling the
field catalog table for method SET_TABLE_FOR_FIRST_DISPLAY, priority goes
to the former.
5. Handling Layout:
a. Field CWIDTH_OPT is used to optimize column width.
b. Field SEL_MODE enables you to select single/multiple rows/columns
(space = default, simple selection, with no buttons, A = multiple
row/column selection using buttons, B = same as space, C= multiple
rows/columns with no buttons, D = cell selection ).
c. Method GET_SELECTED_CELLS, GET_SELECTED_CELLS_ID are used for
identifying selected cells. GET_SELECTED_ROWS give information

regarding the row numbers of the selected rows.


GET_SELECTED_COLUMNS gives the information regarding column
d. If you set the cells as editable, it will overwrite the selection mode
specified.
e. Field Catalog and Layout can be changed using Methods
set_frontend_catalog and set_frontend_layout respectively.
6. Setting the Sort Conditions:
a. Use variable of type LVC_T_SORT. It has fields like SPOS (Sort Position),
Fieldname, Up (ascending) and Down (Descending).
b. To avoid any possible short dumps, good to keep NO_MERGING = X.
c. Use the methods GET_SORT_CRITERIA , SET_SORT_CRITERIA for getting
and setting them.
7. Setting the filter conditions.
a. Use variable of type LVC_T_FILT. It has conditions FIELDNAME, SIGN,
OPTION, LOW and HIGH.
b. Use methods, GET_FILTER_CONDITION & SET_FILTER_CONDITION for
getting & setting them.
8. Excluding Toolbar functions.
a. Use variable of type UI_FUNCTIONS.
b. Find the attributes starting with MC_FC and append them to a table to
be passed to SET_TABLE_FOR_FIRST_DISPLAY.
9. Coloring Individual Cells
a. Define a new field (table type) of type LVC_T_SCOL, in the data table.
b. Fill the fields FNAME (Field name, whose cell needs to be colored),
COLOR-COL (Color number), COLOR-INT (Intensity either 1 or 0).
Append this structure to Data table-new field.
c. Add the layout field CTAB_FNAME with the new field that was added to
the data table.
10.Coloring Entire row.
a. Define a new field of CHAR4 in the data table.
b. Fill the value for the new field with format CXYZ x- color number, y
intensity on/off and z-inverse on/off.
c. Add the layout field INFO_FNAME with the new field .
11.For coloring Entire column, set the field EMPHASIZE of the field catalog for
that field to the CXYZ value
12.Creating Hyperlinks.
a. Create a variable for link of type INT4 and add it to the data table (say
MATNR_LINK).
b. While generating the field catalog, assign the field WEB_FIELD of the
fcat to this field MATNR_LINK.
c. Create a new internal table of type LVC_T_HYPE for storing hyperlink
handles and URLs. Prepare the handles by assigning a number to the
field HANDLE and the URL for HREF. Append the entries to the table.
d. Loop through the data table and based on the required condition, set
the new field (MATNR_LINK) to the saved handle values .
e. Assign the hyperlink table to the parameter IT_HYPERLINK of the
method SET_TABLE_FOR_FIRST_DISPLAY.

13.Displaying fields as Dropdown list.


a. Create a variable of type INT4 and add it in data table.
b. While generating field catalog, assign the field DRDN_FIELD of fcat to
1.
c. Create a table type (type LVC_T_DROP) & structure (type LVC _S_DROP)
and assign the HANDLE to a number and VALUE to the respective
value.
d. Call the method SET_DROP_DOWN_TABLE using this table type.
14.Event handling : Create a class and methods for responding for user
commands.
15.Hotspot Clicking:
a. Set the field HOTSPOT in fieldcatalog of the field to X. create an event
handler method.
16.

You might also like