2008 Oct 23 8:29 AM
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
2008 Oct 23 8:35 AM
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
2008 Oct 23 8:33 AM
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.
2008 Oct 23 8:35 AM
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
2008 Oct 23 8:37 AM
hi Imran,
redefine your col_text2 like this
DATA: col_text2 type cgpl_text.
this should solve your problem.
regards,
Peter
2008 Oct 23 8:44 AM
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
2008 Oct 23 8:46 AM
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.