06-13-2011 6:24 AM
hello experts,
i'm having a short dump error Unicode_types_not convetrible.
actually where upgrading from 4.6 to ecc6.
this is the syntax.
data: i_data type standard table of tab512,
w_data(192) type c.
parameters: s_tab(60) type c,
s_ctab(60) type c.
select * from (s_tab) into table i_data.
loop at i_data into w_data.
insert into (s_ctab) value w_data.
endloop.
please help.
Thank You.
06-13-2011 8:28 AM
SAMPLE:
S_TAB = MARA -
> original table
s_CTAB = ZMARA -
> copy table
06-13-2011 8:35 AM
06-13-2011 8:39 AM
error is in statement .
example: s_tab = mara
select * from (s_tab) into table i_data.
The types of operands"dbtab" and "itab" are not mutually convertible.
please help
06-13-2011 10:13 AM
Hi Bernadette,
what ever you do, please use
select * from (s_tab) into CORRESPONDING FIELDS OF table i_data.
If the database table and the internal table have at least one field of the same name, you will get results following the "works as designed" clause.
Somebody will come and say "CORRESPONDING FIELDS OF" will give lower performance. This is an [urban legend|http://www.google.de/url?sa=t&source=web&cd=1&ved=0CCsQFjAA&url=http%3A%2F%2Fwww.snopes.com%2F&ei=ptT1TePPLsrIswbG252ZBg&usg=AFQjCNGef9g87vH-E1zz3C1QcYgyZiU61Q&sig2=-O0a6c4rMfDJSP316yBP-Q].
Regards,
Clemens
06-13-2011 10:16 AM
hi.
i_data doesn't have a same field it is a type standard table of Tab512 which contain only one compnent field WA char type size 512.
06-13-2011 12:12 PM
I suppose this data comes from FM RFC_GET_TABLE_ENTRIES ?
You will have to map records of the internal table to records of a structure compatible with the database table using class CL_ABAP_CONTAINER_UTILITIES
CLASS cl_abap_container_utilities DEFINITION LOAD.
DATA dref TYPE REF TO data.
FIELD-SYMBOLS: <wa> TYPE ANY.
CREATE DATA dref TYPE (dbtab).
ASSIGN dref->* TO <wa>.
...
LOOP AT entries INTO tab512.
CALL METHOD cl_abap_container_utilities=>read_container_c
EXPORTING
im_container = tab512-wa
IMPORTING
ex_value = <wa>
EXCEPTIONS
illegal_parameter_type = 1
OTHERS = 2.
INSERT INTO INTO (dbctab) value <wa>.
ENDLOOP.
Of course you can use some [ASSIGN CASTING|http://help.sap.com/abapdocu_70/en/ABAPASSIGN_CASTING.htm] in your code.
Regards,
Raymond
06-14-2011 3:42 AM
06-14-2011 7:14 AM
hi experts,
please help me on this i'm getting error Method Create is unknown or protected or private.
DATA: lo_structtype type ref to cl_abap_structdescr,
lo_tabletype type ref to cl_abap_tabledescr,
lr_structdata type ref to data,
lr_tabledata type ref to data.
field-symbols: <ls> type any,
<lt> type standard table.
* get the type for the structure
lo_structtype ?= cl_abap_structdescr=>describe_by_name( s_tab ).
* get the type of the table
lo_tabletype = cl_abap_tabledescr=>create( p_line_type = lo_structtype ). ------------------> ERROR
* create the data
create data: lr_structdata type handle lo_structtype,
lr_tabledata type handle lo_tabletype.
* assign the field symbols
assign lr_structdata->* to <ls>.
assign lr_tabledata->* to <lt>.
* select the data
select * from (s_tab) into <ls>.
append <ls> to <lt>.
endselect.
06-13-2011 9:23 AM
You must use structure compatible with the database definition, take a look at the sample in [CREATE DATA - TABLE OF|http://help.sap.com/abapdocu_70/en/ABAPCREATE_DATA_ITAB.htm] to get an idea.
FIELD-SYMBOLS: <itab> TYPE ANY TABLE,
<wa> TYPE ANY.
CREATE DATA dref TYPE STANDARD TABLE OF (dbtab)
WITH NON-UNIQUE DEFAULT KEY.
ASSIGN dref->* TO <itab>.
SELECT *
FROM (dbtab) UP TO rows ROWS
INTO TABLE <it>.
LOOP AT <itab> ASSIGNING <wa>.
Regards,
Raymond