‎2008 Nov 19 8:09 AM
Hi all
How to use read table command on dynamic internal table???
Deepak
‎2008 Nov 19 8:47 AM
Hi,
It is not possible to loop at dynamic table with Where condition.
You can check the condition inside the loop in the following way:
Field-symbols: <fs_any> type any.
Loop at <dyn_tab> into <wa_dyn_tab>.
Assign component 'FIELD' of structure <wa_dyn_tab> to <fs_any>.
If sy-subrc = 0 and <fs_any> = 'VALUE'.
<Code>
Endif.
Endloop.
Here FIELD refers to the fieldname which needs to be checked. VALUE refers to the value against which it should be checked.
Hope this helps!
Thanks,
Lakshmi
Edited by: Santhanalakshmi V on Nov 19, 2008 2:17 PM
‎2008 Nov 19 8:12 AM
‎2008 Nov 19 8:15 AM
is it possible to use loop on dynamic table with where condition???
‎2008 Nov 19 8:38 AM
‎2008 Nov 19 8:47 AM
Hi,
It is not possible to loop at dynamic table with Where condition.
You can check the condition inside the loop in the following way:
Field-symbols: <fs_any> type any.
Loop at <dyn_tab> into <wa_dyn_tab>.
Assign component 'FIELD' of structure <wa_dyn_tab> to <fs_any>.
If sy-subrc = 0 and <fs_any> = 'VALUE'.
<Code>
Endif.
Endloop.
Here FIELD refers to the fieldname which needs to be checked. VALUE refers to the value against which it should be checked.
Hope this helps!
Thanks,
Lakshmi
Edited by: Santhanalakshmi V on Nov 19, 2008 2:17 PM
‎2008 Dec 03 6:18 PM
Hi,
yes we all want a dynamic where-clause for loop and read table as we have for select where...
But, BTW
Field-symbols: <fs_any> type any.
Loop at <dyn_tab> into <wa_dyn_tab>.
Assign component 'FIELD' of structure <wa_dyn_tab> to <fs_any>.
If sy-subrc = 0 and <fs_any> = 'VALUE'.
<Code>
Endif.
Endloop.
<fs_any> = 'VALUE' will cause a dump if <fs_any> is not assigned because the condition is evaluated completely.
You may write
Loop at <dyn_tab> into <wa_dyn_tab>.
Assign component 'FIELD' of structure <wa_dyn_tab> to <fs_any>.
check:
sy-subrc = 0,
<fs_any> = 'VALUE'.
<Code>
Endloop.
Regards,
Clemens
‎2008 Nov 19 8:55 AM