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

Select in an internal table

Former Member
0 Likes
570

I realize that you can't do a select on an internal table but I need to do something identical to that. I need to replicate the following code:

SELECT * FROM it_detail INTO it_temp WHERE matnr = wa_detail-matnr.

it_detail is of type ty_detail which joins field from three different tables. Right now it_detail holds information about many different material numbers with all material numbers being repeated. I am attempting to fill it_temp with all entries from it_detail that has the same material type. I did a search but I couldn't find anything that seemed to work in this situation.

Regards,

Davis.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
551

You must READ it, or LOOP at it.

Loop at it_detail into wa_detail where matnr = p_matnr.
    move-corresponding wa_detail to wa_temp.
    append wa_temp t0 it_temp.
endloop.

Regards,

RIch Heilman

I realize that you can't do a select on an internal table but I need to do something identical to that. I need to replicate the following code:

SELECT * FROM it_detail INTO it_temp WHERE matnr = wa_detail-matnr.

it_detail is of type ty_detail which joins field from three different tables. Right now it_detail holds information about many different material numbers with all material numbers being repeated. I am attempting to fill it_temp with all entries from it_detail that has the same material type. I did a search but I couldn't find anything that seemed to work in this situation.

Regards,

Davis.

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
552

You must READ it, or LOOP at it.

Loop at it_detail into wa_detail where matnr = p_matnr.
    move-corresponding wa_detail to wa_temp.
    append wa_temp t0 it_temp.
endloop.

Regards,

RIch Heilman

Read only

0 Likes
551

Rich and Ferry, thanks a lot for the help!

Davis

Read only

Former Member
0 Likes
551

Hi,

You can use LOOP statement.


LOOP AT IT_DETAIL WHERE MATNR = WA_DETAIL-MATNR.
   MOVE-CORRESPONDING IT_DETAIL TO IT_TEMP. 
  APPEND IT_TEMP.
ENDLOOP.

Regards,

Ferry Lianto