11-09-2007 9:41 PM
hello experts...
i am creating a dynamic internal table.
how can i move the fields from i_tab into the dynamic table <dyn_tab>?
thank you.
11-09-2007 9:53 PM
Hi,
DATA: lw_fieldvalue(40) TYPE c,
lw_fieldname(30) TYPE c.
gwa_output TYPE REF TO data.
FIELD-SYMBOLS: <gwa_output> TYPE ANY.
FIELD-SYMBOLS: <l_fvalue> TYPE ANY.
*---Create a pointer to store the workarea of the final output table.
CREATE DATA gwa_output LIKE LINE OF <git_output>.(this is the output table)
*---Assign it to a fieldsymbol which will be used in populating the
*---final output table.
ASSIGN gwa_output->* TO <gwa_output>.
Loop at i_tab into wa_tab.
move wa_tab-field1 to v_fieldvalue. (moving the first field value into field value variable).
CONDENSE v_fieldvalue NO-GAPS. (Condense the output).
CLEAR: <gwa_output>.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <gwa_output> TO <l_fvalue>.
<l_fvalue> = V_fieldvalue.
<b>Repeat the same with other fields</b>
*---Append the current record to final output table.
APPEND <gwa_output> TO <git_output>.
endloop.
Regards,
Bharat.
11-09-2007 9:53 PM
Hi,
DATA: lw_fieldvalue(40) TYPE c,
lw_fieldname(30) TYPE c.
gwa_output TYPE REF TO data.
FIELD-SYMBOLS: <gwa_output> TYPE ANY.
FIELD-SYMBOLS: <l_fvalue> TYPE ANY.
*---Create a pointer to store the workarea of the final output table.
CREATE DATA gwa_output LIKE LINE OF <git_output>.(this is the output table)
*---Assign it to a fieldsymbol which will be used in populating the
*---final output table.
ASSIGN gwa_output->* TO <gwa_output>.
Loop at i_tab into wa_tab.
move wa_tab-field1 to v_fieldvalue. (moving the first field value into field value variable).
CONDENSE v_fieldvalue NO-GAPS. (Condense the output).
CLEAR: <gwa_output>.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <gwa_output> TO <l_fvalue>.
<l_fvalue> = V_fieldvalue.
<b>Repeat the same with other fields</b>
*---Append the current record to final output table.
APPEND <gwa_output> TO <git_output>.
endloop.
Regards,
Bharat.
11-09-2007 9:57 PM
11-09-2007 9:55 PM
You need to assign the component of table <dyn_Tab> to field symbol and than give value to that field symbol.
Like:
ASSIGN COMPONENT FLD1 OF STRUCTURE <DYN_TAB> TO <FS>.
<FS> = I_TAB-FLD1.
Regards,
Naimesh Patel
11-09-2007 9:57 PM