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

Former Member
0 Likes
829

hi to all

iam having amount like these 5,000.00 i want o relplace , with . and . with , is there any functional moudule to do this or can i use translate function to do it

thanks in advance

kiran kumar

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
801

Hi Kiran,

Please check this FM REPLACE_STRING.

Regards,

Ferry Lianto

8 REPLIES 8
Read only

Former Member
0 Likes
801

There is no function module for the same but would need to use either translate or replace command.

TRANSLATE lvalue using '.*'.

TRANSLATE lvalue using ',.'.

TRANSLATE lvalue using '*,'.

Regards

Anurag

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
801

Don't think that there is a function module, but the TRANSLATE will work well, you just need to use a placeholder in this case when swapping values.



REPORT  ZRICH_0001.

data: c(20) type c value ' 5,000.00'.


translate c using ',@'.
translate c using '.,'.
translate c using '@.'.

write:/ c.

Regards,

Rich Heilman

Read only

0 Likes
801

hi rich heilman,

READ TABLE IT_IN WITH KEY 'MHND-DMSHB'.

CHECK SY-SUBRC = 0.

WRITE IT_IN-VALUE TO AMOUNT.

we r getting amount into it how we should this amount to

the format for both euro and non euro

plz suggest the solution

Read only

0 Likes
801

I think you may need to check the user settings to find out how to reformat .

You can use this to get rid of any/all formatting based on the user settings. Then when you write into AMOUNT field, it will apply the user specific formatting. I assume that you want to do some calculation with the IT_IN-VALUE? A litle unclear about what you want to do.



report  zrich_0001.


data: value(20) type c value '1,235.67'.

data: xusr01 type usr01.

*   1.234.567,89
*X  1,234,567.89
*Y  1 234 567,89

select single * from usr01 into xusr01
             where bname = sy-uname.

case xusr01-dcpfm.
  when ' '.
    translate value using '. '.
    translate value using ',.'.
  when 'X'.
    translate value using ', '.
  when 'Y'.
    translate value using ',.'.
endcase.

condense value no-gaps.
write:/ value.

Regards,

Rich Heilman

Read only

0 Likes
801

hi heilman,

DATA :D_DT TYPE T005X-XDEZP.

READ TABLE IT_IN WITH KEY 'MHND-DMSHB'.

CHECK SY-SUBRC = 0.

WRITE IT_IN-VALUE TO AMOUNT.

after we getting it

here ineed to write the select statment for customer country,cusotmer and the decimal places d_dt how to write

this select statemnt so that icanpass the right amount

5.000,00 instead of 5,000.00 like wise

IF D_DT EQ 'X'.

TRANSLATE AMOUNT USING '.,,.'.

ENDIF.

IF L_CURR EQ 'EUR'.

CALL FUNCTION 'AMOUNT_STRING_CONVERT'

EXPORTING

AMOUNT_STRING = AMOUNT

DCPFM = D_DT

  • MLLN = 'M'

  • TSND = 'T'

WAERS = l_CURR

IMPORTING

AMOUNT = L_VALUE.

  • EXCEPTIONS

  • INVALID_TYPE = 1

  • OTHERS = 2

Read only

0 Likes
801

Oh Oh Oh... I see now, you are working with different currencies, that's an alltogether different story.

Regards,

Rich Heilman

Read only

0 Likes
801

hi can u plz sugggest the possible solution how the

select statement should be there .this problem is coming in dunning notices for customers other than europe.

Read only

ferry_lianto
Active Contributor
0 Likes
802

Hi Kiran,

Please check this FM REPLACE_STRING.

Regards,

Ferry Lianto