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

How to write it

Former Member
0 Likes
1,535

Dear all

Now in my program there is a internal table storing mass data.

The structure of itab as below:

A B C D

1000 abc ......

2000 jud ......

1000 edg .......

I want to catch the data like the first and the 3th,the single field A has multi-records.

TKS!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,506

Hi

Use the collect statement

Regards,

Sravanthi

Dear all

Now in my program there is a internal table storing mass data.

The structure of itab as below:

A B C D

1000 abc ......

2000 jud ......

1000 edg .......

I want to catch the data like the first and the 3th,the single field A has multi-records.

TKS!

11 REPLIES 11
Read only

Former Member
0 Likes
1,506

question is not sufficient...

regards

sachhidananda

Read only

Sm1tje
Active Contributor
0 Likes
1,506

first sort itab by name of first column:

sort itab by 'columnname' ascending / descending, or use ALV list.

Read only

0 Likes
1,506

Can you please elaborate the issue.

Regards

Farzan

Read only

Former Member
0 Likes
1,507

Hi

Use the collect statement

Regards,

Sravanthi

Read only

0 Likes
1,506

Dear all

Sorry for my poor expressing.

My purpose is getting the records from the internal tab ITAB.

The records must satisfy that one PO# links to several SO#.

And the ITAB is storing the sales order data which catching from the database table.

If i explain it clearly?

TKS!

Read only

0 Likes
1,506

Hello Stephen,

My understandin is that you have an internal table for SO# say t_so and for PO# say t_po nad t_so may have many records for one PO# say t_po-ebeln. This much is clear. Now what you want to do with these internal tables?

Regards

Farzan

Read only

0 Likes
1,506

Dear Farzan

For example,

SO# PO# Material ....

1000 ABC M1 .....

1001 ABC M3 .....

I want to get these records into another internal table.

But i use the SQL 'sort itab by t_po t_so,select t_po count(t_so) from itab group by t_so having count(*) > 1 ' can't not use on internal table!

How i can implement it?

TKS!

Read only

0 Likes
1,506

Now your question is clear.. So u want the count number various SOs for a PO.

do this

loop at itab.

t_final-po = itab-po#

t_final-no_of_so = 1.

collect t_final.

endloop.

this should work and result will be in t_final

Regards

Farzan

Read only

0 Likes
1,506

Dear Farzan

I can't understand fully......

Pls help me to find the problem in the code as below .

It can't get any records.

sort itab by bstnk vbeln.

loop at itab.

t_final-po = itab-bstnk.

t_final-no_of_so = 1.

collect t_final.

endloop.

loop at itab into itab_alv where bstnk = t_final-po.

endloop.

Thank you very much!

Read only

0 Likes
1,506

Hello Stephen,

You don't have to loop on itab again (loop at itab into itab_alv where bstnk = t_final-po.

) just display the itab internal table in a grid.

Also make sure that t_final-no_of_so is a numeric/ quantity field.

Regards

Farzan

Read only

0 Likes
1,506

Dear all

Thank you for your help!

I got it.