ALV totals only

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
Guest

ALV totals only

Post by Guest » Thu Jan 23, 2003 6:29 pm

I am trying to list the ALV only at subtotals level.
Setting the value

rs_layout-totals_only = 'X'.

But this not getting me the totals , but displayng all the line items.
Any suggestionns please.

Thanks

Kevabap
Posts: 13
Joined: Thu Jan 16, 2003 11:15 am
Location: IRELAND

Totals

Post by Kevabap » Fri Jan 24, 2003 8:20 am

Are the fields to be totalled of the correct type ?

Guest

Post by Guest » Fri Jan 24, 2003 9:34 am

yes... they are of same type .

i could able to set these after the list is displayed.

Settings->define Totals drill down.

But i need it as a default when user executes.

Thanks

Guest

Post by Guest » Sat Jan 25, 2003 3:36 am

Build Sort Catalog as below , For example to subtotal at MATNR
And Show only subtotal line
data gt_sort type slis_t_sortinfo_alv. "sort catalog
data sort type slis_sortinfo_alv.

* Pass Sort sequence as below.
clear sort.
sort-fieldname = 'MATNR'.
sort-tabname = 'INTERNAL TABLE NAME'
sort-up = 'X'.
SORT-SUBTOT = 'X'.
SORT-EXPA = 'X'. " This will hide details lines
append sort to t_sort.
clear sort.

Pass This t_sort ITAB in FM REUSE_ALV_GRID_DISPLAY as
it_sort = t_sort[]

Good Luck

Tim van Steenbergen
Posts: 346
Joined: Tue Dec 17, 2002 7:52 am
Location: Amsterdam, The Netherlands
Contact:

Post by Tim van Steenbergen » Sun Jan 26, 2003 8:24 am

Hello mystery guest,

Check previous topics on how you can play with the ALV-grid. They have been discussed quite a number of times.

Thing I always do is to run the ALV-grid the first time, change the layout to how you want it, save the ALV-grid setting in a variant and then, have your program call the alv-grid using that variant. this will get you any setting, color, sort-method you want.

Or as said in a previous topic:
How to show a table in an ALV-grid and being able to use all formatting-features such as colors, totals and sub-totals, hiding columns, etc.:

Define a structure and then first call the table this way:
*&---------------------------------------------------------------------*
*& Form Show_table_in_alv_grid
*&---------------------------------------------------------------------*
FORM show_table_in_alv_grid TABLES <table-name> STRUCTURE <struc-name>.
TYPE POOLS: SLIS.
DATA gs_variant LIKE disvariant.
gs_variant-report = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = '<struc-name>'
i_grid_title = text-044
i_save = 'A'
is_variant = gs_variant
TABLES
t_outtab = <table-name>.

ENDFORM. " show_table_in_alv_grid

Then, when it shows up on screen, format it the way you like and save the format using Layout, Save and set it as the standard layout. The next time you show the table, it looks the way that you have saved it to.

If you do not have a structure, then you first have to fill parameter it_fieldcat. You can do this via function-module REUSE_ALV_FIELDCATALOG_MERGE.
Best regards, Tim van Steenbergen

Guest

Post by Guest » Mon Jan 27, 2003 9:54 am

Thank you Tim van Steenbergen and guest .

Guest

Post by Guest » Mon Jan 27, 2003 9:58 am

Can i add different subtotals texts.. Let us say i am having 4 different subtotals..

There is only one filed for subtotals text in IS_LAYOUT.

Thanks
Sudhakar

amittalekar
Posts: 5
Joined: Mon Dec 20, 2004 1:37 am
Contact:

Post by amittalekar » Thu May 04, 2006 7:13 am

Tim van Steenbergen wrote:Hello mystery guest,

Check previous topics on how you can play with the ALV-grid. They have been discussed quite a number of times.

Thing I always do is to run the ALV-grid the first time, change the layout to how you want it, save the ALV-grid setting in a variant and then, have your program call the alv-grid using that variant. this will get you any setting, color, sort-method you want.

Or as said in a previous topic:
How to show a table in an ALV-grid and being able to use all formatting-features such as colors, totals and sub-totals, hiding columns, etc.:

Define a structure and then first call the table this way:
*&---------------------------------------------------------------------*
*& Form Show_table_in_alv_grid
*&---------------------------------------------------------------------*
FORM show_table_in_alv_grid TABLES <table-name> STRUCTURE <struc-name>.
TYPE POOLS: SLIS.
DATA gs_variant LIKE disvariant.
gs_variant-report = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = '<struc-name>'
i_grid_title = text-044
i_save = 'A'
is_variant = gs_variant
TABLES
t_outtab = <table-name>.

ENDFORM. " show_table_in_alv_grid

Then, when it shows up on screen, format it the way you like and save the format using Layout, Save and set it as the standard layout. The next time you show the table, it looks the way that you have saved it to.

If you do not have a structure, then you first have to fill parameter it_fieldcat. You can do this via function-module REUSE_ALV_FIELDCATALOG_MERGE.
Amit Talekar

Post Reply