Application Development 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: 

Purpose ofReuse_alv_variant_default_get&variant_F4&alv_variant_existence FM

Former Member
0 Kudos

Hi Experts,

Can any one of use pls calrify my doubt:

I am hearing to that <b>while i am using alv report when i execute this display will come and then i click display layout it save as a variant on the selection screen and when i go back to selection screen and press f4 on the display variant its show the drop down list of varient.</b>

Ple calrify me that what this variant hold either layout set on any values of selection scren like normal variant of selection screen.

Reuse_alv_variant_default_get:

Provides the default variant for the list specified in the structure parameter CS_VARIANT of a program.

Reuse_alv_variant_F4:

Display variant selection dialog box. Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.

Reuse_alv_variant_existence:

This function module checks the existence in the database of a display variant passed in the interface.

PARAMETERS: pa_vari TYPE disvariant-variant.

data:g_repid like sy-repid,

e_variant type disvariant.

.

.

.

INITIALIZATION.

g_repid = sy-repid.

CLEAR e_variant.

e_variant-report = sy-cprog.

e_variant-username = sy-uname.

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'

EXPORTING

i_save = 'A'

CHANGING

cs_variant = e_variant

EXCEPTIONS

not_found = 2.

IF sy-subrc = 0.

pa_vari = e_variant-variant.

ENDIF.

.

.

.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_vari.

PERFORM alv_variant_f4 CHANGING pa_vari.

.

.

.

&----


*& Form ALV_VARIANT_F4

&----


FORM alv_variant_f4 CHANGING pa_vari.

DATA: l_exit(1) TYPE c.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = e_variant

i_tabname_header = 'ANYTHING'

i_save = 'A'

IMPORTING

e_exit = l_exit

es_variant = e_variant

EXCEPTIONS

not_found = 2.

IF sy-subrc = 2.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

IF l_exit = space.

pa_vari = e_variant-variant.

ENDIF.

ENDIF.

ENDFORM. " ALV_VARIANT_F4

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

1. The ALV Grid Control is a tool with which you can output non-hierarchical lists in a

standardized format. The list data is displayed as a table on the screen.

The ALV Grid Control offers a range of interactive standard list functions that users need

