Application Development and Automation 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: 
Read only

ALV_GRID_DISPLAY

Former Member
0 Likes
823

Hi ppl,

I want to print the number of records processed for a paticular category(vendor) at end of every category(vendor) in alv grid display.Using the below code i get only subtotals of numeric fields

DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.

GS_SORT-FIELDNAME = 'FIELD1'.

GS_SORT-SPOS = 1.

GS_SORT-UP = 'X'.

GS_SORT-SUBTOT = 'X'.

APPEND GS_SORT TO GT_SORT.

But i want the number in each category to be displayed and not the total of any field..can u help me out

Thanks in advance

Archana Joshi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
801

Hi!

The easiest solution is to insert a new field into your alv internal table. This field will contain "1" in every rows.

If you sum this field, you will have the numbers of the entries (because the value of this field is 1 in every rows).

Not very elegant, but it surely works.

Regards

Tamá

Hi ppl,

I want to print the number of records processed for a paticular category(vendor) at end of every category(vendor) in alv grid display.Using the below code i get only subtotals of numeric fields

DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.

GS_SORT-FIELDNAME = 'FIELD1'.

GS_SORT-SPOS = 1.

GS_SORT-UP = 'X'.

GS_SORT-SUBTOT = 'X'.

APPEND GS_SORT TO GT_SORT.

But i want the number in each category to be displayed and not the total of any field..can u help me out

Thanks in advance

Archana Joshi

6 REPLIES 6
Read only

Former Member
0 Likes
802

Hi!

The easiest solution is to insert a new field into your alv internal table. This field will contain "1" in every rows.

If you sum this field, you will have the numbers of the entries (because the value of this field is 1 in every rows).

Not very elegant, but it surely works.

Regards

Tamá

Read only

0 Likes
801

Hi Tamas,

This can be a solution but i dont want this field to be displayed in the grid and want the sum of this to be displayed under the category(vendor)in the grid display.In that case how to handle it?

Thanks

Archana Joshi

Read only

Former Member
0 Likes
801

Hi Archana,

see the layout options for the ALV GRID.

In the layout mark the specific fields.

This will solve your problem, I guess.

Reward if it helps.

Regards,

Hemant.

Read only

0 Likes
801

Hi Hemant,

Can i know the field in the layout for this?I could see only for Total and subtotal calculation but none specific to the number of processed records.If there is any plz let me know because i could see only these fields in the layout.

spos,fieldname,

tabname,

up,

down ,

group ,

subtot ,

comp,

expa,

obligatory,

Thanks

Archana Joshi

Message was edited by:

ARCHANA G JOSHI

Read only

Former Member
0 Likes
801

Hi,

Take a look at the following code:

LOOP AT ITABMEL1 WHERE SWERK NE V_DIV AND SWERK NE V_DIV1 AND SWERK NE V_DIV2 .

IDX = IDX1 + 1.

GRANDTOTAL = GRANDTOTAL + 1.

IF DIV1 <> ITABMEL1-SWERK OR DIV <> ITABMEL1-MSGRP.

<b>CLEAR COUNT.

COUNT = COUNT + 1.</b>

DIV1 = ITABMEL1-SWERK.

DIV = ITABMEL1-MSGRP.

CLEAR ITABMEL1.

ITABMEL1-DIV = DIV.

ITABMEL1-SWERK = 'DEP_TOT'.

<b>ITABMEL1-MSGRP = COUNT</b>.

CLEAR COUNT.

IDX1 = IDX + 1.

INSERT ITABMEL1 INDEX IDX1.

ENDIF.

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
801

Hi

Like Top-of-Page event, we can implement the end-of-page also in alvs.

Check the options in SLIs.

Regards,

Sreeram