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

function module to split integer portion and decimal portion

Former Member
0 Likes
6,694

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
Read only

former_member491305
Active Contributor
0 Likes
2,377

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
Read only

abapdeveloper20
Contributor
0 Likes
2,375

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

Read only

Former Member
0 Likes
2,375

Hi

Use Functions:

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

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

Regards

Raj

Read only

Former Member
0 Likes
2,375

i think u can use split command

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

ZITAB-F3 ZITAB-F4 ZITAB-F5

Read only

former_member491305
Active Contributor
0 Likes
2,378

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.