What is alv report?

hi guys, i would like to know the functionality of ALV reports.Please help me in this regard.
reward points if answered.
thanks in advance.

Hi,
  ALV is ABAP LIST VIEWER.
To have more functionalities like totals, subtotals,logos,etc we choose ALVs compared to reports.
Check this:
Documentation on alv:
you can check out:
http://www.****************/Tutorials/ALV/ALVMainPage.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
ABAP List Viewer
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
This helps us to implement all the features mentioned very effectively.
Using ALV, We can have three types of reports:
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
There are some function modules which will enable to produce the above reports without much effort.
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
iii. I_callback_user_command : routine where the function codes are handled
iv. I_structure name : name of the dictionary table
v. Is_layout : structure to set the layout of the report
vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to
populate a fieldcatalog which is essential to display the data in ALV.
If the output data is from a single dictionary table and all the
columns are selected, then we need not exclusively create the field cat
alog. Its enough to mention the table name as a parameter
(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases
we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table
iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events
for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action
Key : only when typ is ‘S’.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block
II. it_fieldcat : field catalog
III. i_tabname : internal table name with output data
IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the
output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field
names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output
ii. t_outtab_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary)
E. ref_tabname : table (dictionary)
F. key(1) : column with key-color
G. icon(1) : icon
H. symbol(1) : symbol
I. checkbox(1) : checkbox
J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
some theory regarding alv:
This table tells ALV which events are processed by the caller by CALLBACK.
The table of possible events per list type can be initialized using the module REUSE_ALV_EVENTS_GET.
You can display the names of the constants in the type pools SLIS which represent the individual events using the individual test function in the function module
REUSE_ALV_EVENT_NAMES_GET. Only events with a form routine name are processed.
The table structure contains the fields:
• IT_EVENTS-NAME
Name of the Callback event.
Possible Callback events:
• Action
USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD
Process actions on the list
As this is a frequently-used Callback event, the form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_USER_COMMAND.
PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB
If a user list status is to be set, it must be done in the form routine assigned to this event. The ALV function codes, which must not be active, are in the Parameter RT_EXTAB. This table must be passed with the SET PF-STATUS command (with inactive user function codes as well, if necessary).
The STANDARD status of the function group SALV should be used as a template for a user-specific status.
As this is a frequently-used Callback event, its form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_PF_STATUS_SET.
ITEM_DATA_EXPAND USING RS_SELFIELD TYPE SLIS_SELFIELD RFLG_ALL TYPE C
Only relevant for hierarchical-sequential lists using the layout parameter IS_LAYOUT-EXPAND_FIELDNAME of the structure IS_LAYOUT.
Exit for passing item entries (ITEM table) for a header record which was expanded interactively by the user.
RS_SELFIELD-TABINDEX contains the header table index for which the item entries are to be put in the global item output table (T_OUTTAB_SLAVE). The Callback is only called if ALV has no items for a header which is to be expanded.
RFLG_ALL is passed with 'X' if the user shows all items. The application must ensure that entries are not repeated in the item table. RS_SELFIELD is initial in this case.
CALLER_EXIT USING RS_DATA Is called at the beginning of the function module to make special settings. It is not usually used.
• List processing events
IMPORTANT: The application Callback routine must not manipulate the internal output table and/or its header record. This restriction applies to all Callbacks which are called in the list output and run under the 'List processing events'.
TOP_OF_LIST no USING parameter. Information output at the start of the list
END_OF_LIST no USING parameter. Information output at the end of the list
TOP_OF_PAGE no USING parameter
Equivalent to the list processing TOP-OF-PAGE event
END_OF_PAGE no USING parameter. Not available for hierarchical-sequential lists.
Information output at the end of a page. This is only called for printing.
TOP_OF_COVERPAGE no USING parameter
The selection information and list status are output together (if they exist) on a separate page by default. See also the documentation of the parameters:
IS_PRINT-NO_COVERPAGE
IS_PRINT-NO_PRINT_SELINFOS
IS_PRINT-NO_PRINT_LISTINFOS
IS_LAYOUT-GET_SELINFOS
The user can format the header area of the 'cover page' himself or herself by specifying a Callback routine for this event.
END_OF_COVERPAGE no USING parameter
Analogously to TOP_OF_COVERPAGE the user can add other information to the information output by ALV (selection information, list status) at this event.
FOREIGN_TOP_OF_PAGE no USING parameter
The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV).
In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV. When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.
FOREIGN_END_OF_PAGE no USING parameter
The event end-of-page is always processed in ALV and only passed to the caller via callback. This is still the case, e.g. when the caller processes a details list which was not formatted by ALV (e.g. a popup with further information about selected list records which were displayed by ALV).
In this case, end-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event end-of-page still occurs in ALV. When ALV notices an end-of-page that was not caused by an ALV output, the form routine in FOREIGN_END_OF_PAGE is called.
BEFORE_LINE_OUTPUT USING RS_LINEINFO TYPE SLIS_LINEINFO
Output information before each output line. Should only be used in justified cases because it costs a lot of performance.
AFTER_LINE_OUTPUT USING RS_LINEINFO TYPE SLIS_LINEINFO
Output information after each output line. Should only be used in justified cases because it costs a lot of performance.
• Internal use only
LIST_MODIFY USING R_TABNAME TYPE SLIS_TABNAME
R_INDEX LIKE SY-TABIX
R_INDEX_ITEM LIKE SY-TABIX
R_INDEX_SUM LIKE SY-TABIX
• IT_EVENTS-FORM
Name of the form routine which should be called in the calling program at the event.
Field_catalog:
Field catalog with field descriptions
2.7.1. Description
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
See also the documentation of the function module REUSE_ALV_FIELDCATALOG_MERGE.
The minimal field catalog is documented under 'default'. The caller can use the other optional parameters to assign output attributes to a field which differ from the default.
A field catalog need not be built-up and passed explicitly only under the following conditions:
• The internal table to be output has the same structure as a Data Dictionary structure which is referred to in the internal table declaration using LIKE or INCLUDE STRUCTURE.
• all fields in this structure are to be output
• the structure name is passed to ALV in the parameter I_STRUCTURE_NAME.
See also the documentation of the IMPORTING paramter I_STRUCTURE_NAME.
Positioning
• row_pos (row position)
value set: 0, 1 - 3
Only relevant if the list output is to be multi-line (two or three lines) by default.
A multi-line list can also be defined by the user interactively if the default list is one-line.
The parameter specifies the relative output line of the column in a multi-line list.
• col_pos (column position)
value set: 0, 1 - 60
only relevant when the default relative column positions differ from the field catalog field sequence. The parameter specifies the relative column position of the field in the list output. The column order can be changed interactively by the user. If this parameter is initial for all field catalog entries, columns appear in the field catalog field sequence.
Identification
• fieldname (field name)
value set: internal output table field name (required parameter)
Name of the internal output table field which is described by this field catalog entry
• tabname (internal output table)
value set: SPACE, internal output table name
This parameter is used in 'manual' field catalog build-up only for hierarchical-sequential lists.
Name of the internal output table which contains the field FIELDCAT-FIELDNAME.
Data Dictionary reference
• ref_fieldname (reference field name)
value set: SPACE, Data Dictionary field name
Name of the Data Dictionary field referred to.
This parameter is only used when the internal output table field described by the current field catalog entry has a reference to the Data Dictionary (not a program field), and the field name in the internal output table is different from the name of the field in the Data Dictionary. If the field names are identical, naming the Data Dictionary structure or table in the FIELDCAT-REF_TABNAME parameter is sufficient.
• ref_tabname (reference table/structure field name)
value set: SPACE, name of a Data Dictionary structure or table
Structure or table name of the referred Data Dictionary field.
This parameter is only used when the internal output table field described by the current field catalog entry has a Data Dictionary reference (not a program field).
Reference to fields with currency/measurement unit
Each internal output table sum or quantity field whose decimal places are to be formatted appropriately for the unit in the list must follow the convention:
• the field is of data type QUAN or CURR (internal type P) (the field must really have this physical data type. Overwriting the physical data type with the parameter FIELDCAT-DATATYPE has no effect)
• There is a field in the internal output table which contains the associated unit.
• There is also an entry in the field catalog for the unit field.
(If the unit is not to appear as a column in the list, and cannot be interactively displayed as a column, e.g. because it is always unambiguous and is therefore explicitly output by the caller in the list header, the field catalog units field entry can take the parameter FIELDCAT-TECH = 'X'.
The association of a value field to a unit affects the output as follows:
• appropriate decimal places display for the unit
• an initialized field with a link to a non-initial unit is output as '0' for the unit (if FIELDCAT-NO_ZERO is initial). When this field is summed, this unit affects whether the units are homogeneous.
• an initialized field with a link to an initial unit is output as SPACE. When this field is summed, the unit SPACE does not affect the homogeneity of the units.
• When non-initial fields with an initial unit are summed, the unit SPACE is considered to be a unit.
Link to currency unit
• cfieldname (currency unit field name)
value set: SPACE, output table field name
Only relevant for amount columns with associated unit.
Name of the internal output table field containing the currency unit associated with the amount field FIELDCAT-FIELDNAME. The field in FIELDCAT-CFIELDNAME must have its own field catalog entry.
• ctabname (internal currency unit field output table)
value set: SPACE, output table field name
only relevant for hierarchical-sequential lists
Name of the internal output table containing the FIELDCAT-CFIELDNAME field.
Link to measurement unit
• qfieldname (measurement unit field name)
value set: SPACE, output table field name
only relevant for quantity columns with unit link.
Name of the internal output table field containing the measurement unit associated with the quantity field FIELDCAT-FIELDNAME.
The field in FIELDCAT-QFIELDNAME must have its own field catalog entry.
• qtabname (internal measurement unit field output table)
value set: SPACE, output table field name
only relevant for hierarchical-sequential lists
Name of the internal output table containing the FIELDCAT-QFIELDNAME field.
Column output options
• outputlen (column width)
value set: 0 (initial), n
For fields with a Data Dictionary link this parameter can be left initial.
For fields without a Data Dictionary link (program field) the parameter must be given the value of the desired field list output length (column width).
initial = column width is the output length of the referred Data Dictionary field (domain).
n = column width is n characters
• key (key column)
value set: SPACE, 'X' 'X' = kex field (key field output in color)
Key fields can not be interactively hidden. Parameter FIELDCAT-NO_OUT must be left initial.
For exceptions see the documentation of the FIELDCAT-KEY_SEL parameter.
• key_sel (hideable key column)
value set: SPACE, 'X'
only relevant when FIELDCAT-KEY = 'X'
Key field which can be hidden interactively.
The key column sequence cannot be changed interactively by the user.
The output is controlled by the FIELDCAT-NO_OUT parameter analogously to non-key fields.
• no_out (field in field list)
value set: SPACE, 'X' 'X' = field is not displayed in the current list.
The user can interactively choose the field for output from the field list.
The user can display the contents of these fields at line level using the 'Detail' function.
See also the 'Detail screen' documentation of the parameter IS_LAYOUT.
• tech (technical field)
value set: SPACE, 'X' 'X' = technical field
Field cannot be output in the list and cannot be displayed interactively.
Field can only be used in the field catalog (not in IT_SORT, ...).
• emphasize (highlight columns in color)
value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off '1'=on)
'X' = column is colored with the default column highlight color.
'Cxyz' = column is colored with a coded color:
• C: Color (coding must begin with C)
• x: color number
• y: bold
• z: inverse
• hotspot (column as hotspot)
value set: SPACE, 'X'
'X' = column cells are output as hotspots
• fix_column (fix column)
value set: SPACE, 'X'
Not relevant for block lists (output of several lists consecutively)
'X' = column fixed (does not scroll horizontally)
All columns to be fixed must have this flag, starting from the left. If a column without this flag is output, only the columns to the left of this column are fixed. The user can change the column fixing interactively. See also the documentation of the Layout parameter
IS_LAYOUT-NO_KEYFIX of the IMPORTING paramter IS_LAYOUT.
• do_sum (sum over column)
value set: SPACE, 'X' 'X' = a sum is to be calculated over this internal output table field.
This function can also be called by the user interactively.
• no_sum (sums forbidden)
value set: SPACE, 'X' 'X' = no sum can be calculated over this field, although the data type of the field would allow summing.
• input (column ready for input)
Function not available
Format column contents
• icon
value set: SPACE, 'X' 'X' = column contents to be output as an icon.
The caller must consider the printability of icons.
• symbol
value set: SPACE, 'X' 'X' = column contents are to be output as a symbol.
The internal output table column must be a valid symbol character.
The caller must consider the printability of symbols.
Symbols can usually be printed, but may not always be output correctly, depending on the printer configuration.
• just (justification)
value set: SPACE, 'R', 'L', 'C'
Only relevant for fields of data type CHAR or NUMC
' ' = default justification for this data type
'R' = right-justified output
'L' = left-justified output
'C' = centered output
The justification of the column header always follows the justification of the columns. Independent justification of the column neader is not possible.
• lzero (leading zeros)
value set: SPACE, 'X'
Only relevant for fields of data type NUMC
ALV outputs NUMC fields right-justified without leading zeros by default.
'X' = output with leading zeros
Note: If a NUMC field is output left-justified or centered by FIELDCAT-JUST, leading zeros are output. If the output of leading zeros is suppressed by a Data Dictionary reference ALPHA conversion exit, the output is always left-justified.
• no_sign (no +/- sign) Only relevant for value fields
value set: SPACE, 'X' 'X' = value output without +/ sign
• no_zero (suppress zeros) Only relevant for value fields
value set: SPACE, 'X' 'X' = suppress zeros
• edit_mask (field formatting)
value set: SPACE, template
template = see documentation of WRITE formatting option USING EDIT MASK template
The output conversion conv can be made by template = '== conv'.
Texts
The following text parameters should be specified for program fields without a Data Dictionary reference. The texts are taken from the Data Dictionary for fields with a Data Dictionary reference. If this is not desired, the text parameters can also be specified. The Data Dictionary texts are then ignored. If the user changes the column width interactively, the column header text with the appropriate length is always used. The interactive function 'Optimize column width' takes account of both the field contents and the column headers: if all field contents are shorter than the shortest column header, the column width depends on the column header.
The 'long field label' is also used in display variant definition, sort, etc. popups.
• seltext_l (long field label)
• seltext_m (medium field label)
• seltext_s (short field label)
• reptext_ddic (header)
analogous to the Data element maintenance 'Header'
The specified text is not necessarily output in the list, an optimum among all texts is sought.
• ddictxt (specify text)
value set: SPACE, 'L', 'M', 'S'
You can specify with values 'L', 'M', and 'S', the keyword that should always be used as column header. If the column width changes, no attempt is made in this case to find an appropriate header for the new output width.
Parameters for program fields without Data Dictionary reference
see also 'Text' parameters
• datatype (data type)
value set: SPACE, Data Dictionary data type (CHAR, NUMC,...)
Only relevant for fields without Data Dictionary reference
Program field data type
• ddic_outputlen (external output length)
value set: 0 (initial), n
Only relevant for fields without Data Dictionary reference whose output is nevertheless to be modified by a conversion exit.
Prerequisites:
• FIELDCAT-EDIT_MASK = '==conv'
see also the documentation of the parameter FIELDCAT-EDIT_MASK
• FIELDCAT-INTLEN = n
see also the documentation of the parameter FIELDCAT-INTLEN
n = external format field output length
The column width FIELDCAT-OUTPUTLEN need not be the same as the external format output length (FIELDCAT-DDIC_OUTPUTLEN).
• intlen (internal output length)
value set: 0 (initial), n
Only relevant for fields without Data Dictionary reference whose output is nevertheless to be modified by a conversion exit.
Prerequisites:
• FIELDCAT-EDIT_MASK = '==conv'
see also the documentation of the parameter FIELDCAT-EDIT_MASK
• FIELDCAT-DDIC_OUTPUTLEN = n
see also the documentation of the parameter FIELDCAT-DDIC_OUTPUTLEN
n = internal format field output length
• rollname (data element)
value set: SPACE, Data Dictionary data element name
F1 help can be provided for a program field without a Data Dictionary reference, or F1 help which differs from the Data Dictionary help can be provided for a field with a Data Dictionary reference, using this parameter.
When F1 help is called for this field, the documentation of the specified data element is displayed.
If the FIELDCAT-ROLLNAME is initial for fields with a Data Dictionary reference, the documentation of the data element of the referred Data Dictionary field is output.
Others
• sp_group (field group key)
value set: SPACE, CHAR(1)
Field group key.
Keys are assigned to group names in the IT_SPECIAL_GROUPS parameter (see also the documentation of the parameter IT_SPECIAL_GROUPS).
When such an assignment is made in the field catalog and in IT_SPECIAL_GROUPS, the fields are grouped correspondingly in the display variant popup.
• reprep (Report/Report interface selection criterion)
value set: SPACE, 'X'
Prerequisites:
• The system contains the Report/Report interface (function group RSTI, table TRSTI)
• Parameter LAYOUT-REPREP = 'X'
(see also the documentation of the parameter LAYOUT-REPREP of the IMPORTING parameter IS_LAYOUT )
'X' = When the Report/Report interface is called, the value of this field is passed in the selected interface start record as a selection criterion.
2.7.2. Default
• The following entries are usually sufficient for internal table fields with a reference to a field defined in the Data Dictionary :
• fieldname
• ref_tabname
Notes:
ALV gets the remaining information from the Data Dictionary.
If no relative column position (COL_POS) is specified, the fields are output in the list in the order in which they were added to the field catalog.
REF_FIELDNAME need only be specifid when the name of the internal table field differs from the name of the referred Data Dictionary field.
Information which is explicitly entered in the field catalog is not overwritten by information from the Data Dictionary.
Priority rule:
Entries in the field catalog have priority over differing entries in the Data Dictionary.
• The following entries are usually sufficient for internal table fields without a reference to the Data Dictionary (program fields):
• fieldname
• outputlen
• datatype
• seltext_s
• seltext_m
• seltext_l
Notes:
F1 help can be provided for program fields by assigning a data element to the parameter ROLLNAME.
If the parameters SELTEXT_S, SELTEXT_M, SELTEXT_L, and REPTEXT_DDIC contain appropriate field labels, the program field column headers are also adjusted appropriately when the column width changes
sites :
http://www.sapdevelopment.co.uk/reporting/alv/alv_variousfcat.htm
Check out these links : top one is on slis specifcally,
How to know about these SLIS types?
Re: sap alv examples
ALV reporting - Step by step
http://help.sap.com/saphelp_nw04/helpdata/en/8d/e994374c9cd355e10000009b38f8cf/frameset.htm
Go through with these links :
ALV
http://www.geocities.com/mpioud/Abap_programs.html
ALV Group Heading
http://www.sap-img.com/fu037.htm
ALVGRID with refresh
http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.htm
Editable ALV
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
-->download the PDF from following link.
www.abap4.it/download/ALV.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
OOPS ALV tutorial.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
Sample programs:
http://www.geocities.com/victorav15/sapr3/abap_ood.html#d_grid
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
You can get all demo programs for ALV:
Go to se38 and type BCALV* and press F4 for all demo porgrams.
Check out these links
http://www.sap-img.com/abap/what-is-alv-programming.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/alv&
http://www.sap-img.com/abap/an-interactive-alv-report.htm
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/cs/user/view/cs_msg/18628
Regards

