08-02-2007 2:58 PM
hi
in alv.. how we put the total for the particular column?
what is the basic purpose of layout in alv ?
08-02-2007 7:43 PM
After populating the fieldcatelog, you can loop thru the internal table can capture the field that you want to total on:
LOOP AT p_alv_catalog INTO wa_fieldcat.
CASE wa_fieldcat-fieldname.
when 'WRBTR'. " Field needs to totalized
wa_fieldcat-do_sum = 'X'.
ENDCASE.
MODIFY p_alv_catalog FROM wa_fieldcat.
CLEAR wa_fieldcat.
ENDLOOP.
Here is the documentation from SAP help on ALV layout:
***********************************************************************************************
You use layouts to tailor the outputted list to your individual requirements. Layouts describe the list formatting options and include:
List settings, such as column selection, column sequence, and column width.
Filter settings
Sort settings
Totals, averages, maximum / minimum
Subtotals
Display options
Graphic
View templates
Layout is the new term for display variant as of Release 4.6C.
Features
The edition options for layouts depend on the relevant ALV Grid Control:
In all ALV Grid Controls, you can:
Choose one of the standard layouts delivered with the standard system.
Change the current layout.
In ALV Grid Controls that use only the standard layouts, you cannot save your changes to the current layout. When you choose layouts, only the standard layouts are proposed.
In some ALV Grid Controls, you can also save the layout you defined as your own Layout.
User-defined layouts are generally saved for all users. They can then be used by all users that is, all users can then choose from the user-defined layouts as well as the standard layouts.
In some ALV Grid Controls, you can also save the layout you defined as a user-specific layout. You are the only user that can use this layout.
<i>Please reward points for helpful answer.</i>
08-02-2007 3:05 PM
I can help with getting the ALV to show the total: When defining the field catalog, set the DO_SUM component to 'X'. ALV creates totals for columns with this setting. See below.
DATA: l_fieldcat TYPE slis_fieldcat_alv.
CLEAR l_fieldcat.
l_fieldcat-tabname = 'FUNDINT'.
l_fieldcat-fix_column = 'X'.
l_fieldcat-no_out = 'O'.
l_fieldcat-fieldname = 'GEBER'.
l_fieldcat-seltext_l = 'Fund'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-fieldname = 'DMBTR'.
l_fieldcat-seltext_l = 'Avg Daily Balance'.
<b> l_fieldcat-do_sum = 'X'.</b>
APPEND l_fieldcat TO p_fieldtab.
08-02-2007 3:07 PM
Hi,
In SLIS_T_FIELDCAT_ALV,there is a field called 'do_sum' which cab be set in case you need to add a particular column.While preparing the fieldcatalog for the particular column,just mark do_sum to X.
Hope it works.
Thanks,
Sandeep.
08-02-2007 3:09 PM
to get sum set the field DO_SUM in fielcatelog to 'X'.
Layout strucrure is used to vary/change the layout of output. This strcuture contains attributed which is valid for whole report.. for example report title, display sum on top, there are many .. you can check the structire of layout
08-02-2007 3:16 PM
HI,
while creating field-catalog specifies the fied DO_SUM = 'X' to which column you want to perform total.
DATA: fieldcat type LVC_T_FCAT.
fieldcat-fieldname = < >. " specifies the name
fieldcat-do_sum = 'X'. " total calculation for column.
we use layout to display output in different layouts like.......
IS_LAYOUT-ZEBRA: X=striped (zebra) pattern
IS_LAYOUT-BOX_FIELDNAME: insert column checkbox for each row to select row.
follow this link for knowing use of layout.
http://abap-gallery.blogspot.com/2007/07/change-layout-format-in-alv.html
regards,
Ashok Reddy
08-02-2007 7:43 PM
After populating the fieldcatelog, you can loop thru the internal table can capture the field that you want to total on:
LOOP AT p_alv_catalog INTO wa_fieldcat.
CASE wa_fieldcat-fieldname.
when 'WRBTR'. " Field needs to totalized
wa_fieldcat-do_sum = 'X'.
ENDCASE.
MODIFY p_alv_catalog FROM wa_fieldcat.
CLEAR wa_fieldcat.
ENDLOOP.
Here is the documentation from SAP help on ALV layout:
***********************************************************************************************
You use layouts to tailor the outputted list to your individual requirements. Layouts describe the list formatting options and include:
List settings, such as column selection, column sequence, and column width.
Filter settings
Sort settings
Totals, averages, maximum / minimum
Subtotals
Display options
Graphic
View templates
Layout is the new term for display variant as of Release 4.6C.
Features
The edition options for layouts depend on the relevant ALV Grid Control:
In all ALV Grid Controls, you can:
Choose one of the standard layouts delivered with the standard system.
Change the current layout.
In ALV Grid Controls that use only the standard layouts, you cannot save your changes to the current layout. When you choose layouts, only the standard layouts are proposed.
In some ALV Grid Controls, you can also save the layout you defined as your own Layout.
User-defined layouts are generally saved for all users. They can then be used by all users that is, all users can then choose from the user-defined layouts as well as the standard layouts.
In some ALV Grid Controls, you can also save the layout you defined as a user-specific layout. You are the only user that can use this layout.
<i>Please reward points for helpful answer.</i>
08-03-2007 12:06 PM
for eg.. i did like this but output not came
data w_fcat type slis_fieldcat_alv.
w_fcat-tabname = 'IT_MARA'.
W_FCAT-FIELDNAME = 'MATNR'.
W_FCAT-REF_TABNAME = 'MARA'.
W_FCAT-REF_FIELDNAME = 'MATNR'.
W_FCAT-OUTPUTLEN = '20'.
W_FCAT-DO_SUM = 'X'.
append w_fcat to i_fcat.
clear w_fcat.
08-03-2007 12:55 PM
08-03-2007 12:57 PM
Selva Sir
please assign points to all thankful answers
dont forget