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: 

ALV: count of unique entries

Former Member
0 Kudos

Hi Team,

A conventional report has Plant, Delivery Doc. No., Customer ID and Material # in its line, sorted by Plant.

On change of the Plant, the count of unique Delivery documents,Customers and Materials is displayed as shown below,

Plnt Delivery# Ord/PO# SaTy Cust

3100 81546208 800865 KB 11316

3100 81546205 800864 OR 730

3100 81546206 800864 OR 730

3100 81546209 800865 KB 11316

3100 81546206 800864 OR 730

3100 81546207 800864 OR 730

3100 5 2 2

I require to display this report using ALV, how to display this unique entries count in ALV.

Thanks & Regards,

Lakshmanan

6 REPLIES 6

agnihotro_sinha2
Active Contributor
0 Kudos

hi,

in the internal table ITAB, sort rows on basis of all fields....

u will get all duplicate values 2gthr...

then delete adjascent duplicate


delete adjascent duplicate comparing f1 f2 f3 etc...

0 Kudos

Hi,

The report displays the count of unique entries.

I need to know how to display the count when the report is diaplayed using ALV.

Thanks & Regards,

Lakshmanan

0 Kudos

You can't display this counts directly. You have to fill these details in Internal table.At the change of Plant insert a line with these count details and display that internal table as ALV.

0 Kudos

Fine. I heard on the way, there is some FM ALV_Hierarchy_Display, need to be confirmed of the name.

Does that helps? Any idea.

Former Member
0 Kudos

Hi,

Fill these details in the final internal table which was used to display output on change of plant number.

Then these details will be displayed in the alv output. If you want you can fill these cells in a different color.

Example Code:

it_head-code = 'MKT'.

it_head-dept = 'Marketing'.

APPEND it_head.

CLEAR it_head.

it_head-code = 'QA'.

it_head-dept = 'Quality'.

APPEND it_head.

CLEAR it_head.

it_head-code = 'TES'.

it_head-dept = 'Testing'.

APPEND it_head.

CLEAR it_head.

it_item-code = 'MKT'.

it_item-emp = 'Srinivasu'.

it_item-city = 'Thane'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'MKT'.

it_item-emp = 'Sekhar'.

it_item-city = 'Thane'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'MKT'.

it_item-emp = 'Radha Krishna'.

it_item-city = 'Thane'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'MKT'.

it_item-emp = 'Sudheer'.

it_item-city = 'Thane'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'QA'.

it_item-emp = 'Srinu'.

it_item-city = 'Thane'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'QA'.

it_item-emp = 'Sanjay'.

it_item-city = 'Delhi'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'QA'.

it_item-emp = 'Nilkesh'.

it_item-city = 'Hyderabad'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'QA'.

it_item-emp = 'Boxer'.

it_item-city = 'KAKINADA'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'TES'.

it_item-emp = 'Federer'.

it_item-city = 'Swiss'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'TES'.

it_item-emp = 'Sachin'.

it_item-city = 'India'.

APPEND it_item.

CLEAR it_item.

it_item-code = 'TES'.

it_item-emp = 'Dravid'.

it_item-city = 'India'.

APPEND it_item.

CLEAR it_item.

LOOP AT it_item.

AT NEW code.

wa_item-code = it_item-code.

wa_item-emp = 'EMPLOYEE NAME'.

wa_item-city = 'CITY'.

wa_item-cbox = 'X'.

wa_item-color = color[].

APPEND wa_item TO it_item1.

CLEAR wa_item.

ENDAT.

wa_item-code = it_item-code.

wa_item-emp = it_item-emp.

wa_item-city = it_item-city.

APPEND wa_item TO it_item1.

CLEAR wa_item.

aux_cnt = aux_cnt + 1.

AT END OF code.

wa_item-code = it_item-code.

wa_item-emp = 'No Of Employees'.

wa_item-city = aux_cnt.

wa_item-color = color1[].

APPEND wa_item TO it_item1.

CLEAR wa_item.

CLEAR aux_cnt.

ENDAT.

ENDLOOP.

Former Member
0 Kudos

Hi

As on chnage of is obselete in ECC 6.0.

use at-new and at-end control break statements on plant.

Regards