‎2007 Jan 15 1:17 PM
hi
how to initialize values in a internal table
according to my requirement i need to initialize (both character and currency) values present in the internal table based on certain conditions
vamsi
‎2007 Jan 15 1:52 PM
Hello
U could clear the header of the itab..
ie <b>read table itab index 1.
clear itab</b>
Vasanth
‎2007 Jan 15 1:26 PM
u mean to say initialize means clear the values...
if u want to clear 1 record based on condition...
loop at itab.
<condition satisfied>
itab-field1 = space.
itab-field2 = space.
modify itab index sy-tabix.
endloop.
u want to clear table contents based on condition...
<condition satisfied>
refresh itab.
clear itab.
‎2007 Jan 15 1:52 PM
Hello
U could clear the header of the itab..
ie <b>read table itab index 1.
clear itab</b>
Vasanth
‎2007 Jan 15 1:55 PM
Hi Vamshi,
you can take the,
tablename-fieldname(for char) = value for character
tablename-fieldname(for curr) = value for currency
append the table.
Regards,
Abir.
If it helps mark helpful answers.
‎2007 Jan 15 2:42 PM
‎2007 Jan 15 2:51 PM
hi
As i understood you want to clear only selected fileds not the complet record..
create a Field symobl the loop at the table.. inside the loop check the condtion the just clear the filed.
example: you have itab type mara.
then
FIELD-SYMOBOLS <FS_WA_ITAB> TYPE MARA.
LOOP AT ITAB ASSIGNING <FS_WA_ITAB>.
IF X = XXX (YOUR CONDITION)
CLEAR: <FS_WA_ITAB>-FIELD2,
<FS_WA_ITAB>-FIELD3. (If u want to clear only filed2 and field3)
clear <FS_WA_ITAB>. (if you want to cleatr the complete record)
ENDIF.
ENDLOOP.
Why iam suggestin the filed-symobol is.. it is direcltly work on internal table body so u no need to update the table agian
Please Close this thread.. when u r problem is solved
Reward if Helpful
Regards
Naresh Reddy K
‎2007 Jan 15 2:56 PM