12-30-2005 5:24 AM
Hi ABAP Experts,
my requirement is to transfer data from one tables column into another tables single row.
my data is in one internal table's column.
& i want all the records from this column into another table's single row .
how can it be done??
any function module??
Regards,
Ashish
12-30-2005 5:31 AM
l_tabix type sy-tabix.
LOOP AT itab1.
l_tabix = l_tabix + 1.
ASSIGN COMPONENT l_tabix OF STRUCTURE itab2 TO <fs1>.
IF sy-subrc = 0.
<fs1> = itab-filed1.
ENDIF.
APPEND itab2.
ENDLOOP.
try this..
vijay
12-30-2005 5:31 AM
l_tabix type sy-tabix.
LOOP AT itab1.
l_tabix = l_tabix + 1.
ASSIGN COMPONENT l_tabix OF STRUCTURE itab2 TO <fs1>.
IF sy-subrc = 0.
<fs1> = itab-filed1.
ENDIF.
APPEND itab2.
ENDLOOP.
try this..
vijay
12-30-2005 5:44 AM
hey vijay ,
thanks for responding so quickly.
my data is coming from a function module , which is an internal table without header line.
so <b>LOOP AT itab1</b> will not work in this case.
can you help me out in this.
12-30-2005 5:47 AM
data:
wtab like line of itab1,
l_tabix type sy-tabix.
LOOP AT itab1 into wtab.
l_tabix = l_tabix + 1.
ASSIGN COMPONENT l_tabix OF STRUCTURE itab2 TO <fs1>.
IF sy-subrc = 0.
<fs1> = wtab-filed1.
ENDIF.
APPEND itab2.
ENDLOOP.
12-30-2005 5:48 AM
l_tabix type sy-tabix.
LOOP AT itab1 into wa.
l_tabix = l_tabix + 1.
ASSIGN COMPONENT l_tabix OF STRUCTURE itab2 TO <fs1>.
IF sy-subrc = 0.
<fs1> = wa-filed1.
ENDIF.
APPEND itab2.
ENDLOOP.
12-30-2005 5:52 AM
hi ashish,
Try this,
field-symbol: <fs_field> type any.
LOOP AT itab1.
*assign the values to internal table1 to second internal table.
ASSIGN COMPONENT itab1-fieldname
OF STRUCTURE structure1
TO <fs_field>.
IF sy-subrc EQ 0.
itab2-field_name1 = <event_field>.
*append to internal table2
APPEND itab2.
ENDIF.
ENDLOOP.
The 'Fieldname' is a entry in a table itab1.
The same is a column in structure1.
this will assign the field value to the corresponding field to internal table2 where internal table2 has the same field name as a column(which can be assigned from the structure1).
i have tried this and this is working fine.
Regards,
Padmini