‎2011 Mar 19 3:46 PM
Hi All,
Sorry for my dummy question but by checking a few threads I couldn't find answer.
I have a method with a paramter and calling it I get error message:
"variable" is not type-compatible with formal parameter "parameter"
'variable' --> data element: 'zchar2' (CHAR 2)
'parameter' --> data element: 'zchar10' (CHAR 10)
It's clear that 'zchar2' and 'zchar10' are different.
What is not clear to me why cannot I import a 2 character string into a parameter of 10 characters.
There's no error if I change the parameter's type from 'zchar10' to 'c' in the method. However I don't want this since the parameter must have 10 characters or less (and no more).
How can I define the parameter in the method properly (I don't want to manipulate 'variable')? What is the solution?
Thanks,
Csaba
Additionally:
Tried char10, string10 - it didn't help...
Edited by: Csaba Szommer on Mar 19, 2011 7:17 PM
‎2011 Mar 19 6:17 PM
Hi,
I am not trying to answer you about why SAP has provided that kind of validation.
But I wan to understand why are you passing PARAMETER with more than CHAR2 as there is no meaning as VARIABLE will truncate last 8 Characters.
Also we might want to pass PARAMETER to PARAMETER2 (Char2) and then pass PARAMETER2 to VARIABLE of method.
Thanks,
Naveen Inuganti
‎2011 Mar 19 6:17 PM
Hi,
I am not trying to answer you about why SAP has provided that kind of validation.
But I wan to understand why are you passing PARAMETER with more than CHAR2 as there is no meaning as VARIABLE will truncate last 8 Characters.
Also we might want to pass PARAMETER to PARAMETER2 (Char2) and then pass PARAMETER2 to VARIABLE of method.
Thanks,
Naveen Inuganti
‎2011 Mar 19 6:24 PM
Naveen,
Thanks for your answer.
I want to import char2 from program (from where the method is called) into the method via a char10 parameter (export / import depends on from which point we see it).
CALL METHOD dummy=>dummy
EXPORTING parameter (remark: char10) = variable (remark: char2).
Thanks,
Csaba
Edited by: Csaba Szommer on Mar 19, 2011 7:25 PM
‎2011 Mar 19 7:02 PM
Hi Csaba,
declare the parameter as TYPE ANY. This works and you can call it as
dummy=>dummy( remark ).
Regards,
Clemens