‎2007 Jul 25 9:50 PM
How to apply condition to the dynamic internal table.
how to sort a dynamic internal table based on fields.
i m having some records in internal table.How to apply condition to tht dynamically & append to another table.
loop at IT assigning <l> (here i have to give where condition).
endloop.
thanks in advance.
‎2007 Jul 25 9:55 PM
Hi,
You cannot give a where condition in the loop for <fs>.
Check this
loop at i_fcat assigning <fcat>.
assign component <fcat>-col_id of structure <xtab> to <l_f3>.
read table i_final_cat3 assigning <final_cat3> with key
tabname = p_table
fieldname = <fcat>-fieldname.
if sy-subrc eq 0.
assign component <final_cat3>-col_id of
structure <final_wa3> to <l_f4>.
write : <l_f3> to <l_f4>.
endif.
endloop.
aRs
‎2007 Jul 25 9:55 PM
Hi,
You cannot give a where condition in the loop for <fs>.
Check this
loop at i_fcat assigning <fcat>.
assign component <fcat>-col_id of structure <xtab> to <l_f3>.
read table i_final_cat3 assigning <final_cat3> with key
tabname = p_table
fieldname = <fcat>-fieldname.
if sy-subrc eq 0.
assign component <final_cat3>-col_id of
structure <final_wa3> to <l_f4>.
write : <l_f3> to <l_f4>.
endif.
endloop.
aRs
‎2007 Jul 25 10:06 PM
thanks.
but how to filter the data without where condition.
In read statement also i cant give where condition.
i want to fetch the record with condition where total < 60 & append it in another table.
can u give an example
Message was edited by:
Maya Vinothini
‎2007 Jul 25 10:36 PM
Hi,
Try this, maybe it's usefull for you.
DATA: t_mara TYPE TABLE OF mara WITH HEADER LINE.
FIELD-SYMBOLS <line> TYPE ANY.
FIELD-SYMBOLS <field> TYPE ANY.
FIELD-SYMBOLS <table> TYPE table.
START-OF-SELECTION.
SELECT *
FROM mara
UP TO 20 ROWS
INTO TABLE t_mara.
ASSIGN t_mara-matnr TO <field>.
SORT t_mara BY <field>.
LOOP AT t_mara ASSIGNING <line>
WHERE ERSDA le sy-datum.
write: / <line>.
ENDLOOP.
______________________________________________
Else, you can try this.
ASSIGN t_mara[] TO <table>.
ASSIGN t_mara TO <line>.
ASSIGN t_mara-ersda TO <field>.
LOOP AT <table> INTO <line>.
IF <field> LE sy-datum.
...
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
Regards.
Marcelo Ramos
‎2007 Jul 26 3:49 AM
Hi,
For example if your TOTAL field is in 4 th position then
loop at i_fcat assigning <fcat>.
assign component 4 of structure <xtab> to <l_f3>.
write : <l_f3> to <l_f4>.
if <l_f4> ge 60
<<<<< move value to internal table
endif.
endloop.
aRs