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

Convert TYPE string to TYPE p in a UNICODE system

Former Member
0 Likes
738

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.

2 REPLIES 2
Read only

Former Member
0 Likes
551

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.....

Read only

0 Likes
551

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