2007 Jul 23 8:19 AM
hi,
please explain how we are using the variant in alv report, i dont have any idea about that, what is use of that? please show one simple example of that alv variant.
how we can use that pls explain in detail
2007 Jul 23 8:24 AM
Hi
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
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
Reward all helpfull answers
Regards
Pavan
2007 Jul 23 8:24 AM
Hi
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
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
Reward all helpfull answers
Regards
Pavan
2007 Jul 23 8:26 AM
Sample code........
SELECTION-SCREEN: BEGIN OF BLOCK var WITH FRAME TITLE text-002.
PARAMETERS:
p_varant LIKE ltdx-variant. " ALV variant
SELECTION-SCREEN: END OF BLOCK var.
AT SELECTION-SCREEN ON p_varant.
Validates the diplay variant
IF p_varant IS NOT INITIAL.
PERFORM validate_variant.
ENDIF. " IF P_VARANT IS NOT INITIAL
PERFORM fill_variant.
&----
*& Form Validate_variant
&----
This subroutine validates the variant entered on the selection *
screen. *
----
There are no interface parameters to be passed to the *
subroutine. *
----
FORM validate_variant .
CLEAR w_variant.
w_variant-report = sy-repid.
MOVE p_varant TO w_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = w_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CLEAR sscrfields-ucomm.
MESSAGE e303(u1).
ENDIF. " IF SY-SUBRC <> 0
ENDFORM. " Validate_variant
&----
*& Form Fill_variant
&----
Fill the Variant
----
No interface parameters to be passed to this sub routine
----
FORM fill_variant .
Filling the Variant structure
w_variant-report = sy-repid.
w_variant-username = sy-uname.
w_variant-variant = p_varant.
ENDFORM. " Fill_variant
Regards,
Pavan.
2007 Jul 23 8:33 AM
hi,
i havnt understood , please explain in detail, what is the functianality of that one.
reply
2007 Jul 23 8:40 AM
Check my complete information i had given in detail what is variant in alv how to save variant using coding and manually also
Regards
Pavan
2007 Jul 23 8:35 AM
Hi,
The ability to save a variant for an ALV display is based on the parameter I_SAVE that is passed to the function module to display the ALV GRID and on the authorization object S_ALV_LAYO. The activity of this authorization object is checked within the ALV. This authorization object can be used to further restrict the authorization for saving layouts (predetermined by the developer). You will obtain the following results if the authorization does not exist for S_ALV_LAYO:
I_SAVE = ' ' -> layouts cannot be saved
I_SAVE = 'A' -> is set to 'U'
-> only user-specific layouts can be saved
I_SAVE = 'X' -> is changed to ' '
-> layouts cannot be saved
I_SAVE = 'U' -> user-specific layouts can be saved
If you do not want the ALV authorization check on the S_ALV_LAYO object, you can set the IS_LAYOUT-NO_AUTHOR parameter to 'X'. As a result, an authorization check will not occur when you call the ALV.
For futher details look at the SAP not # 601803 in the SAP Service Marketplace
Pls reward all helpful points.
Regards,
Ameet
2007 Jul 23 8:39 AM
hi
see the code below it shoul help
<b>Reward if helpful</b>
report ztest_0002
no standard page heading
message-id zmm.
Tables.
tables: mara.
Global ALV Data Declarations
type-pools: slis.
Internal Tables
data: begin of itab occurs 0,
matnr type mara-matnr,
maktx type makt-maktx,
end of itab.
data: fieldcat type slis_t_fieldcat_alv.
data: variant type disvariant.
Selection Screen
selection-screen begin of block b1 with frame title text-002 .
select-options: s_matnr for mara-matnr.
parameters: p_var(30) type c.
selection-screen end of block b1.
initialization.
variant-report = sy-repid.
variant-username = sy-uname.
at selection-screen on value-request for p_var.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = variant
i_save = 'U'
importing
es_variant = variant
exceptions
not_found = 1
program_error = 2
others = 3.
p_var = variant-variant.
start-of-selection.
perform get_data.
perform call_alv.
*********************************************************************
Form GET_DATA
*********************************************************************
form get_data.
select maramatnr maktmaktx
into corresponding fields of table itab
from mara
inner join makt
on maramatnr = maktmatnr
where mara~matnr in s_matnr
and makt~spras = sy-langu.
endform.
************************************************************************
CALL_ALV
************************************************************************
form call_alv.
perform build_field_catalog.
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
is_variant = variant
i_save = 'U'
tables
t_outtab = itab.
endform.
************************************************************************
BUILD_FIELD_CATALOG
************************************************************************
form build_field_catalog.
data: fc_tmp type slis_t_fieldcat_alv with header line.
data: label(30) type c.
clear: fieldcat. refresh: fieldcat.
perform update_catalog using 'Material Number'
'ITAB'
'MATNR'
'18'
space
space
'L'.
perform update_catalog using 'Material Description'
'ITAB'
'MAKTX'
'40'
space
space
'L'.
endform.
************************************************************************
UPDATE_CATALOG
************************************************************************
form update_catalog using col_head
table
field
outputlen
do_sum
no_out
just.
data: tmp_fc type slis_t_fieldcat_alv with header line.
tmp_fc-reptext_ddic = col_head.
tmp_fc-fieldname = field.
tmp_fc-tabname = table.
tmp_fc-outputlen = outputlen.
tmp_fc-just = just.
tmp_fc-decimals_out = 0.
tmp_fc-do_sum = do_sum.
tmp_fc-no_out = no_out.
append tmp_fc to fieldcat.
endform.
regards
vijay
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |