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: 

Making Subtotals -Default -OO ALV report

Former Member
0 Kudos

Hi,

How do I make subtototals default? What is the parameter for this?

I am using OO ALV not FM's.

  • Macro to populate the field catalog

DEFINE fieldcatalog.

t_fieldcat-ref_table = &1.

t_fieldcat-fieldname = &2.

t_fieldcat-coltext = &3.

t_fieldcat-do_sum = &4.

t_fieldcat-inttype = &5.

t_fieldcat-hotspot = &6.

append t_fieldcat.

clear t_fieldcat.

END-OF-DEFINITION.

Regards

Praveen

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Build Sort Catalog as below , For example to subtotal at MATNR

And Show only subtotal line

data gt_sort type lvc_t_sort. "sort catalog

data sort type lvc_s_sort.

  • 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 set_table_for_first_display

5 REPLIES 5

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Hi, what you mean by "Subtotals" default? Do you mean that you want only the subtotal lines to show in the output?

If so, there is a field in the LAYOUT parameter, called TOTALS_ONLY(or something like that, set this to 'X' and only the subtotals and totals will be shown. Is this what you want?

Regards,

Rich Heilman

Former Member
0 Kudos

Build Sort Catalog as below , For example to subtotal at MATNR

And Show only subtotal line

data gt_sort type lvc_t_sort. "sort catalog

data sort type lvc_s_sort.

  • 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 set_table_for_first_display

0 Kudos

Rich,

Thank you for the reply.I guess I was not clear.

By default I am able to total on quantity field with INTTYPE parameter from LVC_S_FCAT structure.Right now after entering in to output list I am manually pressing SUBTOTAL button on Material number and saving it as default layout.

I don't want to do this.I am wondering whether we can make this option DEFAULT .

Sreekanth,

I am not using FM's

Regards

Praveen

0 Kudos

Oh, Ok, Then Sreekanth has your solution. You need to use the SORT parameter, when call the SET_TABLE_FOR_FIRST_DISPLAY. Fill this parameter as Sreekanth has done above and pass it to this method.

Regards,

Rich Heilman

0 Kudos

Thank you Srikanth & Rich.

I solved my issues and did not forget to award points.:-)

Regards

Praveen

Message was edited by:

PRAVEEN s