Application Development 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: 

insert the internal table into database !

Former Member
0 Kudos

hi:

i want to insert the internal table into database , the internal table and database table have the same fields,

but the internal table don't have the same fields'name.

for example:

TYPES: BEGIN OF typ_ztts_proj_task , " 项目任务主数据表

value_0001 LIKE ztts_proj_task-pjsnm,

value_0002 LIKE ztts_proj_task-taskid,

value_0003 LIKE ztts_proj_task-tasknm,

value_0004 LIKE ztts_proj_task-prtyp,

value_0005 LIKE ztts_proj_task-prlvl,

END OF typ_ztts_proj_task.

DATA: it_proj_task TYPE TABLE OF typ_ztts_proj_task,

fc_proj_task TYPE typ_ztts_proj_task.

and the database table have the fields like these:

ztts_proj_task:

pjsnm LIKE ztts_proj_task-pjsnm,

taskid LIKE ztts_proj_task-taskid,

tasknm LIKE ztts_proj_task-tasknm,

prtyp LIKE ztts_proj_task-prtyp,

prlvl LIKE ztts_proj_task-prlvl,

the synax have the information like this:

the type of the database table and work area are not Unicode-convertible,

thanks!!!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi, You have to explicitly move field by field unlike in non-unicode system where we can directly pass from one one structure to other structure. In Unicode enabled systems, the system performs few checks(eg. Length) which will not be met in most of the cases. So it expects the conversions directly for data types other then 'C'. Eg: A normal structure can be directly passed to a string in Non-unicode system whereas the same results in errror for Unicode system. So try moving the values field by field though i can understand it is a pain.

4 REPLIES 4

Former Member
0 Kudos

correct code

TYPES: BEGIN OF typ_ztts_proj_task , " 项目任务主数据表

value_0001 type ztts_proj_task-pjsnm,

value_0002 type ztts_proj_task-taskid,

value_0003 type ztts_proj_task-tasknm,

value_0004 type ztts_proj_task-prtyp,

value_0005 type ztts_proj_task-prlvl,

END OF typ_ztts_proj_task.

DATA: it_proj_task TYPE TABLE OF typ_ztts_proj_task,

c_proj_task TYPE it_proj_task.

,

Former Member
0 Kudos

Declare ur Internal Tbale like this..

TYPES : BEGIN OF typ_ztts_proj_task .

INCLUDE STRUCTURE ztts_proj_task .

TYPES : END OF typ_ztts_proj_task .

DATA: it_proj_task TYPE TABLE OF typ_ztts_proj_task.

Hope it will help .

I thnk we should have same field names in the structure as well,

Thanks

Praveen

Former Member
0 Kudos

but the precondition is i must use the field name like value_000 ,

i know if i create the same fileds'name like database table ,it will success,

but i cann't modify the internal table'field name ,so tell me other solution,

thanks !!!

Former Member
0 Kudos

Hi, You have to explicitly move field by field unlike in non-unicode system where we can directly pass from one one structure to other structure. In Unicode enabled systems, the system performs few checks(eg. Length) which will not be met in most of the cases. So it expects the conversions directly for data types other then 'C'. Eg: A normal structure can be directly passed to a string in Non-unicode system whereas the same results in errror for Unicode system. So try moving the values field by field though i can understand it is a pain.