‎2007 Mar 21 10:22 PM
hello guru,
I create one program where i create two dynamics tables with this code.
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <dyn_table>.
*
* Create dynamic work area and assign to FS
CREATE DATA new_line LIKE LINE OF <dyn_table>.
ASSIGN new_line->* TO <dyn_wa>.
* table des sommations
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = new_table2.
ASSIGN new_table2->* TO <dyn_table2>.
CREATE DATA new_line2 LIKE LINE OF <dyn_table2>.
ASSIGN new_line2->* TO <dyn_wa2>.
as you can see the dyn_table and dyn_table2 are the <b>same structure </b>.
I have to aggregate the data that populate the first table into the second.
In first i try my dynamic table.
After, i do a loop into the dyn_table.
LOOP AT <dyn_table> ASSIGNING <dyn_wa2>.if it's the first record
-> i copy the line
<dyn_wa> = <dyn_wa2>.else if the n first characters are egals and if it's the first record, i would like to add the fields value into the line <dyn_wa>. (How ??? help), i try to do something like this:
LOOP AT it_fldcat0.
IF it_fldcat0-fieldname(1) EQ 'V'.
p_fld = it_fldcat0-fieldname.
CONCATENATE '<dyn_wa>-' p_fld INTO p_fld1.
ASSIGN (p_fld) TO <fs>.
CONCATENATE '<dyn_wa2>-' p_fld INTO p_fld1.
ASSIGN (p_fld1) TO <f90>.
ASSIGN COMPONENT p_fld OF STRUCTURE <dyn_wa> TO <fs>.
<fs> = <f90> + <fs>.
ENDIF.
ENDLOOP.
the structure of my dynamic table is defined into the internal table it_fldcat0.
At the end i would like to add the result into the dynamic table <dyn_table2>, how do it please. Because when i write :
ASSIGN <dyn_wa> TO <dyn_table2>.
I obtain a dump with the message <b>
UC_OBJECTS_NOT_CONVERTIBLE</b>
or
<b>ASSIGN_TYPE_CONFLICT</b>
thanks for your help,
Philippe
‎2007 Mar 21 11:37 PM
How declared you field symbol ?
for <DYN_TABLE2> if is "type any" can you change to "type standard table".
Keep all field symbols in same type. ie <f90> <dyn_table> <fs> etc
aRs
Message was edited by:
aRs
‎2007 Mar 21 10:31 PM
You will want to use the ASSIGN COMPONENT statement. Something like this, but I haven't done this in the editor.
LOOP AT it_fldcat0.
IF it_fldcat0-fieldname(1) EQ 'V'.
p_fld = it_fldcat0-fieldname.
* CONCATENATE '<dyn_wa>-' p_fld INTO p_fld1.
assign component (p_fld) of structure <dyn_wa> to <fs>
* ASSIGN (p_fld) TO <fs>.
* CONCATENATE '<dyn_wa2>-' p_fld INTO p_fld1.
assign component (p_fld1) of structure <dyn_wa> to <f90>
* ASSIGN (p_fld1) TO <f90>.
* ASSIGN COMPONENT p_fld OF STRUCTURE <dyn_wa> TO <fs>.
<fs> = <f90> + <fs>.
ENDIF.
ENDLOOP.Regards,
RIch Heilman
‎2007 Mar 21 10:55 PM
thanks for your help,
when i write your code
LOOP AT it_fldcat0.
IF it_fldcat0-fieldname(1) EQ 'V'.
p_fld = it_fldcat0-fieldname.
ASSIGN COMPONENT (p_fld) OF STRUCTURE <dyn_wa> TO <fs>.
ASSIGN COMPONENT (p_fld) OF STRUCTURE <dyn_wa2> TO <f90>.
<fs> = <f90> + <fs>.
ENDIF.
ENDLOOP.
I obtain the error message :
Field "(P_FLD)" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.
So ... what can i do.
Philippe
‎2007 Mar 21 11:06 PM
‎2007 Mar 21 11:16 PM
hello
with space, the error message is:
Unable to interpret "P_FLD". Possible causes of error: Incorrect spelling or comma error.
I, of course, declare the variable p_fld.
Thanks for your reponse ...
Philippe
‎2007 Mar 21 11:00 PM
Have you declared the field p_fld ?
data : p_fld like dd03l-fieldname.
aRs
‎2007 Mar 21 11:18 PM
Hi,
Please change like this way.
LOOP AT it_fldcat0.
IF it_fldcat0-fieldname(1) EQ 'V'.
p_fld = it_fldcat0-fieldname.
ASSIGN COMPONENT sy-tabix OF STRUCTURE <dyn_wa> TO <fs>.
read table it_fldcat with key fieldname = p_fld.
if sy-subrc eq 0.
ASSIGN COMPONENT sy-tabix OF STRUCTURE <dyn_wa2> TO <f90>.
endif.
<fs> = <f90> + <fs>.
ENDIF.
ENDLOOP.
aRs
‎2007 Mar 21 11:28 PM
hello thanks for your answer,
now i keep the dump when i do
ASSIGN <dyn_wa> TO <dyn_table2>.
the error message is <b>
Type conflict in the ASSIGN statement in the program "ZCO_CDG_R1".</b>
also in the dump i have this message:
<DYN_TABLE2> Table reference is destroyed
What is mean ?
thanks for your help,
Philippe
‎2007 Mar 21 11:37 PM
How declared you field symbol ?
for <DYN_TABLE2> if is "type any" can you change to "type standard table".
Keep all field symbols in same type. ie <f90> <dyn_table> <fs> etc
aRs
Message was edited by:
aRs
‎2007 Mar 22 5:36 AM
hello
I declared it with the same method.
FIELD-SYMBOLS:
<dyn_table> TYPE STANDARD TABLE,
<dyn_table1> TYPE STANDARD TABLE,
<dyn_table2> TYPE STANDARD TABLE,
<dyn_wa>,
<dyn_wa2>,
<dyn_wa1>.
So i don't understand the trouble
Thanks
Philippe
‎2007 Mar 22 12:34 PM
I solve, the dump was due an error of the declaration.
thanks for your help
Philippe