Skip to Content
Author's profile photo Former Member

SAP Script Error Handling Essentials

SAP SCRIPT ERROR HANDLING :    For Error Handling in SAP Script follow given check points which will help to eliminate commonly occuring SAP Script problems :
1. Ensure that SAPScript is active.
2. Make sure that calling report of SAPScript is calling all the elements and windows in desired sequence.
3. For formatting related issues check the paragraph formats and character formats.
4. Maintain tabs in the paragraph format to align the fields in SAPScript.
5. Maintain page navigation in the SAPScript i.e. the sequence of the pages in SAPScript.
6. If any code is to be used in SAPScript editor use all character string comparison operators.   
 e.g. Instead of using             
 /: IF &EKKO-BSTYP& = ‘F’.         
7. As far as possible pass character fields to SAPScript to ensure proper formatting.
8. In case if  tab space does not  work use SPACE(n)  command    e.g. SPACE(10).
9. Do not change any standard SAPScript instead create a copy of the SAPScript and change that copy. Make sure that this new version is attached with the Tcode instead of old version.
10. Maintain all the requests for that sap script in order to revert the older version.
11. While doing any changes in SAPScript document old values before you change them. It helps while reverting the SAPScript to original version.
12. For navigation related issues use NEXT-PAGE command. Ensure that this command is executed every time or based on the condition that you have given for new page.
13. Align the page elements properly to get desired output.
14. If page type is changed or new page type is used for SAPScript make sure that page type is maintained in the SPAD settings for the respective printer. 
SAP SCRIPT DEBUGGING :   In order to debug any SAPScript you must know the calling report or calling Transaction of the respective SAPScript. To debug the SAPScript follow given steps.
1. Go to SE71 and enter the SAP Script name.
2. Activate Debugger     
Utilities > Activate Debugger 
3. Execute the Tcode (which calls the required SAPScript) Do the processing of the TCODE (i.e. give all the required data).You will get a POP-UP for SAPScript Debugging when SAPScript is called by the TCODE.
4. Click on OK to debug SAPScript.
5. Once you clock OK you will get SAPScript Debugging window.
6. Press F5 to execute each step in SAPScript. The debug will proceed as per the calling report. Whenever any window element  is called through WRITE_FORM the debug window will navigate to that  window element. The current window, element and page will be displayed on the topmost portion of the debug window.
7. With the window details you can easily do the required modification.
8. Unlike Report Debugging in SAPScript Debugging you can not change the field values. If you want to change the field values you need to debug calling report and change the values there. 

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo B. Meijs
      B. Meijs
      A valuable list of typical sap script issues.
      Some additions:
      - when handling addresses, use the standard SAP address logic.
      - use the SET COUNTRY statement in your printprogram to force country specific settings for decimal notation and date format. Make sure you use the correct country code.
      - make sure the language code that is used for the sapscript form and the used texts is the correct one. 

      There is one idea I have that differs from your list: I don't like your proposal to copy standard SAP forms (and the related print programs). In my experience, it is better to create a new sapscript form and print program (or a SMARTFORM or interactive form), using logic from standard SAP. This way, your form and print program will be much smaller. Contrary to popular believe, initial development of the form and print program will hardly take any longer and maintaining the program and form will be much easier.
      Ben Meijs