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

Float in parameters

former_member242166
Participant
0 Likes
4,848

Hi ABAP experts,

How can i get the input value 10.12345 ( want full value including all decimals)   in parameters.

I used :  paramaetrs value type F.   

But getting error messages.   I want to give 10.12345 value in parameters how can i achieve this. Please Help

Thanks and Regards,

Linganathan.K

16 REPLIES 16
Read only

vinoth_aruldass
Contributor
0 Likes
2,937

hi Linganathan,

use

parameters : num TYPE p DECIMALS 2.

this will work

hope it helps,

Vinoth

Read only

vinoth_aruldass
Contributor
0 Likes
2,937

hi,

you need to specify the decimal as per your need.

hope it helps,

Vinoth

Read only

Former Member
0 Likes
2,937

Hi,

You can use packed number as suggested by Vinoth. In your case, you can use the following:

parameters: a type p decimals 5.

Hope it helps.

Regards

Purnand

Read only

Former Member
0 Likes
2,937

Hi Linganathan,

You can create a custom data element of whatever length you want along with how many ever decimals you need. and declare it as that type. For Ex: if you have created a data element ZDEC of char 13, decimals 5, you can declare your variable say GV_VALUE as below:

PARAMETERS : GV_VALUE TYPE ZDEC.

Hope this helps and hope the length of characters after decimal is fixed. If it is fixed and is 3 decimal places, data element MENGE_D. You can also use this domain DEC15_5 to create a data element of 15 char places with 5 decimals.

Hope this helps!

Read only

Former Member
0 Likes
2,937

Hi,

Linganathan has suggested a good method which I also follow. But If you have more than 3 decimal places then follow the procedure which i mentioned because I am not sure of any data element with 5 decimal places.

Regards

Purnand

Read only

0 Likes
2,937

Hi Purnand,

There is no data element with decimal 5 places and hence I suggested to create a data element with domain DEC15_5 as the domain has 5 decimal places.

There are multiple solutions to an issue, its best to respect and analyze others' solution and use the best out of the suggested ones. Its a good learning for all of us. Hope this helps!

Read only

0 Likes
2,937

Hi,

I always respect others solution as I always explore more things.

Regards

Purnand

Read only

0 Likes
2,937

Ok thanks...Cheers!

Read only

Former Member
0 Likes
2,937

Hello Linganathan,

You can use parameter TYPE as 'string' or 'C' so that user can enter values like '12356.1245' .

Further if you want use this value as float then you can convert this to float.

Or else if you just want to print this value without any operation then directly you can print it like '12356.1245'.

If you need FM for values conversion then let me know.

Regards,

Sudhir Kothavale.

Read only

0 Likes
2,937

Hi,

I don't think its possible with c data type and if he takes string, it would not be feasible as in the output it will show '10.12345' and calculation would be difficult. Why would be require FM for just inputting a packed number?

Regards

Purnand

Read only

0 Likes
2,937

purnand,

As per your suggestion, parameters: a type p decimals 5. Just put this value and check. On screen it will show you that value with a combination of comma and decimal. To adjust this again you have to change settings through SU01. So If our requirement demand just to display data then type C is ok. I said if we want to do some operation on that data then we have to use some FMs for conversion.

Best Regards,

Sudhir Kothavale.

Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
2,937

Hi Sudhir,

Not sure what kind of adjustment you are talking about? Why would the input packed decimal value will have to be adjusted?

Read only

0 Likes
2,937

Its not showing anything. Its working fine. I am afraid I have not come across with such an issue. Thank you. I will keep it in mind.

Read only

0 Likes
2,937

Hello Kumar,

He want to get the input value 10.12345 ( want full value including all decimals)   in parameters.

I checked with

PARAMETER: num type p decimals 2.

then it doesn't  allow me to enter 5 numbers(12345 ) after dot. when i put only 3 (i.e. 123) and hit enter

this value is getting displayed as (10.123,00).

May be user settings will be different for my system.( I don't have authority to change it.)

Regards,

Sudhir Kothavale.

Read only

bishwajit_das
Active Contributor
0 Likes
2,937

Hi Linganathan,

If you want 10.12345 ( want full value including all decimals) in parameters.

You need to use :

PARAMETERS: value TYPE p LENGTH 2 DECIMALS 5.

then you can get,   value = 10.12345.

Regards,

Bishwajit

Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
2,937

Hi,

As suggested by , you can use type 'P' (packed decimal) with the specification for the number of decimals you want.

As suggested by Former Member, you can create a data element with number of decimals specified but it's not really necessary to create a data element unless you need to use the parameter in method/FM signatures or table fields. If you are not doing anything of this sort, I would suggest using the standard type 'P' in the data declaration.

: Well, the number of decimals has to be specified correctly. You cannot specify it as 2 and then en...