Application Development and Automation 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: 
Read only

alv events

Former Member
0 Likes
876

hiiiiiiiiiii

what is the use of a

  1. REUSE_ALV_GRID_DISPLAY

  2. REUSE_ALV_FIELDCATALOG_MERGE

  3. 'REUSE_ALV_EVENTS_GET'

  4. 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

  5. 'RANDOM_I2'

  6. 'REUSE_ALV_COMMENTARY_WRITE'

  7. 'REUSE_ALV_EVENTS_GET'

  8. LVC_FIELDCATALOG_MERGE'

  9. WHAT IS THE NAME OF FUNCTION MODULE TO TAKE OUT THE PRINTOUT OF LOGO.

hiiiiiiiiiii

what is the use of a

  1. REUSE_ALV_GRID_DISPLAY

  2. REUSE_ALV_FIELDCATALOG_MERGE

  3. 'REUSE_ALV_EVENTS_GET'

  4. 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

  5. 'RANDOM_I2'

  6. 'REUSE_ALV_COMMENTARY_WRITE'

  7. 'REUSE_ALV_EVENTS_GET'

  8. LVC_FIELDCATALOG_MERGE'

  9. WHAT IS THE NAME OF FUNCTION MODULE TO TAKE OUT THE PRINTOUT OF LOGO.

5 REPLIES 5
Read only

Former Member
0 Likes
806

hi,

REUSE_ALV_GRID_DISPLAY:

The function module outputs an internal table with whatever structure in the form of a formatted single- oder multi-line list.

REUSE_ALV_FIELDCATALOG_MERGE:

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

The program-internal table must either be in a TOP Include or its Include must be specified explicitly in the interface.

The variant based on a program-internal table should only be used for rapid prototyping since the following restrictions apply:

o Performance is affected since the code of the table definition must always be read and interpreted at runtime.

o Dictionary references are only considered if the keywords LIKE or INCLUDE STRUCTURE (not TYPE) are used.

If the field catalog contains more than 90 fields, the first 90 fields are output in the list by default whereas the remaining fields are only available in the field selection.

If the field catalog is passed with values, they are merged with the 'automatically' found information.

REUSE_ALV_EVENTS_GET:

This table can be passed to the ALV display module with the form name.

seshu.

Read only

Former Member
0 Likes
806

hi,

REUSE_ALV_GRID_DISPLAY:

The function module outputs an internal table with whatever structure in the form of a formatted single- oder multi-line list.

REUSE_ALV_HIERSEQ_LIST_DISPLAY:

This module outputs two internal tables as a formated

hierarchical-sequential list.

RANDOM_I2:

To get next number.

REUSE_ALV_COMMENTARY_WRITE:

List header information is output according to its type. The output information is put in an internal table. Output attributes are assigned to each line via the TYP field.

This module outputs formatted simple header information at TOP-OF-PAGE.

REUSE_ALV_EVENTS_GET:

This table can be passed to the ALV display module with the form name.

seshu.

Read only

Former Member
0 Likes
806

i manpreet,

please read the following, it might help you..

*'REUSE_ALV_GRID_DISPLAY’ *

function module 'REUSE_ALV_GRID_DISPLAY’ can help us get list output in the form of a grid and also attach logos to the report output.

Text

Output of a simple list (single-line)

Functionality

The function module outputs an internal table with whatever structure in

the form of a formatted single- oder multi-line list.

Process:

o Passing an internal table with the set of information to be output

o Passing a structure with general layout specifications for list

layout

o Passing a field catalog in the form of an internal table

The field catalog describes the fields to be output in the list.

Notes

o All interactions performed on the list refer directly to the

internal output table. Sorting the list, for example, also involves

a resorting of the internal output table passed (since it was passed

by reference).

o An important factor determining the usability of the tool or of

various generic functions (totals, subtotals) is the expected amount

of data to be displayed.

The application is responsible for critically testing this aspect

and consider it when it comes to decision-making.

Parameters

I_INTERFACE_CHECK

I_BYPASSING_BUFFER

I_BUFFER_ACTIVE

I_CALLBACK_PROGRAM

I_CALLBACK_PF_STATUS_SET

I_CALLBACK_USER_COMMAND

I_CALLBACK_TOP_OF_PAGE

I_CALLBACK_HTML_TOP_OF_PAGE

I_CALLBACK_HTML_END_OF_LIST

I_STRUCTURE_NAME

I_BACKGROUND_ID

I_GRID_TITLE

