09-05-2008 5:53 PM
Hi
while creating dynamic internal table i am facing issues with FLTP types fileds lenght - doono why may be some thing to do with unicode , still i am able to manage the same but
When i am trying to assign database table data to internal table created in last step using select * into dyn_table> from dbtable
i am facing following error
" In a Unicode system, the type of the operand "dbtab" must be convertible
into that of the operand "itab" for the statement "SELECT * FROM dbtab INTO
TABLE itab". Regardless of the
length of a Unicode character, both operands must have the same
structure layout.
In this case, this condition has not been met."
I have seen multiple times structure is same ..
Pls help..
Usefull answers would be rewarded
09-05-2008 6:00 PM
Are you using field-symbols?
Send the code of the select statement and declaration part...
Thanks,
Srinivas
09-05-2008 6:00 PM
Are you using field-symbols?
Send the code of the select statement and declaration part...
Thanks,
Srinivas
09-05-2008 6:09 PM
ya im using field symbols ..
Im using following code and pls see the code in bold .. this code make the filed lenght doubles so some where iam diving it by 2 or doing some manupliation to meet my requirement and this the loop hole but donno why this is happening pls help
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa>,
<dyn_field>.
FORM get_structure.
free ifc.
DATA : idetails TYPE abap_compdescr_tab,
xdetails TYPE abap_compdescr.
DATA : ref_table_des TYPE REF TO cl_abap_structdescr.
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( p_table ).
idetails[] = ref_table_des->components[].
LOOP AT idetails INTO xdetails.
CLEAR xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
if xdetails-type_kind = 'F' or xdetails-type_kind = 'P'.
*xfc-intlen = xdetails-length * 2.*
elseif xdetails-type_kind = 'P'.*
***
xfc-intlen = 17 .*
***
else.
xfc-intlen = xdetails-length / 2.
endif.
xfc-intlen = xdetails-length .
xfc-decimals = xdetails-decimals.
APPEND xfc TO ifc.
ENDLOOP.
ENDFORM. "get_structure
&----
*& Form create_dynamic_itab
&----
This is to create internal table on run time for DSO active
tabe and assign it to FS
----
FORM create_dynamic_itab.
*Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ifc
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <dyn_table>.
*Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
ENDFORM. "create_dynamic_itab
&----
*& Form get_data
&----
It will fetch data from DSO active table.
----
FORM get_data.
*Select Data from table.
SELECT * INTO corresponding fields of table <dyn_table>
FROM (p_table).
ENDFORM. "get_data
09-05-2008 6:33 PM
Try using this logic.
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
<line> TYPE ANY.
CREATE DATA lt_data TYPE STANDARD TABLE OF (p_table). " this is your table
ASSIGN lt_data->* TO <table>.
CREATE DATA l_struct TYPE (p_table). " this is your structure
ASSIGN l_struct->* TO <line>.
A
09-06-2008 6:30 AM
Thanks Amandeep !!!
in continuation to the same i want to pass this dynamic internal table to FM RFC enabled .. for that matter i am passing these values into String and then using this string in FM .. correct me if this is wrong way to do .
Following code is giving dump ...for Unicode conversion from <l_struct> to lt_string not possible. some special conversion needed.
data : lt_string TYPE sxms_str_t.
LOOP AT <lt_data> INTO <l_struct>.
APPEND <l_struct> TO lt_string.
ENDLOOP.
Pls suggets me if there is any other way to take internal table created in last step to FM RFC enabled .
Thanks in advance .
09-06-2008 8:33 AM
09-05-2008 6:02 PM
I think you need to do.
select * into corresponding fields of table <dyn_table> from dbtable.
09-05-2008 7:37 PM
Hi,
You can try with the below code.
FIELD-SYMBOLS : <lt_tab> TYPE STANDARD TABLE,
<ls_line> TYPE ANY,
<lv_tab_value> TYPE ANY.
DATA : lr_tab TYPE REF TO data,
lr_line TYPE REF TO data.
Create reference to table name
CREATE DATA lr_tab TYPE STANDARD TABLE OF (la_table_name).
ASSIGN lr_tab->* TO <lt_tab>.
CREATE DATA lr_line TYPE (la_table_name).
ASSIGN lr_line->* TO <ls_line>.
ENDIF.
SELECT * FROM (la_table_name)
INTO TABLE <lt_tab>
WHERE (lt_condtab).
Thanks,
Srinivas