Print Images Dynamically using Smartforms!

Hello SAP world!

This thread shows you how to insert graphics to a smartfrom dynamically! Graphic object  in the form will show different images according to the application logic! This will be useful if you have to print student IDs, employee pictures or printing the logo of the company according to company code!

There are two methods to do this..

1. Print images using Conditions:

This is the best method if you only have 2 or 3 pictures. In this method you will have to create individual graphic objects for each picture.

2. Print images using dynamic graphic name:

If there are lot of images that should be printed, for example printing employee IDs where there are more than 50 employees. Here you are using only one graphic object in the smartform.
First step for either one of the methods is to upload all your pictures to SAP using transaction se78.

Go to transaction and upload your .bmp image from your local PC. Give unique name to each picture.

 

 

Method 1: Using Conditions

 

Step1: Create Smartform and driver program.

 

Transaction smartforms.

Step2: Create graphical objects.

Step3: Set the attributes of graphic object.

Step4: Define global variable.

Step5: Set the conditions in graphic object.

Create as many graphical objects following the steps above. Set different values in output conditions and set the variable “GV_NO” to value of the image you need to show in the application logic.

 

Method 2: Using dynamic graphic name

 

Step1: Create smartform and driver program.

Step2: Create graphic object: (You will only need one object).

Step3: Set the parameters of the graphic object as below.

Variable is a global variable and you have to set it inbetween “&” signs!

Toggle using the arrow button to set the parameter as a dynamic value.

 

When you set the variable GV_NO to the name of the picture (name in se78) you want to show in the smartform.

Happy printing! 😀 So much easier than SAPScript!

One thought on “Print Images Dynamically using Smartforms!

Leave a Reply

Your email address will not be published. Required fields are marked *