I_GRID_SETTINGS

IS_LAYOUT

IT_FIELDCAT

IT_EXCLUDING

IT_SPECIAL_GROUPS

IT_SORT

IT_FILTER

IS_SEL_HIDE

I_DEFAULT

I_SAVE

IS_VARIANT

IT_EVENTS

IT_EVENT_EXIT

IS_PRINT

IS_REPREP_ID

I_SCREEN_START_COLUMN

I_SCREEN_START_LINE

I_SCREEN_END_COLUMN

I_SCREEN_END_LINE

IT_ALV_GRAPHICS

IT_HYPERLINK

IT_ADD_FIELDCAT

IT_EXCEPT_QINFO

I_HTML_HEIGHT_TOP

I_HTML_HEIGHT_END

E_EXIT_CAUSED_BY_CALLER

ES_EXIT_CAUSED_BY_USER

T_OUTTAB

Exceptions

PROGRAM_ERROR

Function Group

SLVC_FULLSCREEN

2) *REUSE_ALV_FIELDCATALOG_MERGE *

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.

The minimal field catalog is documented below. This can be done in a routine using a local variable. The user can use the other optional parameters to assign output attributes to different fields in the output, which differ from the default.

A field catalog need not be built-up and passed explicitly only under the following conditions:

1.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. In this case the attributes of the different fields is taken directly from the table and the attributes (key fields, length, texts etc) need to state explicitly.

2.All fields in this structure are to be output

3.The structure name is passed to ALV in the parameter I_STRUCTURE_NAME of the function module REUSE_ALV_LIST_DISPLAY.

*'REUSE_ALV_EVENTS_GET' *

This FM helps you in getting all the events possible for a list(ALV).The table returned by the FM in the parameter ET_EVENTS can be passed to the ALV display module with the form name for the event which you want to implement.

This function module will list all the events possible on ALV

these are

CALLER_EXIT

USER_COMMAND

TOP_OF_PAGE

TOP_OF_COVERPAGE

END_OF_COVERPAGE

FOREIGN_TOP_OF_PAGE

FOREIGN_END_OF_PAGE

PF_STATUS_SET

LIST_MODIFY

TOP_OF_LIST

END_OF_PAGE

END_OF_LIST

AFTER_LINE_OUTPUT

BEFORE_LINE_OUTPUT

REPREP_SEL_MODIFY

SUBTOTAL_TEXT

GROUPLEVEL_CHANGE

REUSE_ALV_COMMENTARY_WRITE’,

Using the function module ‘REUSE_ALV_COMMENTARY_WRITE’, the internal table containing the headings for top of page event can be passed to the list output. Also, any logo specific to the report can be passed to the function module.

reward points if helpful

Rohan malik

Read only

Former Member
0 Likes
806

ALV EVENTS:

ABAP List Viewer (ALV):

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

This function module is used to set the default gui status etc.

Parameters:

I. I_CALLBACK_PROGRAM

II. I_CALLBACK_PF_STATUS_SET

III. I_CALLBACK_USER_COMMAND

B. REUSE_ALV_BLOCK_LIST_APPEND

This function module adds the data to the block.

Repeat this function for all the different blocks to be displayed one after the other.

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.

C. REUSE_ALV_BLOCK_LIST_HS_APPEND

This function module is used for hierarchical sequential blocks.

D. REUSE_ALV_BLOCK_LIST_DISPLAY

This function module display the list with data appended by the above function.

Parameters : All the parameters are optional.

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

Reward points if useful

Read only

Former Member
0 Likes
806

Hi,

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

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

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

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

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

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

REUSE_ALV_COMMENTARY_WRITE List body comment block output

REUSE_ALV_EVENTS_GET Returns table of possible events for a list type

REUSE_ALV_EVENT_NAMES_GET Returns table of constant names of possible events for a list type

REUSE_ALV_FIELDCATALOG_MERGE Create field catalog from dictionary structure or internal table

REUSE_ALV_HIERSEQ_LIST_DISPLAY Hierarchical sequential list output

REUSE_ALV_LIST_DISPLAY Output a simple list (single line or several lines)

REUSE_ALV_GRID_DISPLAY Output a simple list (single line or several lines)

REUSE_ALV_LIST_LAYOUT_INFO_GET Read current ALV list information

REUSE_ALV_LIST_LAYOUT_INFO_SET Set current ALV list information

REUSE_ALV_POPUP_TO_SELECT List in dialog box to choose one or more entries (or display only)

