BC.I.001L - ALV Include Object Oriented - v1.20
BC.I.001L - ALV Include Object Oriented - v1.20
BC.I.001L - ALV Include Object Oriented - v1.20
Obligatory Requirements
SAP Version R/3 4.7 – 6.0 Hot Package N/A
These other components are used by this one and must be installed before it.
Dependent
Components N/A
1. General Description
This component feature is to provide performs to be used in your program and help the creation of an
ALV Report Object Oriented without direct interaction with method. They will help you to define the fields, sort,
layout and the Header for the report.
2. Installation Procedure
3. User Guide
3.2. Utilization
First Step: You need to insert the command INCLUDE ZATS_BCI001L_ALVOO in your program.
Next you need to create a New Blank Screen (e.g. 9000). All objects in this screen will be created
dynamically.
In the New Blank Screen PBO you need to create a module and follow these steps:
1- Create a module to setup the PF-STATUS.
2- In this module (or in other specific PBO module) insert a call to UPDATE_ALV_PBO_MODULE. This
perform will create the dynamically objects in the first time and manage the refresh in next PBO
executions.
After configured the report you can use some additional function to help the program.
1- Use the function SET_STABLE_ROW_COL to keep the position of ALV Report (displayed column
and row) fixed after an Event. If you don’t use this perform and an Event is executed the report show
the row 1 and column 1.
2- Use the function GET_CURR_CELL to get information about actual selected cell.
3- If you are using Editable Fields you must insert a call to UPDATE_ITABLE_EDITMODE in your
USER_COMMAND Module.
To understand the parameters of each perform above, please check this list:
3.2.1. SET_ALV_LAYOUT
Setup the Layout of ALV.
ZEBRA: ‘X’ to turn on and ‘ ‘ to turn off the change of colors for each line.
TITLE: Title of Report ALV. This is not the Header of Screen.
STYLE: When you have a field in your table that will define the color characteristics of cells in
each line.
3.2.2. SET_EVENTS
Define the Save Mode, field I_SAVE in function REUSE_ALV_GRID_DISPLAY.
The Default Value for this parameter if this perform is not used is ‘A’.
SAVE_MODE:
' ' = Display variants cannot be saved
Defined display variants (such as delivered display variants) can be selected for presentation
regardless of this indicator. However, changes cannot be saved.
3.2.3. ADD_ALV_HEADER
Include a new line in Header of Screen. This Header is displayed in a specific container that could
be resized by user.
3.2.4. SET_ALV_LEN
This is a simple way to define width of all columns in report.
COLSIZE: A string separated by semi-colon ( ; ) with the width of each columns in the same
sequence of columns of report. If you want that the width of columns respects the field size keep
its value blank, as the third column in example below.
3.2.5. ADD_FIELDCAT
Include a new column in report. It must be called using the sequence of columns that you want in
the report. During this perform the values defined in SET_ALV_LEN will be used and an internal table
declared in the include will be fulfilled with all FIELDCAT characteristics.
FIELD: Name of field in internal table. If this field was not found on RESULT_TABLE (See
UPDATE_ALV_PBO_MODULE) no column will be displayed.
TYPE: Type of field defined above. It is important because ALV will execute conversion and
summarization using this field. Common values are CHAR, NUMC, DATS and QUAN.
If you want to use a reference to a Database Field you must start the parameter with a ‘!’. E.g. ‘!
KNA1-KUNNR’.
SIZE: Internal Size of field. This is the max number of chars that will be displayed for this field.
ALIGN: Alignment of field in column. It can be ‘L’ – Left, ‘C’ – Center, ‘R’ – Right.
SHOW: Define how the column will be displayed. It can be one of the pre-defined constants:
C_SHOW - Display the Column.
C_HIDE - Insert the column in report but doesn’t display it.
C_NOZERO - Display the Column, but hide left-zeros of field.
C_FIXED - Display the Column and keep it fixed during scroll. It must be used on the
left columns.
C_ICON - Display the Column as an icon.
C_SUM - Display the Column and set it to be summarized.
C_AVG - Display the Column and set it to show the average.
TITLE: The text to be displayed in header of Column.
3.2.6. SET_ALV_SORT
This will define the pre-defined sort of report.
POS: Indicates the position of field in the Order of Sort. This is not the Column Position in report.
FIELD: Setup which field must be sorted.
UP: ‘X’ for Ascending and ‘ ‘ for Descending.
SUBTOT: ‘X’ indicates that this field will create a sub-total line in report.
3.2.7. UPDATE_ALV_PBO_MODULE
This form must be inserted in a PBO module in the New Blank Screen created.
It will create the dynamic object in the first execution and will update the report with changes
during the execution.
RESULT_TABLE: The internal table with the values that must be displayed in report with the
columns defined with ADD_FIELDCAT.
NUMBER: Identifies which ALV we are using. You can use at max 2 ALV in the same program.
REPID: Variable type sy-repid with the name of your program.
DYNNR: Number of New Blank Screen created. These parameters are used combined to create
the dynamically containers.
HDSIZE: The height of Header of Report. It is necessary when a couple of lines are defined in
ADD_ALV_HEADER and you want that user could see all of them on start.
VARIANT: When you want that the report start displaying according a specific AVL Variant.
3.2.8. SET_STABLE_ROW_COL
This form will keep the scroll position of report after an Event, like a button pressed.
If you don’t use it the report, after screen refresh (PBO Event) will return to display first row and
first column,
3.2.9. GET_CURR_CELL
This form returns the actual position of cursor.
ROW: Returns the line selected. This is the index (sy-tabix) of RESULT_TABLE passed to report.
COL: Return the name of field select. This is the name of field used in ADD_FIELDCAT.
3.2.10. UPDATE_ITABLE_EDITMODE
This form update internal table assigned with ALV with information updated in screen by user in
Edit Mode Fields.
FORM update_itable_editmode.