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

formating price pls help

Former Member
0 Likes
1,499

Hi friends,

i have a price ex: 3,45,444.98 ( this is based on the format which we set specific to country ).

it also could be 3.45.444,98 or 3 45 444,98 ( these are the possible 3 cases)

Now i want the above price to be converted to 345444.98 ( everytime, irrespective of above 3 cases ).

Is there any FM available which converts from 3,45,444.98 to 345444.98 ??

I cannot right a logic to build it because of the no of digits after decimals.

I have some countries which doenst have decimals. it may be like 3,45,444 ( no decimals ). so in this cases i cannot rgith custom logic.

pls respond,

RD

Hi friends,

i have a price ex: 3,45,444.98 ( this is based on the format which we set specific to country ).

it also could be 3.45.444,98 or 3 45 444,98 ( these are the possible 3 cases)

Now i want the above price to be converted to 345444.98 ( everytime, irrespective of above 3 cases ).

Is there any FM available which converts from 3,45,444.98 to 345444.98 ??

I cannot right a logic to build it because of the no of digits after decimals.

I have some countries which doenst have decimals. it may be like 3,45,444 ( no decimals ). so in this cases i cannot rgith custom logic.

pls respond,

RD

13 REPLIES 13
Read only

Former Member
0 Likes
1,465

You may try with Menu options.

System -> User profiles -> Own data -> Defaults (Tab).

Thanks

Satya

Read only

former_member156446
Active Contributor
0 Likes
1,465

try to move that to a floating variable and use FM to convert to character varaible and character to Packed variable with 2 decimals.

Read only

0 Likes
1,465

Jay,

canu pls explain what is the FM ?

also the last step u said to move it to 2 decimals - but there are cases wehre i have price which doenst have deciamls?

how to do this?

RD

Read only

0 Likes
1,465

I cannot user REpliace ',' or '.'.

Because if price is 3,45,444.98 , and i replce . with space, it will be 34544498 ( this is wrong).

Please see the test cases which i posted.. above..

thanks,

RD

Read only

0 Likes
1,465
v_f = ( wa_komp_o-netwr / o_komp-mglme ).

      CALL FUNCTION 'FLTP_CHAR_CONVERSION'
        EXPORTING
          decim = 5
          input = v_f
        IMPORTING
          flstr = v_c.

v_p = v_c.
Read only

0 Likes
1,465

TO FM FLTP_CHAR_CONVERSION, if i give input 3,45,444.98 and decimals 2

it is dumping..

RD

Read only

0 Likes
1,465

try this way..



"or if you unable to mention 'KUD' or 'USD' pu the commans set country 'US' before the write command


Dmbtr = 123456.

Write dmbtr currency 'KUD'
123.456

Write dmbtr currency 'USD'
1234.56

Prabhudas

Read only

0 Likes
1,465

Friends,

My input is 3,45,444.98 or 3.45.444,98 or 3 45 444,98

I need output 345444.98

If y input has 3 digits after decimals, output should be 3 digits after decimal

if y input has 0 digits after decimals, output should have 3 digits after decimals meaning, 345444

RD

Read only

0 Likes
1,465

HI,

Simple move the value to the char field. Don't use WRITE Statement to move the value from the amount field to char field.

Amount = '345444.98'.

Char = Amount.

Read only

0 Likes
1,465

>

> TO FM FLTP_CHAR_CONVERSION, if i give input 3,45,444.98 and decimals 2

> it is dumping..

> RD

you need to input the floating value into the FM.... no the value what u have... read the post what I said before.

Read only

0 Likes
1,465

Hi Avinash,

the value which is 3,45,444,98 i m getting this value in a string variable.

Hi J@y,

what do u mean ny floating value, how to convert string to a floating value?

RD

Read only

0 Likes
1,465

I dont think there is a standard way for this, but instead i called IPC again and fetched the prices from IPC, as sipc doenst send prices in formatted manner.

it will give price as 1234.44

Solved

Read only

Former Member
0 Likes
1,465

try like this..



w_curr = 3,45,444.98 .

REPLACE ALL OCCURRENCES OF ',' IN:
                w_curr WITH space .
    CONDENSE w_curr  NO-GAPS.

Prabhu