Application Development 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: 

Get decimal part of KBETR, some FModule?

Former Member
0 Kudos

Hi there ABAP-mates

I've got a small problem. I've got a kbetr number, let's say 421,10 ...

... now I'd like to detect if two of characters after comma are = '00' or not= '00' ...

... I know I can cast it to strings and then check last 2 characters ...

... but maybe there is some other, more professional way to do this? Do You know such FModule which would give me the decimal part of kbetr number?

I'd be thankful for help. Greetings.

1 ACCEPTED SOLUTION

Former Member

Hi,

You can use the function FRAC..

Check this example

DATA: l_input    TYPE kbetr.
DATA: l_decimals TYPE kbetr.

* Get the input
l_input = '421.10'.

* Get the decimals.
l_decimals = FRAC( l_input ).

* Check if it is initial.
IF l_decimals IS INITIAL.
  WRITE: / 'No decimal values found'.
ELSE.
  WRITE: / 'Decimal values found', l_decimals.
ENDIF.

Thanks

Naren

1 REPLY 1

Former Member

Hi,

You can use the function FRAC..

Check this example

DATA: l_input    TYPE kbetr.
DATA: l_decimals TYPE kbetr.

* Get the input
l_input = '421.10'.

* Get the decimals.
l_decimals = FRAC( l_input ).

* Check if it is initial.
IF l_decimals IS INITIAL.
  WRITE: / 'No decimal values found'.
ELSE.
  WRITE: / 'Decimal values found', l_decimals.
ENDIF.

Thanks

Naren