We can use ABAP ALV LIST and GRID function modules to display Normal LIST and Hiearchical LISTS .

All the definitions TYPES and STRUCTURES and CONSTANTS are defined

in the TYPE-POOL 'SLIS' ,so it should be declared first.

TYPE-POOLS : 'SLIS' .

To display ALV LISTS the function module used are :

REUSE_ALV_LIST_DISPLAY "For Normal LIST

REUSE_ALV_HIERARCHICAL_LIST_DISPLAY "For Hierarchical LIST

To display ALV GRID the function module used are :

REUSE_ALV_GRID_DISPLAY . "For GRID display

The most important component of the ALV is the FIELDCATALOG which is of

TYPE SLIS_T_FIEDLCAT_ALV

or of

TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV .

The line items of the field catalog are of

TYPE SLIS_FIELDCAT_ALV .

FIELDCATALOG

To prepare field catalog certain fields are essential .There are various other fields allowing for vaarious possibilities and display options.

TABNAME

FIELDNAME

REF_TABNAME

SELTECT_M

e.g.

DATA: WS_FCAT TYPE SLIS_FIELDCAT_ALV . "LINE ITEM OF FCAT

DATA: IN_FCAT TYPE SLIS_T_FIELDCAT_ALV.

WS_FCAT-TABNAME = 'MARA'.

WS_FCAT-FIELDNAME = 'MATNR'.

WS_FCAT-SELTEXT_M = 'Material Number'.

APPEND WS_FCAT TO IN_FCAT .

CLEAR WS_FCAT.

WS_FCAT-TABNAME = 'MAKT'.

WS_FCAT-FIELDNAME = 'MAKTX'.

WS_FCAT-SELTEXT_M = 'Material Description'.

APPEND WS_FCAT TO IN_FCAT .

This will create fieldcatalog with two columns for displaying material and material description .

RESUSE_ALV_LIST_DISPLAY.

The following FM is used to display the data in the internal table in the form of ALV

LIST. The Event table is only required if event handling is being done.

CALL FUNCTION 'RESUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID "of TYPE SY-REPID and

" value SY-REPID

IS_LAYOUT = W_LAYOUT "of TYPE SLIS_LAYOUT_ALV

IT_FIELDCAT = IN_FCAT "of TYPE SLIS_T_FIELDCAT_ALV

I_SAVE = W_SAVE "of TYPE C ,values A ,U ,' '

IT_EVENTS = IN_EVENTS " of TYPE SLIS_T_EVENT

TABLES

T_OUTTAB = IN_DATA "internal table conatining data

"corresponding to IN_FCAT

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

IF SY-SUBRC NE 0.

MESSAGE ENNN .

ENDIF.

REUSE_ALV_EVENTS_GET.

This FM is used to get the default event table of the ALV LIST DISPLAY.

The IN_EVENTS internal table is of TYPE SLIS_T_EVENT. This table contains

all the events wrapped up in the ALV LIST or ALV GRID and consistsof two fields

NAME and FORM .The NAME corresponds to names of the events like TOP_OF_PAGE and END_OF_PAGE ,USER_COMMAND and FORM will contain the name of the FORM ROUTINE that will be called dynamically through callback mechanism when the particular event will fire and is initial for all events bt default and has to be filled for

events for which handling is required.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = IN_EVENTS[].

e.g.

DATA: W_EVENT TYPE SLSI_ALV_EVENT "LINE ITEM OF EVENT TABLE

DATA: IN_EVENTS TYPE SLSI_T_EVENT . "Internal table containing events

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = IN_EVENTS[].

RTEAD TABLE IN_EVENTS WITH KEY NAME = 'TOP_OG_PAGE'

INTO W_EVENT.

IF SY-SUBRC EQ 0.

MOVE 'F3000_TOP_OF_PAGE' TO W_EVENT -FORM.

MODIFY IN_EVENTS FROM W_EVENT INDEX SY-TABIX.

ENDIF.

Here the FORM ROUTINE 'F3000_TOP_OF_PAGE' is being set up for the

event TOP_OF_PAGE which will fire when the ALV LIST will be displayed ,This form

will be called dynamically by th ALV LIST display during top_of_page event and for this the modified Events internal table has to be passed to the FM 'REUSE_ALV_LIST_DISPLAY' in the exporting parameter IT_EVENTS. Failing this the form '3000_TOP_OF_PAGE' will not be called . This event is used for placing heading information like Current date and time and the name of the report.

Regards,

Chandru