2006 Dec 06 7:06 AM
Pls look at my code:
FIELD-SYMBOLS: <intab> TYPE ANY TABLE.
LOOP AT gt_zbolog.
table = gt_zbolog-ztable.
CONCATENATE 'GT_' gt_zbolog-ztable INTO intab.
ASSIGN (intab) TO <intab>.
SELECT * FROM (table) INTO CORRESPONDING FIELDS OF TABLE <intab>.
.......
ENDLOOP.
when run at this program,show 'ASSIGN_TYPE_CONFLICT' error.
How should I change the code?
2006 Dec 06 7:08 AM
hi,
chk this code.
REPORT zdyn.
PARAMETERS: comp(80).
DATA: dref TYPE REF TO data.
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE.
CREATE DATA dref TYPE TABLE OF (comp).
ASSIGN dref->* TO <dyn_table>.
SELECT * FROM (comp)
INTO TABLE <dyn_table>.
BREAK-POINT.rgds
Anver
Pls look at my code:
FIELD-SYMBOLS: <intab> TYPE ANY TABLE.
LOOP AT gt_zbolog.
table = gt_zbolog-ztable.
CONCATENATE 'GT_' gt_zbolog-ztable INTO intab.
ASSIGN (intab) TO <intab>.
SELECT * FROM (table) INTO CORRESPONDING FIELDS OF TABLE <intab>.
.......
ENDLOOP.
when run at this program,show 'ASSIGN_TYPE_CONFLICT' error.
How should I change the code?
2006 Dec 06 7:08 AM
hi,
chk this code.
REPORT zdyn.
PARAMETERS: comp(80).
DATA: dref TYPE REF TO data.
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE.
CREATE DATA dref TYPE TABLE OF (comp).
ASSIGN dref->* TO <dyn_table>.
SELECT * FROM (comp)
INTO TABLE <dyn_table>.
BREAK-POINT.rgds
Anver
2006 Dec 06 7:52 AM
Still, I find the comp can not be internal table in CREATE DATA dref TYPE TABLE OF (comp), for example ,I set comp = 'gt_adrc', it shows CREATE_DATA_UNKNOWN_TYPE.
2006 Dec 06 8:03 AM
2006 Dec 06 7:09 AM
Johnson,
first write the select query and after that only u give the loop statement.
eg.
table: vbak.
data: t_vbak like vbak occurs 0 with header line.
select * from vbak into corresponding fields of table t_vbak where ...
like this u have to write.
2006 Dec 06 7:15 AM
2006 Dec 06 7:19 AM
Hi Johnson,
you can not assign (intab) directly to field symbol, check the following program.
REPORT zfs2 .
PARAMETERs : tabname TYPE dd02l-tabname.
type-pools : slis.
DATA tabref TYPE ref to data.
FIELD-SYMBOLS <fs_table> type TABLE.
data : lv_fcat type SLIS_T_FIELDCAT_ALV .
data: lt_fieldcat type lvc_t_fcat.
data : ls_fieldcat type slis_fieldcat_alv.
data: lp_table_temp type ref to data.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
* I_PROGRAM_NAME = sy-repid
* I_INTERNAL_TABNAME = lv_tabname
I_STRUCTURE_NAME = Tabname
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = lv_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
.
field-symbols: <fs_wa> type any.
data : ls_fcat like line of lt_fieldcat.
loop at lv_fcat into ls_fieldcat.
move-corresponding ls_fieldcat to ls_fcat.
append ls_fcat to lt_fieldcat.
endloop.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = lt_fieldcat
IMPORTING ep_table = lp_table_temp.
ASSIGN lp_table_temp->* TO <fs_table>.
SELECT * FROM (tabname) INTO TABle <fs_table> .
break-point.
hope this helps.
Regards,
Kinshuk