Hi,
In this document i'll elaborate the process of printing the watermark in the SAP Script outputs. Though, there are few posts in SCN which will help for the same but the developers usually get stuck when it comes to print the same watermark on the NEXT Pages (after the First Page)
1st, you need to upload the watermark image (BMP Format) in SAP using Txn Code SE78.
In my case, I have used below Image as watermark:
Now, Once you have uploaded the image in SAP repository, you need to modify the Script Form & use this image as watermark during the output
For instance, lets assume you need to print this watermark in case the Purchase Order is not yet released.
To achieve this we follow below Steps :
- Go to SE71 & open the Script in Change mode :
2. Enter below line of code in the very beginning of MAIN Window :
/* | START Of Change by Bharat Bajaj for Watermark | |
/: | IF &EKKO-FRGKE& EQ 'S' AND &PAGE& EQ 1 | |
/: | BITMAP 'ZMCG_NA_WMARK' OBJECT GRAPHICS ID BMAP TYPE BCOL DPI 100 | |
/: | ENDIF | |
/: | NEW-WINDOW | |
/* | END Of Change by Bharat Bajaj for Watermark |
Here, the NEW-WINDOW command is to trigger a new window along with the main window which will hold the watermark image along with the Original Content of output. The Image is stored in SAP as ZMCG_NA_WMARK. You can give it any name & use the same in the script.
This part was to add the water mark on the First page & its quite easy & straight forward.
Now, the Tricky part is to use the same watermark to be printed on subsequent pages for that Purchase order.
For this, you need to perform below additional Steps :
- Create a Copy of Main Window in the FIRST Page :
In the Page Window section of the form, Click on EDIT->Create Element -> MAIN Window. See below screenshots :
Please note that for the new Main Window ( MAIN 01 ) in the FIRST Page, you can keep the dimensions same as of (MAIN 00) or change it as per your output layout.
Now, the tricky part is, in MAIN window, where to add the code to print the watermark, as the previous code will not work in this case.
In my case, the water mark was required to be printed at the back of item header data, & thus, the code needs to be placed just in the beginning of the page element which prints the Item header (In my script form, the Element is ITEM_HEADER_F). You need to check your driver program or the script code to identify this element.
Once Identified, you need to put below Code in MAIN Window at the Page Element like below:
/E | ITEM_HEADER_F | |
/* | START Of Change by Bharat Bajaj for Watermark | |
/: | IF &EKKO-FRGKE& EQ 'S' AND &PAGE& GE 2 | |
/: | BITMAP 'ZMCG_NA_WMARK' OBJECT GRAPHICS ID BMAP TYPE BCOL DPI 100 | |
/: | NEW-WINDOW | |
/: | ENDIF | |
/* | END Of Change by Bharat Bajaj for Watermark | |
/* |
Once this is done, save the form & activate it.
Now open an unreleased PO & trigger the Print Preview and you'll see the watermark like below :
PAGE 1 :
PAGE 2 :
As you can see above, the water appears on every page of the output.
I hope this will be helpful for you.
Regards,
Bharat Bajaj