06-25-2009 7:20 AM
hi all,
i have looped it_final table.
now after dat i want to add a new column to it_final table ,den how would i add that using another lopp statement.
06-25-2009 7:25 AM
Hi,
Delclare all the required columns in IT_FINAL. While processing you can update the data in the columns.
In your case after the loop you can populate the values in the column.
06-25-2009 7:30 AM
i have looped once it_final ok.
den if i want to add column from a table using another loop statement in it_final den how dat i will doo..??
06-25-2009 7:40 AM
If you are talking about adding a new field to your it_final, then you need to add that new field into the Internal Table Structure, and you need to Loop on your it_final once again and inside this loop you need to read the second internal Table from which you want to feed value in the newly added field of internal Table and then Modify the Internal Table it_final inside this loop only.
06-25-2009 7:33 AM
define your internaltable like this.
data: begin of it occurs 0,
f1(330),
end of it.
note: this is example donot use occurs 0 , types prefered.
Use offset and populate the records as you like.
Regards,
Satish
06-25-2009 7:45 AM
hi darshan,
loop at it_final into wa_final.
read table it_new into wa_new with key = key 1 .
if sy-subrc = 0.
wa_final-newcol = wa_newcol.
endif.
modify it_final from wa_final.
endloop.
Here you should have a common key field in both it_final table and in it_new table. ( where the it_new table contains the new row that is to be appended to the if_final table ).
Hope your problem solves. if not send in your code. v can help you.
06-25-2009 7:46 AM
Hi,
From what i have understood.. You want to add field value from another table to your 'IT_FINAL' internal table.. So for that what you have to do is first decalre the field as prt of the final internal table 'IT_FINAl'..
loop at it_final into ls_final.
loop at itab1 into ls_itab1.
ls_final-new_field = itab1-field.
endloop.
modify it_final....
endloop...
But it is better if you use field symbols rather than modify statemnet..
Hope this is what you wanted to know..
06-25-2009 7:48 AM
Hi
If you are comfortable using field-symbol, go for it. You do not have to use modify in that case.
field-symbols <wa_final> type (table type of it_final).
Loop at it_final assigning <wa_final>.
read table it_second into wa_second witk key...
if sy-subrc eq 0.
<wa_final>-new = wa_second-field.
endif.
Endloop.
Please let me know if this works.
Sourav.
06-25-2009 8:17 AM
06-25-2009 8:21 AM
Hi,
Can you let me know if you are using 'Modify statement'.. If yes the please check if you are using the Transporting addition to it..
modify it_final from ls_final transporting new_field.
06-25-2009 8:44 AM
06-25-2009 8:46 AM
06-25-2009 9:29 AM
Hi,
if your problem is solved can you please close the thread, and it would be great if you could appreciate your contributors for there efforts by rewarding...
06-25-2009 3:26 PM
Hello Darshan,
<< Whinging removed >>
Edited by: Rob Burbank on Jun 25, 2009 10:28 AM