Similar Messages

  • What is the  difference between list display and grid display in alv report

    Hai genious
    i am a new of the abap, i dont know the alv report, i have a small doubt, can u please tell me  what is the main difference between list display and grid display in alv report
    thanks&regards
    chinnu

    Hi ,
    1. For all practical purposes, they are the same.
    2. Some differences:
    a) from abap coding point of view,
    alv list is done with Function modules,
    alv gris can also be done with FM,
    but can also be done using OO concepts.
    b) Alv grid (using oo concept) requires
    designing the screen layout .
    Hence, in one screen, we can show more
    then one alv grid
    (we cannot show more than
    one alv list on one screen)
    c) ALV grid uses ActiveX controls
    present on the Presentation Server.
    Hence, it consumes More Memory
    on the presentation server.
    d) ALV LIST is Display Only.
    Whereas
    ALV Grid Can Be made EDITABLE for entry purpose.
    e) In alv grid, these options are possible,
    but not in alv list.
    without horizontal lines
    without vertical lines
    without cell merging during sorts
    display total lines above the entries
    I hope it helps.
    Regards,
    Mamta
    Edited by: Mamta Verma on Nov 27, 2008 6:41 AM

  • What are main events in that are used in ALV reports

    hi gurus
    what are main events in that are used in ALV reports....
    regards
    baskar

    hi
    i think this will help u.
    Events in alv and their FM    The main events in alv and their FM and why we use these: 
    1. SLIS_PRINT_ALV. 
    2. SLIS_T_LISTHEADER. 
    3. SLIS_T_EVENT. 
    4. SLIS_T_SORTINFO_ALV. 
    5. SLIS_T_LAYOUT_ALV. 
    6. SLIS_T_FIELDCAT_ALV. 
    and in classic reports what is the sequence of events:   === Events are 
    At selection-screen output. 
    Initialization. 
    At selection-screen on field 
    At selection-screen on end of field 
    At selection-screen on Radiobutton Group R1. (If you have any radio buttons) 
    At selection-screen on block b1. (If you have any blocks) 
    Start-of-selection. 
    Get node. (if the data is retreived from a logical database) 
    Get node late. (if the data is retreived from a logical database) 
    Top-of-page. (if the write statement is in the end-of-selection event or we can say that before the first write statement) 
    end-of-selection. 
    and fuction modules are 
    LISTHEADER - Is used to print the header information in the ALV List. Name, Date, Time, ALV Name and other details are called as Header information.   EVENT - Basically this is the FM to handle Event's. When the user needs to do some event operation like when double clicking the a particular field we need to perform some operation.   These events are captured by this FM.   LAYOUT - This FM is used to define the layout of the List. There are many options available in this FM to define the Layout style.   FIELDCAT - These are used to populate the List header. We can change them according to our req. 
    User-defined Text Output Event
        Application
          print_end_of_list
        Define output text to be printed at the end of the entire list
          print_top_of_list
        Define output text to be printed at the beginning of the entire list
          print_end_of_page
        Define output text to be printed at the end of each page
          print_top_of_page
        Define output text to be printed at the beginning of each page
          subtotal_text
        Define self-defined subtotals texts
    Mouse-controlled Actions in the Grid Control Event
        Application
          button_click
        Query a click on a pushbutton in the ALV Grid Control
          double_click
        Query a double-click on a cell of the ALV Grid control 
          hotspot_click
        Query a hotspot click on columns defined for this purpose in advance
          onDrag
        Collect information when elements of the ALV Grid Control are dragged 
          onDrop
        Process information when elements of the ALV Grid Control are dropped 
          onDropComplete
        Perform final actions after successful Drag&Drop 
          onDropGetFlavor
        Distinguish between options for Drag&Drop behavior
    Processing of Self-defined and Standard Functions Event
        Application
          before_user_command
        Query self-defined and standard function codes
          user_command
        Query self-defined function codes
          after_user_command
        Query self-defined and standard function codes
    Definition of Self-defined Functions Event
        Application
          toolbar
        Change, delete or add GUI elements in the toolbar
          menu_button
        Define menus for menu buttons in the toolbar
          context_menu_request
        Change context menu
          onf1
        Define self-defined F1 help
    All of these can be found under type group SLIS.
    Events
    SLIS_EV_ITEM_DATA_EXPAND        TYPE SLIS_FORMNAME VALUE 'ITEM_DATA_EXPAND',
    SLIS_EV_REPREP_SEL_MODIFY       TYPE SLIS_FORMNAME VALUE 'REPREP_SEL_MODIFY', SLIS_EV_CALLER_EXIT_AT_START TYPE SLIS_FORMNAME VALUE 'CALLER_EXIT',
    SLIS_EV_USER_COMMAND              TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',
    SLIS_EV_TOP_OF_PAGE                     TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
    SLIS_EV_DATA_CHANGED                TYPE SLIS_FORMNAME VALUE 'DATA_CHANGED',
    SLIS_EV_TOP_OF_COVERPAGE       TYPE SLIS_FORMNAME VALUE 'TOP_OF_COVERPAGE',
    SLIS_EV_END_OF_COVERPAGE       TYPE SLIS_FORMNAME VALUE 'END_OF_COVERPAGE',
    SLIS_EV_FOREIGN_TOP_OF_PAGE TYPE SLIS_FORMNAME
    VALUE 'FOREIGN_TOP_OF_PAGE', SLIS_EV_FOREIGN_END_OF_PAGE TYPE SLIS_FORMNAME
    VALUE 'FOREIGN_END_OF_PAGE',
    SLIS_EV_PF_STATUS_SET                  TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
    SLIS_EV_LIST_MODIFY                      TYPE SLIS_FORMNAME VALUE 'LIST_MODIFY',
    SLIS_EV_TOP_OF_LIST                       TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST',
    SLIS_EV_END_OF_PAGE                    TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE',
    SLIS_EV_END_OF_LIST                      TYPE SLIS_FORMNAME VALUE 'END_OF_LIST',
    SLIS_EV_AFTER_LINE_OUTPUT       TYPE SLIS_FORMNAME VALUE 'AFTER_LINE_OUTPUT', SLIS_EV_BEFORE_LINE_OUTPUT     TYPE SLIS_FORMNAME VALUE 'BEFORE_LINE_OUTPUT',
    SLIS_EV_SUBTOTAL_TEXT                TYPE SLIS_FORMNAME VALUE 'SUBTOTAL_TEXT'.
    with regards
    sravani
    award points if found useful.

  • What is a interactive ALV Report.

    Hi,
    what is a interactive ALV Report.
    plz, Explain the Use and Notes,Advise Me.
    By,
    Jeevan.S

    hi,
    search in SCN
    go to adavanced search link
    https://www.sdn.sap.com/irj/scn/advancedsearch
    and write "Interactive Report"
    you will find lots of threads there.
    thanks
    Sachin

  • What is parent child alv report

    what is parent child ALV report?

    Hi,
    I thing u r asking about Hierarchial sequential list display report.
    Kindly go through the below report it may helps to u the concept of parent child report.
    REPORT  YMS_HIERSEQLISTDISPLAY                      .
    Program with FM REUSE_ALV_HIERSEQ_LIST_DISPLAY                      *
    Author : Michel PIOUD                                               *
    Email : [email protected]  HomePage : http://www.geocities.com/mpioud *
    TYPE-POOLS: slis.                    " ALV Global types
    CONSTANTS :
      c_x VALUE 'X',
      c_gt_vbap TYPE SLIS_TABNAME VALUE 'GT_VBAP',
      c_gt_vbak TYPE SLIS_TABNAME VALUE 'GT_VBAK'.
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.    "#EC NEEDED
    PARAMETERS p_max(02) TYPE n DEFAULT '10' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_2 FOR FIELD p_expand. "#EC NEEDED
    PARAMETERS p_expand AS CHECKBOX DEFAULT c_x.
    SELECTION-SCREEN END OF LINE.
    TYPES :
    1st Table
      BEGIN OF ty_vbak,
        vbeln TYPE vbak-vbeln,             " Sales document
        kunnr TYPE vbak-kunnr,             " Sold-to party
        netwr TYPE vbak-netwr,             " Net Value of the Sales Order
        erdat TYPE vbak-erdat,             " Creation date
        waerk TYPE vbak-waerk,             " SD document currency
        expand TYPE xfeld,
      END OF ty_vbak,
    2nd Table
      BEGIN OF ty_vbap,
        vbeln TYPE vbap-vbeln,             " Sales document
        posnr TYPE vbap-posnr,             " Sales document
        matnr TYPE vbap-matnr,             " Material number
        netwr TYPE vbap-netwr,             " Net Value of the Sales Order
        waerk TYPE vbap-waerk,             " SD document currency
      END OF ty_vbap.
    DATA :
    1st Table
      gt_vbak TYPE TABLE OF ty_vbak,
    2nd Table
      gt_vbap TYPE TABLE OF ty_vbap.
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.
      v_2 = 'With ''EXPAND'' field'.
    START-OF-SELECTION.
    Read Sales Document: Header Data
      SELECT vbeln kunnr netwr waerk erdat
        FROM vbak
          UP TO p_max ROWS
        INTO CORRESPONDING FIELDS OF TABLE gt_vbak.
      IF NOT gt_vbak[] IS INITIAL.
      Read Sales Document: Item Data
        SELECT vbeln posnr matnr netwr waerk
          FROM vbap
          INTO CORRESPONDING FIELDS OF TABLE gt_vbap
           FOR ALL ENTRIES IN gt_vbak
         WHERE vbeln = gt_vbak-vbeln.
      ENDIF.
      PERFORM f_display.
          Form  F_DISPLAY
    FORM f_display.
    Macro definition
      DEFINE m_fieldcat.
        ls_fieldcat-tabname = &1.
        ls_fieldcat-fieldname = &2.
        ls_fieldcat-ref_tabname = &3.
        ls_fieldcat-cfieldname = &4.       " Field with currency unit
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_sort.
        ls_sort-tabname = &1.
        ls_sort-fieldname = &2.
        ls_sort-up        = c_x.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_layout   TYPE slis_layout_alv,
        ls_keyinfo  TYPE slis_keyinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        lt_sort     TYPE slis_t_sortinfo_alv," Sort table
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv." Field catalog
      ls_layout-group_change_edit = c_x.
      ls_layout-colwidth_optimize = c_x.
      ls_layout-zebra             = c_x.
      ls_layout-detail_popup      = c_x.
      ls_layout-get_selinfos      = c_x.
      IF p_expand = c_x.
        ls_layout-expand_fieldname  = 'EXPAND'.
      ENDIF.
    Build field catalog and sort table
      m_fieldcat c_gt_vbak 'VBELN' 'VBAK' ''.
      m_fieldcat c_gt_vbak 'KUNNR' 'VBAK' ''.
      m_fieldcat c_gt_vbak 'NETWR' 'VBAK' 'WAERK'.
      m_fieldcat c_gt_vbak 'WAERK' 'VBAK' ''.
      m_fieldcat c_gt_vbak 'ERDAT' 'VBAK' ''.
      m_fieldcat c_gt_vbap 'POSNR' 'VBAP' ''.
      m_fieldcat c_gt_vbap 'MATNR' 'VBAP' ''.
      m_fieldcat c_gt_vbap 'NETWR' 'VBAP' 'WAERK'.
      m_fieldcat c_gt_vbap 'WAERK' 'VBAP' ''.
      m_sort c_gt_vbak 'KUNNR'.
      m_sort c_gt_vbap 'NETWR'.
      ls_keyinfo-header01 = 'VBELN'.
      ls_keyinfo-item01 = 'VBELN'.
      ls_keyinfo-item02 = 'POSNR'.
    Dipslay Hierarchical list
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = sy-cprog
          i_callback_user_command = 'USER_COMMAND'
          is_layout               = ls_layout
          it_fieldcat             = lt_fieldcat
          it_sort                 = lt_sort
          i_tabname_header        = c_gt_vbak
          i_tabname_item          = c_gt_vbap
          is_keyinfo              = ls_keyinfo
        TABLES
          t_outtab_header         = gt_vbak
          t_outtab_item           = gt_vbap
        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.                               " F_LIST_DISPLAY
          Form USER_COMMAND                                             *
    FORM user_command USING i_ucomm     TYPE sy-ucomm
                            is_selfield TYPE slis_selfield.     "#EC CALLED
      DATA ls_vbak TYPE ty_vbak.
      CASE i_ucomm.
        WHEN '&IC1'.                       " Pick
          CASE is_selfield-tabname.
            WHEN c_gt_vbap.
            WHEN c_gt_vbak.
              READ TABLE gt_vbak INDEX is_selfield-tabindex INTO ls_vbak.
              IF sy-subrc EQ 0.
              Sales order number
                SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.
              Display Sales Order
                CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
              ENDIF.
          ENDCASE.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND
    END OF PROGRAM Z_ALV_HIERSEQ_LIST ******************
    Thanks,
    Sankar M

  • WHAT ARE EVENTS IN AN ALV REPORT ?

    WHAT ARE EVENTS IN AN ALV REPORT ? PLEASE EXPLAIN HOW TO MAKE AN ALV REPORT AND WHAT THE EVENTS DO ?
    BEST REGARDS,
    RYAN

    Events are driven by user interaction...Like...
    DATA_CHANGED
    DOUBLE_CLICK
    ONF4
    Here's a sample code of OO ALV using events...
    *& Report  ZDUMMY_ATG_2
    REPORT zdummy_atg_2.
    TYPES: BEGIN OF ty_scarr,
           carrid TYPE scarr-carrid,
           carrname TYPE scarr-carrname,
           currcode TYPE scarr-currcode,
           END OF ty_scarr.
    DATA: t_spfli TYPE STANDARD TABLE OF spfli,
          w_spfli LIKE LINE OF t_spfli,
          lt_f4 TYPE lvc_t_f4 WITH HEADER LINE,
          return_tab TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE,
          t_custom_scarr TYPE STANDARD TABLE OF ty_scarr WITH HEADER LINE,
          t_stable TYPE STANDARD TABLE OF lvc_s_stbl WITH HEADER LINE.
    FIELD-SYMBOLS: <fs_spfli> LIKE LINE OF t_spfli,
                   <fs_scarr> LIKE LINE OF t_custom_scarr.
    CLASS cl_gui_object DEFINITION LOAD.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    INCLUDE <cl_alv_control>.
    DATA: ok_code LIKE sy-ucomm,
          gt_fieldcat TYPE lvc_t_fcat,
          gt_sort TYPE lvc_t_sort,
          event_receiver TYPE REF TO lcl_event_receiver,
          gs_layout TYPE lvc_s_layo,
          mycontainer TYPE scrfname VALUE 'CUSTOM_ALV',
          custom_container TYPE REF TO cl_gui_custom_container,
          grid1 TYPE REF TO cl_gui_alv_grid,
          gs_variant TYPE disvariant,
          x_save,
          w_error TYPE c,
          l_valid(1) TYPE c.
    *       CLASS LCL_EVENT_RECEIVER DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS: handle_data_changed
          FOR EVENT data_changed OF cl_gui_alv_grid
          IMPORTING er_data_changed,
          handle_f4_help
          FOR EVENT onf4 OF cl_gui_alv_grid
          IMPORTING e_fieldname es_row_no er_event_data.
    ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        PERFORM data_changed USING er_data_changed.
      ENDMETHOD.                    "HANDLE_DATA_CHANGED
      METHOD handle_f4_help.
        PERFORM handle_onf4 USING e_fieldname es_row_no.
        er_event_data->m_event_handled = 'X'.
      ENDMETHOD.                    "HANDLE_F4_HELP
    ENDCLASS.                    "LCL_EVENT_RECEIVER IMPLEMENTATION
    *&      START-OF-SELECTION                                             *
    START-OF-SELECTION.
      PERFORM cargar_customs.
      PERFORM cargar_datos.
      PERFORM fill_layout.
      PERFORM fill_catalog.
      PERFORM llamar_alv.
      CALL SCREEN 0100.
    *&      Form  CARGAR_DATOS                                             *
    FORM cargar_datos.
      SELECT mandt carrid connid countryfr cityfrom
             airpfrom countryto cityto airpto
             fltime deptime arrtime distance
             distid fltype period
      INTO TABLE t_spfli
      FROM spfli.
    ENDFORM.                    " CARGAR_DATOS
    *&      Form  CARGAR_CUSTOMS                                           *
    FORM cargar_customs.
      SELECT carrid carrname currcode
      INTO TABLE t_custom_scarr
      FROM scarr.
    ENDFORM.                    " CARGAR_DATOS
    *&      Form  FILL_LAYOUT                                              *
    FORM fill_layout.
      gs_layout-sel_mode = 'A'.
    ENDFORM.                    " FILL_LAYOUT
    *&      Form  FILL_CATALOG                                             *
    FORM fill_catalog.
      DATA: gs_fieldcat TYPE lvc_s_fcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 1.
      gs_fieldcat-fieldname = 'CARRID'.
      gs_fieldcat-reptext   = 'Compañia'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-f4availabl = 'X'.
      gs_fieldcat-outputlen = '8'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 2.
      gs_fieldcat-fieldname = 'CONNID'.
      gs_fieldcat-reptext   = 'Conexión'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '8'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 3.
      gs_fieldcat-fieldname = 'COUNTRYFR'.
      gs_fieldcat-reptext   = 'País'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '4'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 4.
      gs_fieldcat-fieldname = 'CITYFROM'.
      gs_fieldcat-reptext   = 'Ciudad Salida'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = space.
      gs_fieldcat-outputlen = '20'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 5.
      gs_fieldcat-fieldname = 'AIRPFROM'.
      gs_fieldcat-reptext   = 'Arp. Salida'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '10'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 6.
      gs_fieldcat-fieldname = 'COUNTRYTO'.
      gs_fieldcat-reptext   = 'País'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '4'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 7.
      gs_fieldcat-fieldname = 'CITYTO'.
      gs_fieldcat-reptext   = 'Ciudad Llegada'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = space.
      gs_fieldcat-outputlen = '20'.
      APPEND gs_fieldcat TO gt_fieldcat.
    ENDFORM.                    " FILL_CATALOG
    *&      Form  LLAMAR_ALV                                               *
    FORM llamar_alv.
      IF custom_container IS INITIAL.
        CREATE OBJECT custom_container
          EXPORTING
            container_name              = mycontainer
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5.
      ENDIF.
      CREATE OBJECT grid1
        EXPORTING
          i_parent = custom_container.
      CREATE OBJECT event_receiver.
      lt_f4-fieldname = 'CARRID'.
      lt_f4-register = 'X' .
      lt_f4-getbefore = 'X' .
      lt_f4-chngeafter = 'X' .
      APPEND lt_f4.
      SET HANDLER event_receiver->handle_data_changed FOR grid1.
      SET HANDLER event_receiver->handle_f4_help FOR grid1.
      CALL METHOD grid1->register_f4_for_fields
        EXPORTING
          it_f4 = lt_f4[].
      IF sy-batch IS INITIAL.
        CALL METHOD grid1->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      ENDIF.
      CALL METHOD grid1->set_table_for_first_display
        EXPORTING
          is_variant      = gs_variant
          i_save          = x_save
          i_default       = 'X'
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_sort         = gt_sort[]
          it_outtab       = t_spfli[].
      CALL METHOD grid1->set_ready_for_input
        EXPORTING
          i_ready_for_input = 1.
    ENDFORM.                    " LLAMAR_ALV
    *&      Form  HANDLE_ONF4                                              *
    FORM handle_onf4 USING p_e_fieldname
                           p_es_row_no STRUCTURE lvc_s_roid.
      CASE p_e_fieldname.
        WHEN 'CARRID'.
          CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
            EXPORTING
              retfield        = 'CARRID'
              value_org       = 'S'
            TABLES
              value_tab       = t_custom_scarr
              return_tab      = return_tab
            EXCEPTIONS
              parameter_error = 1
              no_values_found = 2
              OTHERS          = 3.
          IF NOT return_tab[] IS INITIAL.
            READ TABLE return_tab INDEX 1.
            READ TABLE t_spfli INDEX p_es_row_no-row_id
            ASSIGNING <fs_spfli>.
            <fs_spfli>-carrid = return_tab-fieldval.
            CALL METHOD grid1->refresh_table_display
              EXPORTING
                is_stable = t_stable.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " HANDLE_ONF4
    *&      Module  STATUS_0100  OUTPUT                                    *
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'MAIN_STATUS'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT                               *
    MODULE user_command_0100 INPUT.
      ok_code = sy-ucomm.
      CASE ok_code.
        WHEN 'BACK' OR 'STOP' OR 'CANCEL'.
          SET SCREEN 0.
          LEAVE SCREEN.
        WHEN 'SAVE'.
          CALL METHOD grid1->check_changed_data
            IMPORTING
              e_valid = l_valid.
          IF l_valid EQ 'X'.
            PERFORM grabar_datos.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  DATA_CHANGED                                             *
    FORM data_changed USING rr_data_changed TYPE REF TO
                                            cl_alv_changed_data_protocol.
      DATA: w_new,
            ls_mod_cells TYPE lvc_s_modi,
            ls_cells TYPE lvc_s_modi.
      DATA: l_carrid TYPE spfli-carrid.
      CLEAR l_carrid.
      LOOP AT rr_data_changed->mt_good_cells INTO ls_mod_cells.
        CASE ls_mod_cells-fieldname.
          WHEN 'CARRID'.
            CALL METHOD rr_data_changed->get_cell_value
              EXPORTING
                i_row_id    = ls_mod_cells-row_id
                i_fieldname = ls_mod_cells-fieldname
              IMPORTING
                e_value     = l_carrid.
            IF l_carrid IS INITIAL.
              CALL METHOD rr_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = '0K'
                  i_msgno     = '000'
                  i_msgty     = 'E'
                  i_msgv1     = 'Seleccione algún código'
                  i_fieldname = ls_mod_cells-fieldname
                  i_row_id    = ls_mod_cells-row_id.
              w_error = 'X'.
            ELSE.
              READ TABLE t_custom_scarr WITH KEY carrid = l_carrid
              ASSIGNING <fs_scarr>.
              IF sy-subrc NE 0.
                CALL METHOD rr_data_changed->add_protocol_entry
                  EXPORTING
                    i_msgid     = '0K'
                    i_msgno     = '000'
                    i_msgty     = 'E'
                    i_msgv1     = 'Código ingresado no existe'
                    i_fieldname = ls_mod_cells-fieldname
                    i_row_id    = ls_mod_cells-row_id.
                w_error = 'X'.
              ENDIF.
            ENDIF.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " DATA_CHANGED
    *&      Form  GRABAR_DATOS                                             *
    FORM grabar_datos.
      LOOP AT t_spfli ASSIGNING <fs_spfli>.
        w_spfli = <fs_spfli>.
        MODIFY spfli FROM w_spfli.
        IF sy-subrc EQ 0.
          COMMIT WORK.
        ELSE.
          ROLLBACK WORK.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GRABAR_DATOS
    Greetings,
    Blag.

  • What's the coolest, slickest way to present multiple ALV reports?

    Greetings and good day, everyone.
    Okay, I'm working on an update program, and the users have identified at least three different reports they would like coming out of this thing.  One report is a list of transactions that fail internal logic checking, the second report is a list of transactions that pass internal logic checking but fail to update via a BAPI, and a third report is a list of transactions that pass checks and process correctly (i.e. update the database) via the BAPI.
    At first, still being a newbie, I was wondering how I was going to create multiple ALV reports.  I know I could do this using the WRITE statement, writing each report one after the other, but they have asked for the ALV report so they can do all the ad-hoc manipulating, sorting, etc. that ALV provides.
    I came up with these options:
    1.  Instead of filling my single screen with the container control for an ALV report, as I usually do, this time I could put three containers on the screen.  However, I know that cramps space, and I don't know if they'll be able to adjust or move things around other than scrolling.
    2.  Display a single ALV report on the screen, but have buttons somehow on the top that somehow take the user to other screens for the other reports.
    3.  First give the user a screen with all the buttons for the reports.  They choose one, and the ALV report displays.  They can click back to return to this screen, then choose a different report.
    Nobody else in the office has done anything like this yet using the ALV, so I've got a chance to break some new ground internally and do something slick.  Which option is best, and if so, do you have examples or general guidelines of how I do it?  I've not had dialog programming, although I do understand the concepts from VB/Delphi experience over 10 years ago.  I think I lean toward option 2, but I figured this couldn't be new ground in the SAP world and surely someone's done exactly this sort of thing.
    Please help!  ALL helpful responses, as always, are awarded points!  Thanks so much!
    Dave

    Dave,
    These are all good suggestions.  I would just remember to keep in mind when designing your report two different things.
    1.  Can your program be run in foreground or background?  If it has to be run in background due to data volumes you will lose all interactive capabilities of ALV.  You might also not be able to do three different ALVs on the screen in background.
    2.  I am not sure if I understand your option 3 but if you are talking about the user selecting the options before the load the data, they might have to attempt to load the data multiple times to get all of the report.
    My recommendation ( I think somebody already mentioned this) is to have a single ALV with a column on your report that the user can then sort or filter by.  This way you are not limited to a program that has to be run in foreground. 
    Chris

  • What are the events in alv reports

    hai this is siva

    Hi siva:
    This is technical question. you should post this query to an ABAPer.
    However this link may help you.
    alv report
    Please let me know if you need more information.
    Assign points if useful.
    Regards
    MSReddy

  • What are events in ALV report and explain how sorting is done  alv report

    events in alv report and sorting in alv report
    Moderator Message: Search before posting.
    Edited by: kishan P on Dec 21, 2011 11:13 AM

    Hi Raja,
    <<content and links removed by moderator>>
    PavanKumar.G
    Edited by: kishan P on Dec 21, 2011 11:12 AM

  • What is 'C601' means in WA_FCAT-EMPHASIZE = 'C601' in ALV Reports?

    HI all,
    Can I know the meaning of 'C601' means in WA_FCAT-EMPHASIZE = 'C601' in ALV Reports?
    Regards
    Darshan MS

    Hi Darshan,
    Please find the Color details below. we can give the below color codes to the ALV report to differentiate the rows.
    C601:
    * Populate color variable with colour properties
    * Char 1 = C (This is a color property)
    * Char 2 = 3 (Color codes: 1 - 7)
    * Char 3 = Intensified on/off ( 1 or 0 )
    * Char 4 = Inverse display on/off ( 1 or 0 )
    *           i.e. wa_ekko-line_color = 'C610'
    Colors:
    1 gray-blue headers
    2 light gray list bodies
    3 yellow totals
    4 blue-green key columns
    5 green positive threshold value
    6 red negative threshold value
    7 orange Control levels
    For More details, please find the link below
    Changing SAP ALV cell / field colour
    Regards
    Rajkumar Narasimman

  • Some doubts in alv report

    how can i page breakin alv report ?
    what are the types of variants and events in alv report?
    how to hide field in alv?
    how to change standard pf status in alv reports?
    plz give me sample program for how to use variants in alv?
    <THREAD LOCKED. Please stop asking interview questions. There is already a lot of information out there, refer to the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] on how to ask a good question and learn to search>
    Edited by: Mike Pokraka on Oct 15, 2008 4:52 PM

    how can i page breakin alv report ?
    - Yes... using NEW-PAGE
    what are the types of variants and events in alv report?
    - DATA: g_variant LIKE disvariant.
    - DATA: gt_eventos          TYPE slis_t_event.
    how to hide field in alv?
    - When you define the field catalog mark this field ls_fieldcat-no_out = 'X'.
    how to change standard pf status in alv reports?
    CLEAR ls_extab.
    ls_extab-fcode = 'ZASSIG'.
    APPEND ls_extab TO extab.
    SET PF-STATUS 'Z09_STATUS' EXCLUDING extab.

  • Field description in two line in ALV report

    Hi ,
    In ALV report I  want the description for each field to be displayed in two lines . For example
    the description for field matnr is " Material No for grade A " which is displayed in one line . But i want to display it as :  Material No
                                                           for grade A
    in two lines . Is it possible . Please help me out .
    Neetesh

    Hi Neetesh,
      Its not possible to display as you like in 2 lines header for single column. But i can provide the alternative way , it won't good logically. Please try the following logic.
    Let suppose you have 10 fields F1-f10. Each field has the 2 lines header. So take 20fields in your fields catalog ie take 10 dummy fields which are equal lenght of the fields F1-f10. and for the last 10 fields(F11-F20) set the row pos as 2, set the second line header to these field(F11-F20). So you will succed to display the 2 level header for single column. But the problem here is you will get one empty row additional row for each row. Because you have taken (F11-F20) fields are dummy and don't have the data also. This solution will works only in the case of ALV List display not in Grid Display.
      But Before that tell to your customer about this problem , Because I have done the same things when my customer giving important to 2 lines header and he accepeted that also.
    If suppose you have the data in 2 lines for each column then this solution will work fine. Thats what i implemented in my ALV Report.
    Warm Regards,
    Vijay.

  • In ALV report how to do this..

    Hi,
         I worte one zreport,  it displays the output in the Grid format.
         Goto tr code : coois-> give some material number u will get output in the grid format..->above the grid u will look the bar on that u will see  ENDUSER DOC, DISPLAY GRAPHIC, LAYOUT SETTINGS....
    My requirement is :  I have to add this bar to my grid report, please explain to me.
    Thanks and Regards,
    Surya

    Hi Jai.
    We can not display barcode in ALV but in Smartform  and Script is possible becuase we can set font "BARCODE" or any fonts to our variable.
    What you should do is create general ALV report ,Smatform for printing barcode and botton for call
    Smartform  in ALV program.When a line is selected and click botton then take data in that line and call
    Smartform for printing barcode that what I have done.
    Hope it help .
    SayC.

  • In ALV report doubt

    Hi Expart,
    In ALV report ,what is the work of
    1) REUSE_ALV_VARIANT_DEFAULT_GET function module
    2) SLIS_LAYOUT_ALV
    Regards
    Bhabani

    Hi,
    1.SELECTING THE VARIANTS FOR INITIAL LIST DISPLAY (DEFAULT VARIANT)
    The variants in the list display can be both user-specific and general. The user can programmatically set the initial (default) variant for list display.
    The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.
    Sample code:
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = variant save condition ( A=all, U = user-specific )
           CHANGING
                cs_variant = internal table containing the program name (and the default variant---optional )
           EXCEPTIONS
                not_found  = 2.
    2.A layout is build for the report output list description USING the internal table declared above (I_LAYOUT).
    Output list description structure.
         The parameters are described under the following heads:
    •     Display options
    •     Exceptions
    •     Totals
    •     Interaction
    •     Detail screen
    •     Display variants (only for hierarchical-sequential lists)
    •     Color
    •     Other
    The layout table is of type slis_layout_alv_spec and has the following fields:
    Reward,if useful.
    Thanks,
    Chandu

  • Summation of a field in ALV report

    Hi,
    I hv created an ALV Report. But i m not getting the summation sign in the Application Toolbar. What can be the problem? I am trying to find out the sum of the the field NETWR in table VBAK.
    Thanks,
    Mohit.

    See the ALV function module used  by  you and  me  ... the  below  program gives the summation  icon  in the  alv bar .
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
    *            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
    *            i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
    *            IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           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.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    reward  points if it is usefull
    Girish

Maybe you are looking for

  • Photo Order/Sorting

    I have a pretty big problem. I have spent countless hours in iphoto organizing all my pictures into the order I want. After updating to iPhoto 11 all my photos were shuffled into what looks like date & time. On top of that it doesn't seem to let me m

  • Payroll & Travel expense

    Hello Experts, I am doing Payroll &client has got requirement of Travel Expenses..Traval Management module is not in the scope of project but they want employees travel requistion & travel expenses should be included in PA or  PY...& what ever travel

  • Events removed from calendar after 6 weeks

    I have noticed that events are deleted from my calendar on iphone and macbook air after 6 weeks, can I resolve this?

  • Can I use my iPad 2 with any carrier?

    I bought an iPad 2 and it originated from Brazil and the model number is MC775X/A and the carrier that it says that its with is called Vivo. My iPad 2 is GSM. I took out the SIM card that was in it and I was wondering if I could use it with Verizon.

  • OSB set cookie with Transport Header action

    I am trying to set a cookie using the Transport Header action in the OSB. The thing is that it seems to need some special format? When I trying to set a simple cookie with params like: Defined:http,cookie with value xs:string('test') it returns a Gen