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

Decimal format issue.

pravin_kusumbe2
Participant
0 Likes
6,635

Hi Guys,

We have a Z-program with which we are uploading the inspection characteristics and its value from a text file in Z table in SAP.

While uploading the data, If the value is 9,235, It is uploaded correctly with my id but the same file when uploaded by the user from Europe.

It is showing the abnormal behavior as the uploaded value is in decimal format like 9.235. and they do expect in comma format.

The user setting are same in SU01.

The program doesn't refer any country specific setting for format. How can be two different users are getting two different results?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,078

You say 'When uploading'....  not 'When displaying' or 'When entering'.

So what is the decimal settings for the program used to generate the text file ?  If it's Excel then that could be the cause - Windows regionalisation.

10 REPLIES 10
Read only

chandan_praharaj
Contributor
0 Likes
4,078

Can you please post his and your SU01D screenshot. That is the only thing which can cause issue.

Read only

Saha_Arpan
Explorer
0 Likes
4,078

This is happening due to issue with user format in SU3. You need to generate the data based on thousand seperator and decimal seperator using FM: CLSE_SELECT_USR01

Read only

deepan_v_s
Active Participant
0 Likes
4,078

Hi Pravin,

It's due to user parameters in SU01. Both the users might have different parameters.

Check the parameters below,

In this case, ',' will be taken as a decimal point. So the program is taking the entry which you are trying to insert as a decimal number and the table field will be of type Whole number.

You can try to change your user parameters to the above format and for sure you will get same error.

In order to solve this, all the users using the program needs to have same Parameters, or it should be handled programmatically.

Regards,

Deepan Swaminathan.

Read only

0 Likes
4,078

Hi

Both the users have same user settings in SU01.

I have checked that already.

Read only

0 Likes
4,078

Hi,

Then it might be due to the file.. There will be mismatch in the file which has been uploaded by other user.

Kindly cross check !!

Regards,

Deepan.

Read only

Former Member
0 Likes
4,079

You say 'When uploading'....  not 'When displaying' or 'When entering'.

So what is the decimal settings for the program used to generate the text file ?  If it's Excel then that could be the cause - Windows regionalisation.

Read only

Former Member
0 Likes
4,078

Pravin K wrote:

Hi Guys,

We have a Z-program with which we are uploading the inspection characteristics and its value from a text file in Z table in SAP.

While uploading the data, If the value is 9,235, It is uploaded correctly with my id but the same file when uploaded by the user from Europe.

It is showing the abnormal behavior as the uploaded value is in decimal format like 9.235. and they do expect in comma format.

The user setting are same in SU01.

The program doesn't refer any country specific setting for format. How can be two different users are getting two different results?

HI Pravin,

Try with below code.

data:

    lf_dcpfm type usr01-dcpfm,         " User's decimal notation

    lf_thousand_sep(1) type c,         " Thousands separator

    lf_decimal_sep(1) type c,          " Decimal separator

    lf_amt type konp-kbetr.

**-Get user's decimal notation

  select single dcpfm

    into lf_dcpfm

    from usr01

    where bname = sy-uname.

  if lf_dcpfm = c_x.           " 1,234,567.89

    lf_thousand_sep = c_char_comma.

    lf_decimal_sep = c_dot.

  elseif lf_dcpfm = c_y.       " 1 234 567,89

    lf_thousand_sep = ' '.

    lf_decimal_sep = c_char_comma.

  elseif lf_dcpfm is initial.  " 1.234.567,89

    lf_thousand_sep = c_dot.

    lf_decimal_sep = c_char_comma.

  endif.

**-Convert string to amount

  CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'

    EXPORTING

      STRING                    = pc_kbetr

      DECIMAL_SEPARATOR         = lf_decimal_sep

      THOUSANDS_SEPARATOR       = lf_thousand_sep

*      WAERS                     = ' '

    IMPORTING

      BETRG                     = lf_amt

    EXCEPTIONS

      CONVERT_ERROR             = 1

      OTHERS                    = 2 .

  IF SY-SUBRC <> 0.

*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  else.

**---Move amount back to string

    move lf_amt to pc_kbetr.

    condense pc_kbetr.

  ENDIF.

Regards,

Pravin

Read only

0 Likes
4,078

Thanks all,

I am able to replicate the issue with my user id.

Yes It is Windows regionalisation issue.

Read only

asim_isik
Active Participant
0 Likes
4,078

Hi Pravin ,

Its Windows Issue. Its a z-program just if you find '.' in value change it to ','.

replace all occurrences of '.' in lv_value with ','.

Read only

Former Member
0 Likes
4,078

Changing a numbers group separators and decimal points to the 'normal' decimal point and no separators is not as easy as what Asim states.  His fix will not work in all cases.

Regards

Rich