0% found this document useful (0 votes)
191 views9 pages

Adding Watermarks to SAP Smartforms

This article explains how to automatically include a watermark in all Smartform outputs, including standard forms, without modifying individual forms. It describes uploading a watermark graphic, creating a Smartform with the watermark node, and enhancing the SSFCOMP_PROCESS_DOCUMENT function module to add the watermark node for each page in the internal table.

Uploaded by

Marcos Abe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
191 views9 pages

Adding Watermarks to SAP Smartforms

This article explains how to automatically include a watermark in all Smartform outputs, including standard forms, without modifying individual forms. It describes uploading a watermark graphic, creating a Smartform with the watermark node, and enhancing the SSFCOMP_PROCESS_DOCUMENT function module to add the watermark node for each page in the internal table.

Uploaded by

Marcos Abe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

How to include Watermark in all Smartform

outputs including standard forms without


changing individual forms
Ir para o final dos metadados
 Criado por Former Member, última alteração por Former Member em nov 01, 2011

Ir para o início dos metadados

Applies to:

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

Summary

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.

Purpose
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

Method

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.

Output:
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.

Common questions

Powered by AI

The main steps to upload a watermark image for Smartforms include: uploading the graphic file into SE78 as the background watermark image, ensuring that 'Reserve Height Automatically' is unchecked during upload. Then, create a Smartform solely for the watermark, containing one node to specify picture properties. This setup allows any adjustments to the image properties to be reflected across all Smartform outputs. Subsequent integration into Smartforms is achieved through enhancement of the function module SSFCOMP_PROCESS_DOCUMENT .

Using SE78 for uploading watermark images in SAP Smartforms customization offers several advantages. SE78 serves as a centralized repository for graphical elements in SAP, providing an efficient way to manage and deploy graphics like watermarks across multiple Smartforms. It ensures consistency and retrievability, simplifying the process of assigning these graphics within Smartforms during the coding phase of enhancements, thus reducing errors and making maintenance easier .

To ensure the same watermark is applied to every page of a Smartform, use the function module SSFCOMP_PROCESS_DOCUMENT to append the watermark image node in the DOCSTRUC internal table for each page. This involves looping through the table, with specific control break statements to handle multiple pages, such as using the TDPAGE name. The watermark node must be the first on each page, requiring modification of the DOCSTRUC to add the image as a primary node on 'FIRST' and subsequent records on every additional page .

Implicit enhancement points are necessary for including a watermark in Smartforms because they allow you to enhance SAP standard functions without modifying them directly. This ensures that the customization can be maintained during system upgrades and affects all forms uniformly across different systems. Implicit enhancements at the start of the function module SSFCOMP_PROCESS_DOCUMENT allow developers to insert additional functionality, like adding background images, without altering the base code, ensuring streamlined updates .

The dynamic retrieval of the Smartform function module name and main program name facilitates seamless integration for watermarks by ensuring that each page in the Smartform correctly references the proper embedded form. By using the obtained function module and main program names via SSF_FUNCTION_MODULE_NAME and FUNCTION_INCLUDE_INFO, developers can programmatically embed these details into the DOCSTRUC modification to link the Smartform call with the appropriate watermark application. This allows updates and changes without manual updates to the code, ensuring dynamic and flexible handling of watermark requirements .

Implementing a universal watermark solution in Smartforms can resolve issues such as distinguishing between print outputs from different systems sharing the same printer/output device. It helps in identifying the origin of documents when multiple environments like test and production are in use, reducing confusion and enhancing document traceability. This method also ensures that standard forms are uniformly marked without direct alterations, preserving form integrity and easing system management .

To include a watermark in all Smartform outputs without modifying individual forms on ECC6 systems, you should follow the method involving implicit enhancement points. First, upload the watermark image into SE78. Next, create a Smartform specifically for the watermark, including only one node to hold the background image. Then, enhance the function module SSFCOMP_PROCESS_DOCUMENT to integrate the watermark into every page of the Smartform by modifying the DOCSTRUC internal table, ensuring that the background image is the first node on each page. Activate these changes for the watermark to appear in all outputs including emails and faxes .

The coding modifications necessary within the enhancement of SSFCOMP_PROCESS_DOCUMENT include adding the watermark image node to the DOCSTRUC table as a record for each page. This involves specifying the graphic type nodes ("%%BGR10" for TDWINDOW and ‘G’ for TDWTYPE) and ensuring it is set as the first entry for each page following a loop. These steps are essential to ensure that the watermark appears consistently across all print and digital outputs of any Smartform, as they fundamentally modify the document structure layout dynamically during print execution .

The function module SSFCOMP_PROCESS_DOCUMENT is critical in adding a watermark to Smartforms. It is where the enhancement point is created and implemented, allowing modification of the DOCSTRUC internal table. By adding the watermark image node as a record within DOCSTRUC, the function module applies the watermark across all Smartform pages. This involves inserting the image data correctly and ensuring it's set as the first node on the page to ensure visibility on all forms, including standard ones .

The removal of the Main window in the second step of creating a Smartform specifically for the watermark prevents the Smartform node name from changing from %WI1 to other sequential names like %WI2 or %WI3. This stability in naming ensures the consistent referencing needed for embedding the watermark in all outputs. It simplifies enhancing function module calls that manage form output structures since it guarantees that the corresponding Smartform function module remains accurately linked to the correct node for applying the watermark effect .

You might also like