1 1 1 1 1 Rating 0% (0 Votes)

If you would ask me if I would write something about SAP Script then I would definitely answer "Hell no!". I hate SAP Script to be honest, it has for me only one advantage - speed of printout if you compare it to Adobe Forms, but the rest for me..... is against.

 

Today I faces a really strange behaviour of one of the invoice printouts, one of the fields which was showing the tax percentage, was showing wrong value if the print program was called for the second time.

 

The first output was OK, 8,00 % as value.

 

 

 

But when I directly show again the preview of the same invoice then, the value was changed to 0,80 %.

 

 

Even more funny was that the debugger in both cases was showing correct value 8,00.

 

  

 

I was changing the format of the field in the SAP Script form, but without effect. I was also trying to repeat this on different installations and funny fact was that it was not working on 7.40 with SP5 but with SP16 it was ok, with the same print program and form. Nevertheless this was so strange behaviour that I wanted to solve this issue and after trying several changes in SAP Script form, I've return to the print program and I did small modifications there. 

 

I've changed the definition of displayed field to character field instead of decimal field.

 

 

 

I used CHAR8 type as this had the same length as the previous type.

 

  

 

Then I've updated the calculation of the field to the one shown bellow. The arithmetic calculation is still the same but I've used string expressions to format the value correctly. 

 

 

Now the values are always the same and although I can only imagine that the problem comes from decimal type of field, funny stuff was that inside this form there are other fields which are using decimal type and they are displayed always correctly.  

 

Probably some of you may know what's the real reason behind, but for me as I couldn't find the real problem, this is the next reason to hate SAP Scripts... 

 

Cheers

Łukasz