cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in data type

Former Member
0 Kudos

Hi,

We are facing a problem with one of our programs. It has to do with Decimal Notation.If you change the decimal as type p decimals 3 then execute the program the value becomes 10 times the original value. If you change it to type p decimals 2 then the value is corrrect after converting to currency. Any inputs are appreciated.

REPORT ZAVEEK.

DATA: l TYPE p DECIMALS 2 VALUE '234.567',

charout(16) TYPE c,

charout1(16) TYPE c.

WRITE: l TO charout CURRENCY 'GBP'.

MOVE l TO charout1.

WRITE: / l,

/ charout,

/ charout1.

regards

Aveek

Accepted Solutions (0)

Answers (1)

Answers (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

When writing using a currency, the system will always move the decimal point where it thinks it should be regardless of where its add before the write statement. What is your requirement here.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

We have a process order variance custom report at our client site. The problem is strange as it reduces the value by 10 times in the development server and increases the value by 10 times in the pre-prod server.

I need to make sure that the value after writing to currency is accurate when we check the activity cost report ( KSBT ) and the custom report to get the right fiscal values in the process order variance Report.

wa_h_act-stdu = wa_h_act-vgwxx *

( wa_h_act-togxx / wa_h_act-toexx ).

WRITE : wa_h_act-stdu TO l_std CURRENCY v_waers

NO-GROUPING.

This always increases by 10 times in both the servers.

However the value is accurate in the development server and inaccurate in the pre-prod server. Could it be the program or the set up of the master data in costing.

regards

Aveek

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Is this currency setup correctly in both systems?

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

According to SAP:

-


Correct format for currency specified in the field w.

Treats the contents of f as a currency amount. The currency specified in w determines how many decimal places this amount should have.

The contents of w are used as a currency key for the table TCURX; if there is no entry for w, the system assumes that the currency amount has 2 decimal places.

The Currency key GBP is not maintained in either of the 2 systems in the table TCURX.

Still it differs in value in both systems.

How do we set up the currency ?

regards

Aveek

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Why can't "I" be of TYPE P DECIMALS 2? Is there a specific reason.

Regards,

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Or you can move it to a decimal 2 field before the write.

report zrich_0001.


data: l type p decimals 3 value '234.567',
      p type p decimals 2,
      charout(16) type c,
      charout1(16) type c.

p = l.

write: p to charout currency 'USD'.

move l to charout1.


write: / l,
       / charout,
       / charout1.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

I have tried this earlier and it works fine. However the calculated values from ksbt and the custom report do not provide the correct answer in the development server but does return a correct value in the pre-prod server with the type p decimals 2. I have also tried type p decimals 0 and it returns the same value as type p decimals 2. The currency GBP is not maintained in either of the 2 SAP systems. Any clues.

regards

Aveek

Former Member
0 Kudos

Hello,

Try to check the currency formats in both the system. Is the same , . Try to change them and then run the report see if there are any changes.

Regards,

Shekhar Kulkarni

Former Member
0 Kudos

Hi,

I changed the currency formats but the report displays incorrect data. In fact there are no changes to the report output by changing the currency formats.

regards

Aveek

Vinod_Chandran
Active Contributor
0 Kudos

Hi Aveek,

Can you please check if the program attribute Fixed point arithmetic is set?

If the program attribute Fixed point arithmetic is not set, type P fields are interpreted as integers without decimal places.

Thanks

Vinod

Former Member
0 Kudos

Hi,

Fixed point arithmetic has been ticked already in the program.

regards

Aveek

Former Member
0 Kudos

Hi,

Fixed point arithmetic has been ticked already in the program.

regards

Aveek