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 for converting character to currency

Former Member
0 Kudos

Hi,

I have got a field with the currency data type, but the text file given to me has only character. so i need a

Function Module to convert the character field to currency.

3 REPLIES 3

anversha_s
Active Contributor
0 Kudos

hi,

use this FM HRCM_STRING_TO_AMOUNT_CONVERT

pass the string , thousand separator,decimal separator, if it is currecy pass currecy key WAERS.

or try this code.

DATA: v_dcpfm    TYPE usr01-dcpfm,
      v_amount   TYPE bseg-wrbtr,
      v_char(16) TYPE C.
 
SELECT SINGLE dcpfm FROM usr01
                    INTO v_dcpfm
                   WHERE bname = sy-uname.
IF v_dcpfm = 'X'.
*-- decimal point is '.' and thousands separator is ','
  TRANSLATE v_char USING ', '.
  CONDENSE v_char NO-GAPS.
  v_amount = v_char.

ELSEIF v_dcpfm = 'Y'.
*-- decimal point is ',' and thousands separator is '.'
  TRANSLATE v_char USING '. '.
  CONDENSE v_char NO-GAPS.
  v_amount = v_char.

ELSE.
*-- decimal point is ',' and thousands separator is space
  CONDENSE v_char NO-GAPS.
  v_amount = v_char.
ENDIF.

rgds

Anver

if hlped pls mark points

Former Member
0 Kudos

Hi

Try ISM_CONVERT_CHAR_TO_CURR

function module.

reward points if helpful.

Regs

Manas Ranjan Panda

Former Member
0 Kudos

Hi clara,

Use the 'PACK' command.