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: 

Conversion routine

Former Member
0 Kudos

Hi All,

We have areuirement of changing '.' ina fld of decimal type to ','.Any pointers to conversion routines which can be used ishighly appreciated.It's very urgent.

Regards,

Rajashree

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos

Hi

If you want to Change this at the User level:

Menu path: SYSTEM -> USER PROFILE -> OWN DATA -> DEFAULTS TAB.

Here you can Set the Decimal format.

Or..

You can use the FM CONVERT_TO_LOCAL_CURRENCY

CONVERT_TO_FOREIGN_CURRENCY

Or..

You can use the command

REPLACE ALL OCCURRENCES OF '.' IN V_sTR WITH ','.

<b>Reward if Helpful</b>

9 REPLIES 9

Former Member
0 Kudos

hi,

You could use REPLACE ALL OCCURENCES of syntax to do the trick.

Thanks...

Preetham S

Former Member
0 Kudos

HI,

Use Replace,

DATA FIELD(10).

MOVE 'ABCB' TO FIELD.

REPLACE 'B' WITH 'string' INTO field

returns:

FIELD = 'AstringCB'

<b>Reward if helpful.</b>

Former Member
0 Kudos

Hi!

Depends on where do you wanted it to change, you can use:

- personal settings, in menu System - User defaults - Own data

- in a list using WRITE ... USING EDIT MASK ...

Regards

Tamá

Former Member
0 Kudos

hi,

Just check this sample code

CONCATENATE chg_flag wa_file1-bukrs wa_file1-aedtm wa_file1-begda

wa_file1-lgtxt wa_file1-pernr wa_file1-pernr v_bet01

INTO wa_temp1-rec SEPARATED BY ','.

CONDENSE wa_temp1-rec NO-GAPS.

This is to get the ',' between the fields.

Former Member
0 Kudos

Hi,

Instead of using conversion routines, inside the Loop ...Endloop, if you are sure of the '.' position, then use the offset concept like below.

Loop at itab.

if itab-field1+0(3) = '.'.

itab-field1+0(3) = ','.

endif.

modify itab transporting field1

clear itab.

endloop.

Hope this helps.

Regards,

JLN

Former Member
0 Kudos

Hi,

In the menu System-User Profile-Own Data, here goto the second tab. There is a field where you can select the decimal notation. You could chg this.

Thanks.....

Preetham S

Former Member
0 Kudos

Hi

if they want it for all the decimal values in all programs.. you can chng in user settings.. SAP Menu -- SYSTEM - USER PROFILE - OWN DATA..

If that is only for a specific report then you can use REPLACE STATEMENT.

but consider this thing. if the value is having more digits then there is a chnace that '.' as well as ',' will come this in the value... 12,345.00 or 12.345,00

in this case

REPLACE '.' with '@' IN w_variable.

REPLACE ',' with '.' IN w_variable.

REPLACE '@' with ',' IN w_variable.

try this...

Former Member
0 Kudos

Rajashree,

Is your requirement to convert decimals from format 999,999.00 to 999.999,00 ?

If yes.. It will probably be helpful to look at FM's with the name C14* there are some conversion routines there.

But, some of them define the decimal separator on the basis of your user profile.

varma_narayana
Active Contributor
0 Kudos

Hi

If you want to Change this at the User level:

Menu path: SYSTEM -> USER PROFILE -> OWN DATA -> DEFAULTS TAB.

Here you can Set the Decimal format.

Or..

You can use the FM CONVERT_TO_LOCAL_CURRENCY

CONVERT_TO_FOREIGN_CURRENCY

Or..

You can use the command

REPLACE ALL OCCURRENCES OF '.' IN V_sTR WITH ','.

<b>Reward if Helpful</b>