Page tree
Skip to end of metadata
Go to start of metadata

Applies to:

ECC6 and above. You need implicit enhancement points option to implement this.


This article explains how to include watermark symbol automatically in all Smartforms without touching the individual forms. This is especially needed in the places where we have to differentiate between different print outs, printed from different systems. This will be reflected in the print outs/emails/fax outputs, even if standard forms are used.

Author(s):    Gokul Radhakrishnan Nair

Company:    IBM

Created on:  15 August 2011

Author Bio

Gokul is a SAP ABAP consultant with around 10 years of SAP technical experience and experience in IS-OIL / IS-Retail business along with SD,MM, FI-CO, CRM modules.


This change is really necessary in the places where the same printer/output device shared among different systems (e.g.: Test/Production or different test systems). This will help you to add a watermark symbol in all Smartform (including SAP standard forms) printouts/ emails /faxes which will help to differentiate these output origins.

This is applicable only for

  • Smartforms . Sapscript/ADOBE forms should be handled separately.
  • Releases ECC6 and above since implicit enhancement points are used here


Step1 Upload the watermark:

Upload the Graphic file into SE78 which will be used as the background watermark image. In this example, the following image is taken as example.
And this image is uploaded in SE78. Please make sure the checkbox “Reserve Height Automatically” is not checked while uploading it.


Step 2 Smartform creation:

Create a smartform which will have only one node. This is needed to hold the background picture which will be displayed as the watermark and the picture properties. Any modifications/changes to the image properties will be done in this smartform and will be reflected in all smartform outputs.

If you want to display different watermarks per system or form, you need to create that many Smartforms. This is needed for easy handling purpose as we have all the output attributes available here and can be modified directly here.

As mentioned earlier, only one page node is needed here and the MAIN window is also not needed here. Enter the object details/ output mode/resolution and position.
 Activate the smartform and do a test run, just to make sure whether the watermark can be seen in print preview.

 The space found above the test watermark helps us to make sure that the placement of the watermark is correct.

 Step 3 Enhance function module SSFCOMP_PROCESS_DOCUMENT:

This is the important step in the whole procedure.


Open the function module in SE37 and click on the Enhance Source Code button to make it ready for enhancement point creation.
Click on the Edit menu, go to Enhancement Operations-> Select “Show Implicit Enhancement Options”. Now the implicit enhancement option at the start of the function module is shown.
Right click on the implicit enhancement line, go to Enhancement implementation and create an implementation for this. Choose ‘Type of Enhancement’ as ‘Code’ in the next popup as we will be using this for our coding purpose.

Enter a name for the implementation and text, create the implementation. Activate it.
Double click on the implementation. Go to change mode. Use the ABAP source code button to add our functionality in it.

Step 4 Coding part:

In this enhancement, at this stage (function module SSFCOMP_PROCESS_DOCUMENT), internal table DOCSTRUC holds all the page details & the corresponding technical details. This is exactly the step where we are going to add the background image (watermark) as one of the records. Please see below the run time sample records of DOCSTRUC. In the example, only the first page is handled. In the same way, please make sure the same thing is done for all available pages by using LOOP…at DOCSTRUC and using control break statements by checking the TDPAGE name.
Sample coding is given below. In this, we are populating the work area l_datastruc which has the same structure as DOCSTRUC and appending it at the right place for every page. Important point to be noted here is, the background image node which needs to be added should always be added as the first node for that page. In the above example, this record should be added as the first record for page ‘FIRST’ and should be added as the 11th record  (9 + 1 record added for first page) for ‘NEXT” page.
Pass “%%BGR10” for TDWINDOW and ‘G’ for TDWTYPE to indicate that these are background graphic type nodes. Other parameters can be copied from the current DOCSTRUC record.
We need to fill up two more important parameters CALLPROG and CALLFORM. We are going to call the smartform created in the second step through these two parameters and will display the  background watermark image. For that purpose, retrieve the generated smartform function module name using SSF_FUNCTION_MODULE_NAME by passing the smartform created in the second step. Retrieve the main program name of this function module name by using function module FUNCTION_INCLUDE_INFO. This will return the main program name in parameter PNAME if you pass the generated function module name in CHANGING parameter FUNCNAME. Pass this main program name into CALLPROG parameter.

Based on your requirement, add the restrictions here, so that you use different smartform per system/ form. This restriction is completely dependent on your requirement. You can add system wise checks also, something like SY-SYSID check or SY-UNAME check based on the requirements.

Last parameter which should be passed is CALLFORM. Since we have only one node, the name will always be “%WI1”. Please make sure you delete the Main window (in second step) as mentioned earlier to make sure that name of this form does not change to %WI2 or %WI3.

Activate the Enhancement.


This is the output from one of the smartforms before activating the above enhancement.
After activating the enhancement, the output has changed like this with a watermark on it.

 Please note that this is applicable for all smartforms including any standard forms. And the same output is applicable in E-mail and Fax output as well.