‎2008 Aug 13 8:19 AM
Hi guys,
can please anybody tell me how can I insert a new record to a table which associated type referred to a table type. I have an internal table i_tab and I need to copy the content of the i_tab in to a result_tab which is defined in my function in the interface as a table with associated type referred to an table type.
Thanks
Kami
‎2008 Aug 13 8:32 AM
Hi,
LOOP AT i_tab
MOVE i_tab-fld1 TO result_tab-fld1.
MOVE i_tab-fld2 TO result_tab-fld2.
MOVE i_tab-fld3 TO result_tab-fld3.
APPEND result_tab.
ENDLOOP.
OR
LOOP AT i_tab
result_tab-fld1 = i_tab-fld1.
result_tab-fld2 = i_tab-fld2.
result_tab-fld3 = i_tab-fld3.
APPEND result_tab.
ENDLOOP.
Regards,
Harish
‎2008 Aug 13 8:22 AM
hii
loop at itab
read table itab with key .... int result_tab.
append result_tab.
‎2008 Aug 13 8:32 AM
Hi,
LOOP AT i_tab
MOVE i_tab-fld1 TO result_tab-fld1.
MOVE i_tab-fld2 TO result_tab-fld2.
MOVE i_tab-fld3 TO result_tab-fld3.
APPEND result_tab.
ENDLOOP.
OR
LOOP AT i_tab
result_tab-fld1 = i_tab-fld1.
result_tab-fld2 = i_tab-fld2.
result_tab-fld3 = i_tab-fld3.
APPEND result_tab.
ENDLOOP.
Regards,
Harish
‎2008 Aug 13 9:19 AM
‎2008 Aug 13 8:46 AM
Hi,
1. define the result_tab TYPE associated type referred to an table type (refered in FM).
2. define ITAB1 TYPE TABLE OF <Line type of that table type> with header line.
3. Move the content from your internal table (i_tab) to ITAB1.
(Using loop and move the correponding fields)
4. Then RESULT_TAB[] = ITAB1[] .
Regards,
Prem