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: 

Select Sinlge Column from ITAB in new ITAB

michael_fallenbchel
Active Participant
0 Kudos
156

Hi guys,

I need a simple imput from you:

I have an internat tab with 5 columns. Now I need just one of them (column called KUNNR).

I tryd to do it this way:

LOOP AT gt_hierarchie INTO gs_hierarchie.
          APPEND gs_hierarchie-kunnr TO lt_kunnr.
        ENDLOOP.

This works perfect, now the itab lt_kunnr contains all kunnr from gt_hierarchie and the "old" ones, which where in lt_kunnr before.

BUT it takes too much time! Only this short statement take over 30(!) minutes! Even longer, but after 30 minutes I cancel it...

Is there any other way to get this single column to my other itab?

Thanks

Michael

Edited by: Michael Fallenbüchel on Oct 29, 2008 10:29 AM

1 ACCEPTED SOLUTION

ThomasZloch
Active Contributor
0 Kudos
134

wow, how many entries does gt_hierarchie have?

Are you 100% sure that this is the statement causing this long runtime?

There is some gain by using LOOP AT ... ASSIGNING ... instead of LOOP AT ... INTO ... (data is not copied, just referenced).

Thomas

7 REPLIES 7

former_member188685
Active Contributor
0 Kudos
134

>Only this short statement take over 30(!) minutes! Even longer, but after 30 minutes I cancel it...

There may be some other problem

check it once.

ThomasZloch
Active Contributor
0 Kudos
135

wow, how many entries does gt_hierarchie have?

Are you 100% sure that this is the statement causing this long runtime?

There is some gain by using LOOP AT ... ASSIGNING ... instead of LOOP AT ... INTO ... (data is not copied, just referenced).

Thomas

0 Kudos
134

Sometimes you can't the the forest 'cause of so much woods

The problem was a loop around my append! The first step, this loop has only 1 entry - after the append, there where 450000 entrys - and so on.

Feeling stupid now

But thanks for the quick help!

Former Member
0 Kudos
134

Hi,

If possible can you tell how are you populating:

gt_hierarchie and rest data of lt_kunnr.

So that we could help you out with better performance.

Thanks & Regards,

Navneeth K.

Former Member
0 Kudos
134

Hai,

I hope the following code will help you,

Clear It_kunnr.

Refresh It_kunnr.

LOOP AT gt_hierarchie INTO gs_hierarchie.

MOVE gs_hierarchie-kunnrunnr TO lt_kunnr.

APPEND It_kunnr.

ENDLOOP.

Regards,

Harish

Former Member
0 Kudos
134

if kunnr is the first column of ur table gt_hierarchie, you can move in this way.

lt_kunnr = gt_hierarchie.

Regards

Sathar

former_member583456
Active Participant
0 Kudos
134

Hi Michael,

sounds strange, the only reason I could imagine is that one line of gt_hierarchie contains lot of data (e.g. subtables), in this case you should use a field symbol: "loop at gt_... assigning <ls_hierarchie>".

Best regards

Thomas