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: 

Decimal Notation issue while comparing the values in Select query

former_member267445
Participant
0 Kudos

Hello Gurus,

I am working on Material Pricing user exit. I have the Gauge value in MARA table as 2,000(US Notation) and also I am having Custom table in that there are  2 fields as Gauge From and Gauge To with values 1,000 and 3,000. Initially am fetching the Gauge value from Material Master data and comparing that Gauge value in Custom table between Gauge From and Gauge To and I need to pass the Condition Type to pricing table, Here select query is failing due to decimal notation which I have observed in Run time.

In run time the Gauge value is taking as 2.000(UK Notation). The Data type for the Gauge value in MARA is DEC and Gauge From and Gauge To is also DEC.

I have searched in SCN and I came to know about Translate, Replace with etc., as per my understanding these will work for Characters or strings.

How can I resolve this issue. Kindly help me on this issue.

Thanks and Regards,

Muralikrishna Peravali.

1 ACCEPTED SOLUTION

Juwin
Active Contributor
0 Kudos

When comparing values inside any program, you need to follow SAP's internal format of numbers - not country specific format. SAP's internal format uses . as decimal separator.

Thanks,

Juwin

7 REPLIES 7

Juwin
Active Contributor
0 Kudos

When comparing values inside any program, you need to follow SAP's internal format of numbers - not country specific format. SAP's internal format uses . as decimal separator.

Thanks,

Juwin

0 Kudos

Hello Juwin,

Thank you for the reply. In my custom tables the values are with , separator. Can I take the character type in custom table and also convert the Gauge value to character type then it will work?

Thanks and Regards,

Muralikrishna Peravali

Juwin
Active Contributor
0 Kudos

What you "see", is based on your user defaults setting in your user master. SAP always stores decimals with . separator only.

If one of the number fields is in Character string, then you are in trouble. You will have to convert that to a number and then compare. Else, just number comparison will work without any conversions.

Thanks,

Juwin

former_member267445
Participant
0 Kudos

HellobGurus,

Any suggestions?

Thanks and Regards,

Muralikrishna

0 Kudos

Hello Gurus,

Any suggestion please.

Thanks and Regards,

Murlaikrishna Peravali

Jelena
Active Contributor
0 Kudos

All "gurus" are on vacation.

Juwin has already explained very clearly how this works and what needs to be done. Is there some problem with following his suggestions? This is ABAP 101.

Sandra_Rossi
Active Contributor
0 Kudos

The "easy" way for you to understand, is to write a test program SELECT * FROM <yourtable> INTO <workarea> WHERE <primarykey>, and look by debug at the content of <workarea>-<problemfield>. You will see the exact internal value (and you'll see that MARA-<gauge field> actually contains 2.000, and not 2,000.

PS: my explanation is very much simplified because of course it's not really stored 2.000 because the decimal point is not stored, but this is not a training forum here.

By the way, I don't even know whether your "2.000" is 2 thousands, or 2 only.