Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Failed to update database record using field-symbol

Former Member
0 Likes
839

Hi

I have one question regrading the Field-Symbol to update the database table. I created the internal table using the dynamic method. When all of the information has been stored to internal table than executing the last command - insert. The error would be occur -

Runtime Error - UNICODE_TYPES_NOT_CONVERTIBLE

The types of the operands "dbtab" and "wa" are not mutually convertible.

I checked the internal table and database table structrue. They were same data type and length. Futhermore, I try the other [update to database command ], such as modify and update but still failed. What' happened ? Please get me the detail.

Thanks a lot !

Hi

I have one question regrading the Field-Symbol to update the database table. I created the internal table using the dynamic method. When all of the information has been stored to internal table than executing the last command - insert. The error would be occur -

Runtime Error - UNICODE_TYPES_NOT_CONVERTIBLE

The types of the operands "dbtab" and "wa" are not mutually convertible.

I checked the internal table and database table structrue. They were same data type and length. Futhermore, I try the other [update to database command ], such as modify and update but still failed. What' happened ? Please get me the detail.

Thanks a lot !

5 REPLIES 5
Read only

Former Member
0 Likes
771

solved it !

Read only

Former Member
0 Likes
771

solved it

Read only

0 Likes
771

Hi,

What was the solution ?

Thanks,

Read only

0 Likes
771

Are you used the bulid-in method CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE ?

if yes, the problem is the new structure which does not match your orginal table structure.The error will trigger because the field length size is double. If you want to solve that you must be changed the fields lenght correspondence with the orginal fields.

Here is my source code

Please execute the method CREATE_DYNAMIC_TABLE first !

DATA:IT_STRUCT_INFO TYPE ABAP_COMPDESCR_TAB,

WA_STRUCT_INFO TYPE ABAP_COMPDESCR.

DATA:REF_TABLE_DES TYPE REF TO CL_ABAP_STRUCTDESCR.

DATA:PR_LEN LIKE XFC-INTLEN.

REF_TABLE_DES ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( P_TABLE ).

IT_STRUCT_INFO[] = REF_TABLE_DES->COMPONENTS[].

LOOP AT IT_STRUCT_INFO INTO WA_STRUCT_INFO.

CLEAR XFC.

IF WA_STRUCT_INFO-TYPE_KIND = 'C'.

PR_LEN = WA_STRUCT_INFO-LENGTH / 2.

ENDIF.

XFC-FIELDNAME = WA_STRUCT_INFO-NAME .

XFC-DATATYPE = WA_STRUCT_INFO-TYPE_KIND.

XFC-INTTYPE = WA_STRUCT_INFO-TYPE_KIND.

XFC-INTLEN = PR_LEN.

XFC-DECIMALS = WA_STRUCT_INFO-DECIMALS.

APPEND XFC TO IFC.

ENDLOOP.

FREE: REF_TABLE_DES,IT_STRUCT_INFO,WA_STRUCT_INFO.

CLEAR:REF_TABLE_DES,IT_STRUCT_INFO,WA_STRUCT_INFO.

please reward the points !

Read only

Former Member
0 Likes
771

Hello Wong,

Thanks so very much for this solution.

I was able to resolve my problem successfully.

I award you points for this.

Ajeet Phadnis