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: 

Field Merging in ALV

Former Member
0 Kudos

Hi,

How to merge the repetitive entries of field, while displaying in ALV.

For example:

In my internal table ITAB has 3 fields, VBELN, POSNR, AMOUNT. If ITAB contains 1 record say 100 with 4 line items 10, 20, 30 & 40. I need to display it as

VBELN POSNR AMT

100 10 2500

20 1500

30 2600

40 5680

I do want to display VBELN value only once, since it is same.

I tried using sort option in ALV and also populated the cell_merge value in layout with value 'X'. But it is not working as desired.

I am using the FM 'Reuse_alv_grid_display. Can anyone help me out.

PS: In the ITAB, VBELN is the second field. First is the indicator field (MARK).

With Regards,

NL

1 ACCEPTED SOLUTION

Former Member
0 Kudos

i dont know if you comment spos whether it will work or not ?

otherwise format your itab like that

data : v_vbeln like vbap-vbeln.

sort itab by vbeln.

loop at itab.

on change of itab-vbeln.

v_vbeln = itab-vbeln.

endon.

itab-vbeln = v_vbeln.

modify itab.

clear v_vbeln.

endloop.

regards

shiba dutta

5 REPLIES 5

Former Member
0 Kudos

you have already said you have used sort option in that whether you have only used up = 'X' and group = 'UL'. or not ?

try to comment cell_merge.

please let me know.

regards

shiba dutta

Former Member
0 Kudos

define your vbeln as char and dont use the original data type from table.

Thanks.

Former Member
0 Kudos

The sort table is populated as follows. Also ITAB contains more than 20 fields.

WA_SORT-FIELDNAME = 'VBELN'.

WA_SORT-SPOS = '1'.

WA_SORT-UP = 'X'.

WA_SORT-group = 'UL'.

APPEND WA_SORT TO I_SORT.

Still i could not get the desired result.

With Regards,

NL

Former Member
0 Kudos

i dont know if you comment spos whether it will work or not ?

otherwise format your itab like that

data : v_vbeln like vbap-vbeln.

sort itab by vbeln.

loop at itab.

on change of itab-vbeln.

v_vbeln = itab-vbeln.

endon.

itab-vbeln = v_vbeln.

modify itab.

clear v_vbeln.

endloop.

regards

shiba dutta

Former Member
0 Kudos

Hi Naveen,

Well you can modify your table by other records vbeln as space and printing checking based on vbeln is repeating or not .

If useful reward .