Page 1 of 1

Loading SAP Negative values via TI

Posted: Tue Aug 23, 2011 4:28 am
by digger1914
We are just moving to a SAP payroll system, and it produces negative values with the sign at the end, ie 2.365- instead of -2.365.

Does anyone have any brilliant idead for loading this via TI? I currently get a warning telling me that it cannot the value to a real number.

Thanks

Re: Loading SAP Negative values via TI

Posted: Tue Aug 23, 2011 4:43 am
by Alan Kirk
digger1914 wrote:We are just moving to a SAP payroll system, and it produces negative values with the sign at the end, ie 2.365- instead of -2.365.

Does anyone have any brilliant idead for loading this via TI? I currently get a warning telling me that it cannot the value to a real number.
Best option is to get the SAP DBA / Guru to fix the export format. Failing that there's always something like this. (The real variable is of course defined as String on the variables tab):

Code: Select all

# Let's pretend that...
s_StringVariable = '3.25-';

# Check whether the last character is a - sign...
If ( Subst ( s_StringVariable, Long ( s_StringVariable), 1 ) @= '-');
    dbl_Multiplier = -1;
    s_StringVariable = Subst ( s_StringVariable, 1, Long ( s_StringVariable) -1 );
Else; 
    dbl_Multiplier = 1;
EndIf;

dbl_NumericVariable = StringToNumber ( s_StringVariable ) * dbl_Multiplier;

Re: Loading SAP Negative values via TI

Posted: Tue Aug 23, 2011 4:52 am
by digger1914
Thanks Alan for the prompt reply,

I had exactly the same thought a minute after posting. I went with


## Look for negative value entitlements with trailing sign

IF(SUBST(LSL_Hours_Ent,LONG(LSL_Hours_Ent),1) @= '-');
LSL_Hours_Ent_Calc = '-'|SUBST(LSL_Hours_Ent,1,LONG(LSL_Hours_Ent)-1);
LSL_Hours_Ent_Load = StringToNumber(LSL_Hours_Ent_Calc);
ELSE;
LSL_Hours_Ent_Load = StringToNumber(LSL_Hours_Ent);
ENDIF;