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: 

Alternative to Collect Statement or collect statement

Former Member
0 Kudos

Hi Friends,

I have a internal table(ITAB1) with 20+ fields. I have to prepare new internal tale(ITAB2) with group by using 6 fields from the ITAB1 (COLLECT with 6 matching fields) .

Also I need to have link between these 2 tables after the collect process to use some other fields from ITAB2.

When I loop ITAB2 I have to get some of the fields from ITAB1 for the corresponding record which was grouped.

Can I get some ideas how I can process this.

Thanks in advance.

Mohan.

6 REPLIES 6

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

If you are on release 7.40 SP08 or higher, you might consider using LOOP AT itab GROUP BY.

0 Kudos

Hi Keller,

Thanks for the response.

My system is 7.31 and could not find this GROUP BY.

But any way I solved the issue.

Thank You.

Regards,

Mohan.

Jelena
Active Contributor
0 Kudos

What's the difference between "Collect statement" and "collect statement" (ABAP commands are not case sensitive) and why is such alternative needed?

Former Member
0 Kudos

Hi Jelena,

Thank You for the reply.

I am already using the collect statement for this process and I am able to do group by with required fields. But the problem with this I am not able to establish the link between the Original table records and collect table (itab 2) . 

How to establish the link between these 2 tables.

Example: Itab 1 is having 20 records - Itab2 may be 5 records after using the collect.

Now I have to put the link between these 2 tables (from tab2 what records are associated in Itab1 ).


Thank You.

Mohan,

Jelena
Active Contributor
0 Kudos

I'm confused - how would the SCN members know what is "the link" between the two tables when we have no way of knowing what those tables are? Wouldn't the key fields be apparent from the specification or a requirement you are working with (I assume). What is the specific technical challenge and what have you tried so far?

You might want to refer to this blog and re-think the question: http://scn.sap.com/community/getting-started/blog/2010/05/12/asking-good-questions-in-the-forums-to-...

Former Member
0 Kudos

Sorry for not clear on my question.

Table with custom fields (trying to group them with 5 fields).

I solved the issue , after doing COLLECT process I did loop with ITAB1 with using where group by fields and maintained the link.

Thank You for your response.

Mohan.