frequently (find, sort, filter, calculate totals and subtotals, print, print preview, send list,

export list (in different formats), and so on. These functions are implemented in the

proxy object class. You as the programmer have the possibility to turn off functions not

needed. In most cases the implementations of the standard functions provided by the

control are sufficient. However, if required, you can adjust these implementations to

meet application-specific needs.

You can add self-defined functions to the toolbar, if necessary.

The ALV Grid Control allows users to adjust the layout of lists to meet their individual

requirements (for example, they can swap columns, hide columns, set filters for the

data to be displayed, calculate totals, and so on). The settings (list customizing) made

by a specific user are called a display variant. Display variants can be saved on a userspecific

or on a global basis. If such display variants exist for a list, they can be offered

to the user for selection. If a display variant is set as the default variant, the associated

list is always displayed based on the settings of this variant.

2. REUSE_ALV_LIST_DISPLAY

REUSE_ALV_GRID_DISPLAY

REUSE_ALV_FIELDCATALOG_MERGE

REUSE_ALV_COMMENTARY_WRITE

3. Use of Field Catalog is to determines the technical properties & add formating information of the column.

6. all the definition of internal table, structure, constants are declared in a type-pool called SLIS.

7.fieldcat-fieldname

fieldcat-ref_fieldname

fieldcat-tabname

fieldcat-seltext_m

5. Form user_command using r_ucomm like sy-ucomm rs_selfield type slis_selfield.

Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.

In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.

The report output can contain up to 90 columns in the display with the wide array of display options.

The commonly used ALV functions used for this purpose are;

1. REUSE_ALV_VARIANT_DEFAULT_GET

2. REUSE_ALV_VARIANT_F4

3. REUSE_ALV_VARIANT_EXISTENCE

4. REUSE_ALV_EVENTS_GET

5. REUSE_ALV_COMMENTARY_WRITE

6. REUSE_ALV_FIELDCATALOG_MERGE

7. REUSE_ALV_LIST_DISPLAY

8. REUSE_ALV_GRID_DISPLAY

9. REUSE_ALV_POPUP_TO_SELECT

Purpose of the above Functions are differ not all the functions are required in all the ALV Report.

But either no.7 or No.8 is there in the Program.

How you call this function in your report?

After completion of all the data fetching from the database and append this data into an Internal Table. say I_ITAB.

Then use follwing function module.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'Prog.name'

I_STRUCTURE_NAME = 'I_ITAB'

I_DEFAULT = 'X'

I_SAVE = 'A'

TABLES

T_OUTTAB = I_ITAB.

IF SY-SUBRC <> 0.

WRITE: 'SY-SUBRC: ', SY-SUBRC .

ENDIF.

ENDFORM. " GET_FINAL_DATA

Reward all helpfull answers

Regards

Pavan

6 REPLIES 6

former_member194669
Active Contributor
0 Kudos

Hi,

ALV is concerned variant hold only layout values and not selection screen values.

aRs

Points always welcome

Former Member
0 Kudos

Hi

1. The ALV Grid Control is a tool with which you can output non-hierarchical lists in a

standardized format. The list data is displayed as a table on the screen.

The ALV Grid Control offers a range of interactive standard list functions that users need

frequently (find, sort, filter, calculate totals and subtotals, print, print preview, send list,

export list (in different formats), and so on. These functions are implemented in the

proxy object class. You as the programmer have the possibility to turn off functions not

needed. In most cases the implementations of the standard functions provided by the

control are sufficient. However, if required, you can adjust these implementations to

meet application-specific needs.

You can add self-defined functions to the toolbar, if necessary.

The ALV Grid Control allows users to adjust the layout of lists to meet their individual

requirements (for example, they can swap columns, hide columns, set filters for the

data to be displayed, calculate totals, and so on). The settings (list customizing) made

by a specific user are called a display variant. Display variants can be saved on a userspecific

or on a global basis. If such display variants exist for a list, they can be offered

to the user for selection. If a display variant is set as the default variant, the associated

list is always displayed based on the settings of this variant.

2. REUSE_ALV_LIST_DISPLAY

REUSE_ALV_GRID_DISPLAY

REUSE_ALV_FIELDCATALOG_MERGE

REUSE_ALV_COMMENTARY_WRITE

3. Use of Field Catalog is to determines the technical properties & add formating information of the column.

6. all the definition of internal table, structure, constants are declared in a type-pool called SLIS.

7.fieldcat-fieldname

fieldcat-ref_fieldname

fieldcat-tabname

fieldcat-seltext_m

5. Form user_command using r_ucomm like sy-ucomm rs_selfield type slis_selfield.

Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.

In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.

The report output can contain up to 90 columns in the display with the wide array of display options.

The commonly used ALV functions used for this purpose are;

1. REUSE_ALV_VARIANT_DEFAULT_GET

2. REUSE_ALV_VARIANT_F4

3. REUSE_ALV_VARIANT_EXISTENCE

4. REUSE_ALV_EVENTS_GET

5. REUSE_ALV_COMMENTARY_WRITE

6. REUSE_ALV_FIELDCATALOG_MERGE

7. REUSE_ALV_LIST_DISPLAY

8. REUSE_ALV_GRID_DISPLAY

9. REUSE_ALV_POPUP_TO_SELECT

Purpose of the above Functions are differ not all the functions are required in all the ALV Report.

But either no.7 or No.8 is there in the Program.

How you call this function in your report?

After completion of all the data fetching from the database and append this data into an Internal Table. say I_ITAB.

Then use follwing function module.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'Prog.name'

I_STRUCTURE_NAME = 'I_ITAB'

I_DEFAULT = 'X'

I_SAVE = 'A'

TABLES

T_OUTTAB = I_ITAB.

IF SY-SUBRC <> 0.

WRITE: 'SY-SUBRC: ', SY-SUBRC .

ENDIF.

ENDFORM. " GET_FINAL_DATA

Reward all helpfull answers

Regards

Pavan

Former Member
0 Kudos

Hi pavan,

Thnax for the quick reply.

where can i check tehelayout of a particlr variant .

mean i wanna to see layout form it self, not the naem by pressing F4 in field.

0 Kudos

Hi

The object F_IT_ALV has a field, the activity ACTVT, which can

contain four permitted values: 01, 02, 03 and 70. Each of the

activities 01, 02 and 70 controls the availability of particular

functions (in the menu and the toolbar) of the ALV line item list:

a) 01: "Settings -> Display variant -> Save..."

b) 02: "Settings -> Display variant -> Current..." and

"Settings -> Display variant -> Current header rows "

c) 70: "Settings -> Display variant -> Administration..."

Activity 03 corresponds to the minimum authorization, which is the

most restricted one: The user can only select layouts which have

been configured already. In particular, all of the other functions

named above are inactive with activity 03.

Now if you want to permit a user to change the column selection and

the headers as well as to save the layout thus created, for example,

but if you do not want to permit the user to administrate the

layouts, you grant him or her the authorization for activities 01

and 02.

Check this link it will be mosty usefull for u

http://www.sap-img.com/fu017.htm

Regards

pavan

0 Kudos

Pavan,

tahks once again.

We mentioned that

i have to choose like ) 01: "Settings -> Display variant -> Save..."

b) 02: "Settings -> Display variant -> Current..." and

"Settings -> Display variant -> Current header rows "

c) 70: "Settings -> Display variant -> Administration..."

but i where can i see it.

i tried after excuting teh report . imean teh o/p[ avl grid ..

in the layout i found one icon :LAYOUT SETTING . but tehre i am seenig only save layout or change layout.

but i want 2 see the variant : disaply & save.

0 Kudos

This will be displayed at the time of selection check it out at selection screen

Regards

Pavan