On the other day, I was reading through SCN and this question came up. There wasn’t any suitable answer, which can get the watermark in SAPScript. So, I decided to give a try. I have tried couple of times with different techniques like calling the subroutine which SmartForm uses for background processing from SAPScript, putting the graphics in various windows and call them from driver program, etc. But today, I got a good solution, which I thought would be useful to everybody.

How it looks with Watermark?
image

There are couples of hurdles in the way to get it working:

First is the Graphics:
Watermark Graphics should have some specific property. This kind of graphics should not have the “Reserve Height Automatically” as ON in their attributes.
image

Whenever we import any .bmp file as the graphics in the SE78, system by default sets the indicator “Reserve Height Automatically” as ON. So, when we include this graphics in our SAPScript, system will reserve predefined space on the page which will prevent the next line to print in that space.

The Graphics with the “Reserve Height Automatically” as ON generates output like this:
image
Second is how to get the watermark on each page:
To get the graphics on every page we have couple of options:
Option 1: Create a GRAPHICS window on the center of the page and include the watermark.
This option is not working because: System starts the processing of the windows in the sequence maintained on the page window of SAPScript. So, Main window will be executed before Graphics window. This will overlap the content of the main window by the Graphics (which is not our purpose).
image
Option 2: Call a Graphics inside the MAIN window.
This option seems to work with little logic to print the watermark on each page.

I have attached my SAPScript, Little driver program code and the test watermark image for your reference.

SAPScript:
You can save this block as .txt file and use report RSTXSCRP to import into your system. You need to save this SAPScript with name ZTEST_WATERMARK.

Code:
Here is the simple driver program.

Watermark Image:
I have used this image for my testing:
image

Note: I have tried this on ECC 5.0. I am not sure about other systems.

To report this post you need to login first.

14 Comments

You must be Logged on to comment or reply to a post.

  1. Pablo Casamayor
    Hi,
    for years i´ve thought this was not possible with sapscript. ¡¡You´ve made it!!. Congratulations and thank you for sharing it.

    Best regards.

    (0) 
    1. Naimesh Patel Post author
      Yes, you are absolutly right about SCN – Sharing Collaboration Network.

      Thanks for wonderful compliments.

      Regards,
      Naimesh Patel

      (0) 
  2. pat tshai
    Hi

    Thanks for sharing the solution.

    But I had a problem when I print to th printer.
    The Watermark does now show the same colour as the on on print preview.
    The printout is more ‘rough’.

    Anyonw know why?

    Thanks,

    (0) 
  3. taher kanchwala
    Hi,

    Based on the example provided by Mr Patel, I successful in delivering an object.

    Now the concern that the background of the water mark is Grey and not white even though the image is white.
    The solution to this is that when you create the image in say MS paint we have an option of save as where there is an option 256 color bitmap.
    It will warn you that the color might be lost?

    Say yes and then use this file for the water mark.
    The background remains White.

    I have tried and it worked for me.
    Regards,
    taher kanchwala

    (0) 
  4. Marcelo García
    Hi mate,

    Nice job done here with a pretty good explanation.

    I have read all posts and I have the same problem as other user mentioned. I have a window with boxes for order the text on them but the other window with the BITMAP is overlaping boxes. Is there any way to set the bitmap window behind the other one with the boxes?

    Thanks in advance

    (0) 
  5. Siva Ravindra
    its working good, when we don’t have box or text in SAPScript form.

    If we create a box its is not displayed.Because the image is coming on to the top.

    Please if u find any way to do so help me out.

    thank you.

    (0) 

Leave a Reply