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

Optimization

Former Member
0 Likes
319

Hi Friends,

I have one table T1 having fields F1, F2, F3, F4, F5.

Now my requirement is to select the records from table T1 based on filter criteria.

In table T1 for further processing I need only value of F3 field. But for the given filter criteria I have multiple entries in

table T1.

So How I can store multiple values in my defined variable.

i.e.

select * from T1 into table LT_T1 where F5 = 'X'.

loop at LT_T1 into LS_T1.

lv_var = LS_T1-F3.

endloop.

  • for the codition F5 = 'X' we have multiple entries in table T1.

I wanted to know is any optimized solution is there i.e. can anybody will optimized

the above mentioned code.

2 REPLIES 2
Read only

Former Member
0 Likes
294

Define another internal table with onli one field i.e f3.

data :

begin of fs_var ,

field like LS_T1-F3.

end of fs_var.

data table_var like standard table of fs_var.

<i>(*** this declaration of the table should be after the declaration of the table LS_T1 **)</i>

<b>select * from T1 into table LT_T1 where F5 = 'X'.

loop at LT_T1 into LS_T1.

fs_var-field = LS_T1-F3.

append fs_var to table_var.

endloop.</b>

Hope this solves ur problem..

plz do remember to close the thread .. when ur problem is solved !!

regards,

sai ramesh

Read only

Former Member
0 Likes
294

Hi,

If table T1 have multiple values for field F3, declare a internal table with single field like F3 and move the values to that int table.

loop at LT_T1 into LS_T1.

itab1-fieldr = LS_T1-F3.

append itab1.

clear Itab1.

endloop.

now do what ever you wants to do with that field values.

reward if useful

regards,

ANJI