Skip to Content
avatar image
Former Member

How to interchange the dot to comma sap abap

Hi Experts,

I have simple doubt ... in database the value is showing as "1.667,000" so during debug mode i am getting "1667.000" so how to convert to this value as

1.667.

Thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

15 Answers

  • May 09, 2013 at 10:07 AM

    hi

    go to t-code OY01 and change the comma and dot separate under the country code

    or

    user wise

    t-code SU01

    Goto System->User Profile->Own data

    Defaults tab..Maintain the desired one in field Decimal Notation

    or

    use bellow code

    REPLACE ALL OCCURRENCES OF ',' IN: LV_NUM  WITH '.'.

    Regard,

    Nawa

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Dear,

      Sorry, but could you please tell me is it right to suggest to use OY01, since it will change the setting for entire country?

      Thanks -

      Makarand

  • May 09, 2013 at 08:59 AM

    What you mean is the tool you are using to see the value in the database is showing 1.666,000. Probably there is something that is converting the raw data (which is what you see in debug) into a nicely formatted display.

    The question is: what is your program actually doing?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 09, 2013 at 09:05 AM

    hi,

    From menu bar follow following steps

    System--->User Profile ----> Own Data

    Then go to Defaults Tab. There u can change the format of currency

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 09, 2013 at 09:30 AM

    Hi Jatin,

    As far as i understood your requirement is to change the format of the decimal value notations.

    If this is what you require then go to System->user profile ->own data and then go to the defaults tab.

    There you have the options to change the decimal notations.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 09, 2013 at 09:40 AM

    Hi Jatin,

    Please try below mentioned code.

    Find out the variable value l_xdezp from USR01 table for corresponding user.

    px_in is character variable

    * If comma is used for decimal separator "e.g. 1.500.010,009

    if l_xdezp eq space.

    TRANSLATE px_in-value USING '. '.

    TRANSLATE px_in-value USING ',.'.

    * If dot is used for decimal separator "e.g. 1,500,010.009

    elseif l_xdezp eq 'X'.

    TRANSLATE px_in-value USING ', '.

    endif.

    regards

    Tejas

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 09, 2013 at 09:57 AM

    Hi,

    Go to SU01. Enter the user id. Go to "Defaults" tab. Set the decimal notation. Log out of the system after saving the changes. And login again and check.

    Thanks-

    Makarand

    Add comment
    10|10000 characters needed characters exceeded

  • May 09, 2013 at 10:09 AM

    Hi Jatin,

    1. You can use SAP standard option from System - > User Profile - > Own Data.

    2. You can use Translate statement (Check F1 help) Tejas also suggested some methods using this.

    3. You can also use, Search and Replace.

    For Search and Replace Syntax is as the below mentioned

      Constants : C_DQUOTATION(2)  Value ''',

      Search L_PRESTRING For C_DQUOTATION.

      Replace All occurances of C_DOT with C_DQUOTATION.

    F1 help will give you more information. hope this helps.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 09, 2013 at 10:22 AM

    Hi,

    Just curious why you want it as 1.667.That's a strange format to work with for any purpose DB or program. Any specific need?

    Cheers,

    Arindam

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 09, 2013 at 10:23 AM

    Hi Jatin,

    As I understood, you want to convert 1667.000 number to 1.667....

    Try assigning this value to an Integer variable. I think it will remove ending 000.....

    Sample code -

    DATA:

       val   TYPE  P DECIMALS 3   VALUE '1667000',

       val1  TYPE  I.

    BREAK-POINT.

    val1 = val.

    WRITE: val1.

    To replace dot with comma use following syntax

    REPLACE '.' WITH ',' IN lv_string.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 10, 2013 at 01:56 PM

    Dear Jatin,

    Solution  1 ) U may use standard procedure menu-->system-->user profile---->own data.

    Solution 2 )  In programatically  write this logic and debug, easily understand this logic

    parameters radha type matnr.

    DATA: NEW(18) TYPE C,

           LENN TYPE I,

           NEWW(18) TYPE C,

           CH TYPE CHAR18,

            POS TYPE CHAR4,

           COUNT TYPE I,

           P TYPE I,

           KP(18) TYPE C,

           tp(18) type c,

           price(18) type C,

           l_prodh(5) type c.

    *PRICE = WA_VBRP1-PRODH.

    price =   RADHA.

    SHIFT PRICE LEFT DELETING LEADING SPACE.

    SPLIT PRICE AT '.' INTO NEW NEWW.

    CLEAR : PRICE.

    LENN = STRLEN( NEW ).

    POS = LENN.

    POS = POS - 1.

    COUNT = 0.

    DO LENN TIMES.

       P = SY-INDEX.

       COUNT = COUNT + 1.

    IF P = 3 .

    IF LENN = P.

       CH = NEW+POS(1).

       CONCATENATE  CH KP INTO KP.

    ELSE.

       CH = NEW+POS(p).

    concatenate '.' ch into kp.

       endif.

    else.

      IF P = 1 OR P = 2 OR P = 3 OR P = 4 OR P = 5 OR P = 6 OR P = 8 OR P = 9 OR P = 11 OR P = 12.

    *  if not p = 7.

         CH = NEW+POS(1).

         concatenate ch kp into kp.

        else.

           CH = NEW+POS(1).

           concatenate CH '.' INTO CH.

           CONCATENATE CH KP INTO KP.

       endif.

      endif.

      POS = POS - 1.

    ENDDO.

    IF KP <> ' ' AND NEWW <> ' '.

    CONCATENATE kp neww into tp separated by ','.

    CLEAR: L_PRODH.

    L_PRODH = TP.

    ENDIF.

    CLEAR: TP,KP.

    Regards,

    Radhakrishna.Ette

    Add comment
    10|10000 characters needed characters exceeded