Wednesday, 23 July 2014

Printing a window in SAPSCRIPT without even calling it in driver program

Friends, lately 2-3 times I came across the situations where one window of script was coming into picture in print preview and while debugging also I could see it getting triggered. Tried putting break -point for every call of WRITE_FORM in order to find out from where exactly these windows are being called but to no avail.

On my recent encounter to this strange issue, I decided to go up to the bottom of the issue. Did a close analysis of the windows which were explicitly being called in driver program and those which were not. One thing was common among the windows, which were not being called in driver program, which was that there were no element in those windows. I google for it and Yes it was right.

So conclusion is, “We don't have to use WRITE_FORM explicitly for the windows which are having no element in it. We can go without caring for the calling of such windows. SAP standard code handles it automatically”.

Here I have developed one demo script and driver program to demonstrate it.
  1. Create a new script.
  2. Create 2 windows in it named Header and Main window.


  3. In the Header window, go inside and right something without using an element.


  4. Go inside the main window and write something under an element.


  1. Save and activate it.
  2. Create a diver program for this script and do the coding like below.


  3. Save it and activate it. Run it and choose output device as LOCL. Do the print preview

    Result:


  4. We are getting the content of Header window, while we have not used the WRITE_FORM for it.


                                                                                                                 By: Reetika Patel

No comments:

Post a Comment