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

where condition on a dynamic table

Former Member
0 Likes
840

hi,

how to use a where condition on a dynamic internal table.

existing code as shown below is taking enormous processing time.

loop at itab.

loop at dynamic_hased_tab in to <fs_dynamic_tab>

assign component 'field1' of structure <fs_dynamic_tab> to <fs_field1>

if itab-field1 = <fs_field1>

****logic

endif.

endloop.

endloop.

-


loop at itab.

loop at dynamic_hased_tab where...

  • processing logic

endloop.

endloop.

instead of above code i want something like this.is it possible. please let me know if you have any ideas on how to performance tune the code.

Thanks,

KK.

hi,

how to use a where condition on a dynamic internal table.

existing code as shown below is taking enormous processing time.

loop at itab.

loop at dynamic_hased_tab in to <fs_dynamic_tab>

assign component 'field1' of structure <fs_dynamic_tab> to <fs_field1>

if itab-field1 = <fs_field1>

****logic

endif.

endloop.

endloop.

-


loop at itab.

loop at dynamic_hased_tab where...

  • processing logic

endloop.

endloop.

instead of above code i want something like this.is it possible. please let me know if you have any ideas on how to performance tune the code.

Thanks,

KK.

5 REPLIES 5
Read only

Former Member
0 Likes
785

Hi Kumar,

I think u can not directly write where conditon to the dynamic internal table u need to write the this way as u said

loop at itab.
loop at dynamic_hased_tab in to <fs_dynamic_tab>
assign component 'field1' of structure <fs_dynamic_tab> to <fs_field1>

if itab-field1 = <fs_field1>
------
------
endif. 

endloop.

endloop.

Please check the below blog:

/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

Best regards,

raam

Read only

Former Member
0 Likes
785

Hi,

thanks for your prompt response.

if i'm looping and checking fields row by row, it will loop on all records in my dynamic table which means for every entry i will be looping 'n' number of times , n is the no. of records.

is there any way to avoid that.

Thanks,

KK.

Read only

0 Likes
785

Hello,

See this: [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae].

Regards.

Read only

Former Member
0 Likes
785

Hi David,

Thanks for the post .

I didnt find anything specific to my question.

thanks,

KK.

Read only

Former Member
0 Likes
785

Have you tried class cl_rs_where ?

Check following link:

/people/ravishankar.rajan/blog/2006/12/21/building-dynamic-sql-statements-using-the-clrswhere-class

G@urav.