2007 Mar 08 6:33 AM
Hi-
I've got a string that contains an amount and I want to convert it into a TYPE p in my program to store as a proper amount in the database.
I can't do a simple move or use FMs like HMRC_AMOUNT_STRING_CONVERT as I am in a Unicode system and it errors if I try these.
How can I do it.
Example.
parameters p_amount type string.
start-of-selection.
data l_amount TYPE p decimals 2.
MOVE p_amount TO l_amount.
=>compile error.
Hi-
I've got a string that contains an amount and I want to convert it into a TYPE p in my program to store as a proper amount in the database.
I can't do a simple move or use FMs like HMRC_AMOUNT_STRING_CONVERT as I am in a Unicode system and it errors if I try these.
How can I do it.
Example.
parameters p_amount type string.
start-of-selection.
data l_amount TYPE p decimals 2.
MOVE p_amount TO l_amount.
=>compile error.
2007 Mar 08 6:56 AM
Hi Tristan.....
IN PARAMETERS we ca have only have predefined data
The data types valid for parameters include The built-in ABAP types c, d, i, n, p, t, and x
You cannot use data type F, references and aggregate types.
But you are using type STRING which is not allowed.
so you are getting a compiler error.
Suresh.....
2007 Mar 08 7:01 AM
You CANNOT use deep structure data type STRING as data type for PARAMETERS. Moreover STRING can be variable in length and can increase or decrease dynamically, you need to always use fixed length fields with PARAMETERS.
If you use DATA instead of PARAMETERS, you can avoid the error