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

Dynamically grouping identical rows in internal table

Former Member
0 Likes
687

Hi,

I have a typical scenario where in I have to compare rows of internal table with certain set of fields.If the values are same they would be grouped into one item.

For eg. there is an internal table where I have fields like BP number , Location , Site, Customer, Serial no. etc.

Now with the BP no. there is a rule attached and that rule determines with what set of fields we need to group the line items.

Say with BP 1 the rule is R1 and as per that we have to compare only values of fields location and site .If its true we will club all the similar line items.

Now with BP2 the rule is R2 where we have to compary values in iternal table with fields Location , customer and serial no. So then we need to compare these three fields for clubbing similar records.

The internal table can have data for no. of different BP's and the data is sorted but its structure is static.

Please suggest.

Hi,

I have a typical scenario where in I have to compare rows of internal table with certain set of fields.If the values are same they would be grouped into one item.

For eg. there is an internal table where I have fields like BP number , Location , Site, Customer, Serial no. etc.

Now with the BP no. there is a rule attached and that rule determines with what set of fields we need to group the line items.

Say with BP 1 the rule is R1 and as per that we have to compare only values of fields location and site .If its true we will club all the similar line items.

Now with BP2 the rule is R2 where we have to compary values in iternal table with fields Location , customer and serial no. So then we need to compare these three fields for clubbing similar records.

The internal table can have data for no. of different BP's and the data is sorted but its structure is static.

Please suggest.

2 REPLIES 2
Read only

Former Member
0 Likes
460

You can do that with 2 differents ways :

  • by creating a colomn key which is the concatenation of the key for each lin

  • by using field groups

I think you have to use the second one.

[sample by help|http://help.sap.com/saphelp_nw70/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm]

In this case you can put dynamiquely what are you wanted in your keys.

Regards,

Christophe.

Read only

0 Likes
460

can you give an example how it can be done using field-groups.