2014 May 16 1:18 PM
Hello Folks,
My problem is very simple but hey I have tried everything and dont know why I have an issue and what is the possible solution. Let me create the scenario:-
SAP Dev Box:
data: prctg type char15.
prctg = '0.065'.
prctg = prctg * 100000.
i see prctg value to be: 6500. Which is good.
SAP ITG Box:
data: prctg type char15.
prctg = '0.065'.
prctg = prctg * 100000.
i see prctg value to be: 65000. Which is absurd and wrong!!!!
.
Question: How can 2 environments behave differently? What is the solution to have the same result as the DEV Box using a reliable method please.
Thanks alot!!!! Yet I have had no one resolve this issue for me in my workplace so I came here desparately!!
Salman
2014 May 16 8:24 PM
Guys I have tried all combinations above and nothing has worked. But I have managed to isolate the issue and maybe you people can advice....
The issue described is not happening if i create a simple program TES1 between DEV and ITG. Both behave similarly and correctly.
The issue is only coming while using the exit: FV64A301
So when I have the above piece of code in that exit its acting weird. But if i have the same piece of code outside the exit in a new program it works....Is that an exit specific issue?
2014 May 16 2:27 PM
I'd have to start with, why are you doing math with a char type? At the very least, you should cast it to a numeric type.
Neal
2014 May 16 2:30 PM
We want the end result in character only due to limitation of the interface. Please suggest me something that will work in both ITG and DEV consistently. Right now i am getting mad!!! Please help....
2014 May 16 2:33 PM
Hi Neal,
I am also from Salman's team. The issue is even more weird.
I have two numbers:
data : var1 type p decimals 4,
var2 type p decimals 3.
var2 = 0.065.
var1 = var2.
Thus the value in var1 after assignment becomes 0.0065 !!
But again in Dev system it is working fine.
Can anyone please suggest us a solution. We have tried everything.
Saurabh.
2014 May 16 3:02 PM
Hi
Eg: DATA VAL1 TYPE C,
VAL2 TYPE I.
VAL2 = 34.56.
WRITE VAL2 TO VAL1.
Regards,
Philip
2014 May 16 3:11 PM
Then you cast it into numeric, and then back to char when you are finished. Cast is a relative term here. a = b is in effect a cast if they are of different data types.
2014 May 16 3:19 PM
p types should always have 2 lengths. Field length and decimal length.
So,
data : var1 type p length 5 decimals 4,
var2 type p length 4 decimals 3.
Note the difference in length. That allows roughly the same sized number in each.
Neal
2014 May 16 6:59 PM
This does seem the simplest solution, but its always good to know why other things weren't working.
Neal
2014 May 16 8:19 PM
Hi,
This does not work as as the integer variable basically rounds the decimals to the nearest integer...
I also tried with declaring it as P or F but still no luck
2014 May 16 8:20 PM
Tried this also. Doesnt work...Same issue as i had listed in the original question.
2014 May 16 2:47 PM
Hi Salman,
Please check and make identical ur user settings in both the systems.
Chack all setting in (SHIFT + F12).
Hope this will resolve ur issue.
Thanks,
2014 May 16 3:53 PM
Hi Salman,
Did you try out the solution which I suggested?
Regards,
Philip.
2014 May 16 3:54 PM
I will try all of the solutions and report back urgently...Thanks alot Guys!
2014 May 16 8:24 PM
Guys I have tried all combinations above and nothing has worked. But I have managed to isolate the issue and maybe you people can advice....
The issue described is not happening if i create a simple program TES1 between DEV and ITG. Both behave similarly and correctly.
The issue is only coming while using the exit: FV64A301
So when I have the above piece of code in that exit its acting weird. But if i have the same piece of code outside the exit in a new program it works....Is that an exit specific issue?
2014 May 17 7:56 AM
Salman
What is the exact settings you have in user profile plus what exact output you are getting..Carefully check your decimal and thousand separators. Please add debugging screen shots and sample code details
Nabheet
2014 May 17 1:50 PM
Hi,
It's to do with deactivated 'Fixed point arithmetic' in V61A, where FV64A301 is ultimately included, I believe:
My guess is that in the system, where it is working, someone has activated 'Fixed point arithmetic' in V61A via repair or otherwise.
You can verify if the issue is inactive Fixed point arithmetic, by reproducing (inactivating it in Program attributes) in your test program.
Are you coding your business logic directly in enhancement implementations? If yes, why don't you modularize your business logic in, say, a class method? Or at least a custom Function module? 😐 Define some kind of interface (I don't mean ABAP OO Interface, but interface in general - what SAP data you need to pass, what data you need to return or change), and encapsulate your logic in a separate procedure, which you then can call from Enhancement implementation...
Just because you see too many to count lazy SAP programmers programming ridiculous "naked" (not modularized) enhancement implementations in the middle of existing Function modules and other modularization units, doesn't mean it's a good thing to do... It makes original code more unreadable than it already was and what if you or someone else needs to reuse that business logic...? And as added benefit, you'll encounter less galling issues like this...
cheers
Jānis
2014 May 19 6:23 PM
Great Idea Janis. I did exactly that you mentioned and it worked. Your idea not only helped to solve the issue but also made me make code cleaner. I basically in the Standard 301 exit created a custom function and for that the Arithmetic flag was ticked on and it worked like a charm!!!! thanks again!!