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

not convertible

Former Member
0 Likes
953

Hye techies,

I have a variable which is of type string. This has to be passed into one of the methods which has a parameter of type string.

the variable i retrieve from my programming has a type cgpl_text( char 40). When i am assigning this variable to the variable that has to be passed in the method i m getting a syntax error

variable1 and variable2 are not convertiable in unicode program.

prg:


 DATA: col_text1 type cgpl_text,
           col_text2 type string.

ASSIGN COMPONENT 'TEXT1' OF STRUCTURE <row> TO <col>.
  col_text1 = <col>.  " the value is fitting properly in col_text1.
  col_text2 = col_text1. " this statement gives error.

Please help.

Thanks,

Imran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
884

Hi,

It is failing because col_text1is a structure of type cgpl_text.

If you want to move just the text1 element to the string why not just use....

data: col_text1 type cgpl_text,
      col_text2 type string.

col_text2 = col_text1-text1.

Regards,

Darren

Hye techies,

I have a variable which is of type string. This has to be passed into one of the methods which has a parameter of type string.

the variable i retrieve from my programming has a type cgpl_text( char 40). When i am assigning this variable to the variable that has to be passed in the method i m getting a syntax error

variable1 and variable2 are not convertiable in unicode program.

prg:


 DATA: col_text1 type cgpl_text,
           col_text2 type string.

ASSIGN COMPONENT 'TEXT1' OF STRUCTURE <row> TO <col>.
  col_text1 = <col>.  " the value is fitting properly in col_text1.
  col_text2 = col_text1. " this statement gives error.

Please help.

Thanks,

Imran

5 REPLIES 5
Read only

Former Member
0 Likes
884

why are you taking col_text2 as string type????

If this error is coming just take col_text2 type char40.

i think your error will go out.

Arunima.

Read only

Former Member
0 Likes
885

Hi,

It is failing because col_text1is a structure of type cgpl_text.

If you want to move just the text1 element to the string why not just use....

data: col_text1 type cgpl_text,
      col_text2 type string.

col_text2 = col_text1-text1.

Regards,

Darren

Read only

peter_ruiz2
Active Contributor
0 Likes
884

hi Imran,

redefine your col_text2 like this


DATA: col_text2 type cgpl_text.

this should solve your problem.

regards,

Peter

Read only

Former Member
0 Likes
884

yes....you are right....as you are passing the variable of type TEXT40 then you have to take the type as TEXT40 or char40.


col_text2 type text40.

so that the col_text2 can hold col_text1-text1...

Arunima

Read only

asik_shameem
Active Contributor
0 Likes
884

Hi

You are trying to assign a structure to a string. That's the problem.

Do like this.

DATA: col_text1 type cgpl_text-text1, " Change the data type from structure to field
       col_text2 type string.
 
ASSIGN COMPONENT 'TEXT1' OF STRUCTURE <row> TO <col>.
  col_text1 = <col>. 
  col_text2 = col_text1.