We can help. Together we learn....

Some tips

by Voice | Monday, October 27, 2008 in , |

Here are some tips which may save some time for you. And it is always fun experimenting with the things you know.

 Problem: Suppose you are dividing two numbers (in real project scenario it is used while converting amount from one currency to another currency) and there is a requirement to round off the result.

Easy solution: Suppose you need to round it off to 1 decimal position, just use a variable having data element having one decimal position while storing the result. It will be rounded off automatically.


Problem: When you try to assign value from character to amount variable or quantity variable, it gives short dump.

Easy solution: Before assigning value, just assign any number to the required amount variable or quantity variable. Then use the assign the character value to amount variable. It will take the value.

Keep it in mind that value in the character field should be in the same format as the variable.


Problem: In Sap script, sometime it is required to print values only in the last page or first page. For this we use variables like “SAPSCRIPT-FORMPAGES” or “NEXT-PAGE”. It works fine but yet people find that their script is not printing properly.

For this I don’t have any easy solution. You can only use some text element which is either called in the beginning or in the end. But I will tell you the reason why it does not work. This problem arises when you try to use these variables in MAIN window and sadly in main window these variables do not work. So even you check your form and it seems logically foolproof, you will not get desired result. It is pain taking to debug a SAP Script so we do not even check it in debug mode and keep banging our heads. This tip can be useful for them. :)

I can give you another tip like, if you want to print any line or box something like that in the end page only and that has to be a part of main window, then I will suggest, use a pseudo window, over lapping the main window. You can use the variable in that window and can use to print something like box or line at the page you desire.

Anyways if such requirement is needed, then do let me know in the comment section; will try my best to give you some alternative logic to do so.


Problem: In Sap script, when we do amount calculation in sub routine pool program (a z program which is called from the Sap script to do data manipulation), even we use ‘(<)’ operator to shift the negative sign to the left of the amount, it does not work.

Solution: This is again one problem which makes developers bang their heads. The problem occurs because the variable which returns the value from the Z program is type “char”.  So command like ‘(<)’ does not work. For this you have to whether the value is negative or not in the sub routine pool itself and then if it negative, then you have to remove negative sign from the right and have to concatenate minus sign in left of the value.


There are many tips like this which look small but are very effective. May be sometime later… and if you want to share something, please do in the comment section.



  1. Bhavya Kumar on September 25, 2016 at 2:31 PM

    Great place to learn about the new things and got great knowledgeSAP MM Training in Chennai