Page 1 of 1
SAP :X
Posted: Wed Jun 04, 2008 4:02 pm
by Eric
SAP Drives me crazy!
Anyone deal with a system sending negative number fields as "1-". It obviously errors on TI. Any tips or tricks or do i need do the following.

"To frustrated to write actual code"
IF Last character of string ="-"
Remove last character and convert to number then * -1
Else
convert string to number.
Re: SAP :X
Posted: Wed Jun 04, 2008 4:53 pm
by Mike Cowie
Eric,
I don't know of a natural way to make TI understand such a number format - maybe someone else does. I think you're stuck with a formula here. So, let's say you have a variable called "Amount" and Amount = 12345.67-
To make this work properly and avoid annoying errors, you'll need to make the Amount variable a String type in TI.
Then in a custom variable, let's call it "ConvertedAmount" (make it Numeric TI variable type) you could have a variable like the following:
Code: Select all
ConvertedAmount = IF( SUBST( Amount, LONG( Amount ), 1 ) @= '-', -NUMBR( SUBST( Amount, 1, LONG( Amount ) - 1 ) ), NUMBR( Amount ));
Hope that helps.
Regards,
Re: SAP :X
Posted: Wed Jun 04, 2008 7:28 pm
by Eric
That is what I thought (fear).
Thanks for suggesting 2 variables in self loathing I might have overlooked that and caused more headaches for myself.
Re: SAP :X
Posted: Wed Jun 04, 2008 7:34 pm
by Mike Cowie
Eric,
There may also be some things you or someone can do to the data source to get values in a more readily consumed format, but in my experience getting someone to do work on any SAP like modify an ABAP report doesn't happen quickly. Good luck.
Regards,