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’.
/: IF &EKKO-BSTYP& EQ ‘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.