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: 

function module to split integer portion and decimal portion

Former Member
0 Kudos

Hi friends,

Could anyone tell me the function module to split the price variable into two portions one with integer portion and another with decimal portion.....without using the Splitr command....because with this command i have to specify the split delimiter which may be changed with the user profile settings in the production.

1 ACCEPTED SOLUTION

former_member491305
Active Contributor
0 Kudos

Hi,

Use the following select query to find the decimal notation for a particular user.And then use split command.

SELECT SINGLE dcpfm FROM usr01 INTO v_dcpfm WHERE bname = sy-uname.

IF v_dcpfm = space OR v_dcpfm = 'Y' .

split v_price at '.' Into amount1 amount2.

ELSEIF v_dcpfm = 'X'.

split v_price at ',' Into amount1 amount2.

ENDIF.

4 REPLIES 4

abapdeveloper20
Contributor
0 Kudos

Hi ramineni,

No need of Fun.module..this will do

DATA : TEMP TYPE P DECIMALS 3.

I = TRUNC( TEMP ). " integer part

D = FRAC( TEMP ). " decimal part

Former Member
0 Kudos

Hi

Use Functions:

<b>TRUNC</b> Interger part of x

<b>FRAC</b> Decimal part of x

Regards

Raj

Former Member
0 Kudos

i think u can use split command

SPLIT ITAB-LINE AT '.' INTO ZITAB-F1 ZITAB-F2

ZITAB-F3 ZITAB-F4 ZITAB-F5

former_member491305
Active Contributor
0 Kudos

Hi,

Use the following select query to find the decimal notation for a particular user.And then use split command.

SELECT SINGLE dcpfm FROM usr01 INTO v_dcpfm WHERE bname = sy-uname.

IF v_dcpfm = space OR v_dcpfm = 'Y' .

split v_price at '.' Into amount1 amount2.

ELSEIF v_dcpfm = 'X'.

split v_price at ',' Into amount1 amount2.

ENDIF.