Intelligent Pagination Concept in SAP Jet Forms
This blog presents the concept of intelligent pagination which is used for restricting or controlling the jet form layout based on some criteria.
Jet forms are used to produce electronic templates that can be issued via emails or printed using several printers. The output can be in any form like .PDF, .HTML etc.
Jet forms only produce the layout (the data in that has to be populated by ABAP print program like scripts). The job of combining the template and data is done by Print Agent which is the component of Jet form central server.
Software: Jet forms are developed using a third party software provided by Adobe. The software is Adobe Output Designer.
Using Output Designer, each electronic template that you create consists of two pieces:
- The modifiable layout called the template design (.IFD) file.
- The compiled output template (.MDF) file.
Print Agent: Print Agent, the output component of Adobe Central Output Server (Central), uses intelligent merge technology to enable applications to output data, merged with electronic templates.
Types of Templates: Using output designer, you can develop two types of templates. They are,
- Static Template
- Dynamic Template
Example of a template (.IFD file):
By static template we mean a template that presents the same text, graphics, and field areas to all recipients all the time. Only the user specific data presented in the field areas differs from one recipient to another. The template does not flex to different amounts of data, nor does it eliminate any elements that are irrelevant to an individual user.
A dynamic template presents text, graphics, and field areas that flex according to the needs of the recipient. In contrast to a static template, a dynamic template presents only those elements and sections of the template that are relevant to the data requested.
“A dynamic template is moreover combination of several sub forms”.
Most commonly, you use dynamic templates when you need to present repeating data that varies in size according to the recipient. Using the example of a purchase order, a dynamic template would show only the number of detail lines pertinent to that order.
The business requirement will dictate whether a template is static or dynamic. When you wish to present the same data to each user, and when the data does not repeat, then a static template is an appropriate choice. Otherwise, a dynamic template provides greater flexibility for presenting data.
Subforms: A subform is an individual section in a template which consists of a group of objects that are relevant to each other.
For example, consider the below template. Here all the item details are grouped together into a subform.
JFPreamble and JFPreamble_1:
The first time you compile a dynamic template, Output Designer creates two custom properties for the template called JFPREAMBLE and JFPREAMBLE_1. These two custom properties, known as DOCVARs (document variables), contain the processing rules for the template. It is JFPREAMBLE that the output Agents look for when the time comes to merge data with template.
The output designer gives the flexibility for creating events in the template and making the events active at appropriate time.
Such events can include appropriate page breaking by calculating whether there is adequate space to lay down a subform on the current page or whether to place it at the top of the next page or if there is a need of restricting the pages based on some criteria.
For example, suppose I have 5 pages in my template, but as per the requirement, I have to skip page 1 and print from page 2 to 5 for particular country. This type of requirement can be fulfilled using the Intelligent Pagination concept.
Intelligent Pagination uses several commands to trigger the events and take appropriate action.
We will get a clear picture on Intelligent Pagination concept by understanding the following requirement.
Requirement: Adding a new page after page 1 in already existing layout form and calling the new page instead of page 1 only for specific country.
Changes to be made in 2 areas:
1) Layout/Template level
2) ABAP Print Program
Template level change:
Template prior to change: Before making the changes, the form template (IFD file) had 3 pages.
Now adding a new page after page 1.
New page inserted as page 2. In this page, copied the page 1 components. We can copy the components from one page to another by CTRL+A and CTRL+C.
Now, there comes the main task, what command need to be used and where it needs to be written.
JFPreamble, is the document variable where we can make our custom changes.
Point to be noticed: While copying the components from page 1 to new page (page2), the names assigned to components in page 2 will be same as in page 1. Hence there will not be any differentiation between page 1 and 2.
As we need to trigger page 2, the idea was basically to change the field name in page 2(new page) and then use intelligent pagination command !FldUsed on the changed field.
groupname!FldUsed (FieldUsed): This event is triggered whenever the field name mentioned is available with some data.
Hence, we change the name of a global field InvoiceNumber to InvoiceNumber2 in our new page. In page 1, it remains same InvoiceNumber.
Then the box is grouped with group name GInvoice2 as shown below.
Grouping is required because the group dictionary stores all these events.
The basic Syntax:
^define group:<groupname>!<event> \action
Then, the event !FLDUSED is added in the JFPreamble, as shown below.
The flow of the above 2 highlighted lines goes like,
- ^define group:InvoiceNumber2!FldUsed \groupGInvoice2\fieldInvoiceNumber2.
Here, the print agents triggers this event whenever the field mentioned (InvoiceNumber2) has data in it. Once it is triggered, it goes to action that is groupGInvoice2.
- ^define group:GInvoice2 \page2.
When the control comes to group GInvoice2, it triggers this event and performs the action \page2, which means goes to page2.
Now here, the changes at template level are done. After making the changes the .IFD file is compiled and .MDF file is generated, which need to be uploaded in the client’s UNIX server.
ABAP Print program changes:
SAP scripts are generally used to produce data stream for jet form layouts. Hence we made changes in the script for restricting the page.
JOB command: This is the first command executed in the script with which the Print Agent is evoked. Hence we made a change for controlling the pages in JOB command as shown below.
“We use certain print agents commands in script level in order to control the printing. The events which we used in template level cannot be used here”.
The below changes are made in JOB command.
If country = specific country.
^JOB &FORM-JOB&_EMAIL -z&template_name &_EMAIL -c001 –aip02 –aspPDF
*Pass the data for InvoiceNumber2.
^JOB &FORM-JOB&_EMAIL -z&template_name &_EMAIL -c001 –aspPDF
*Pass the data for InvoiceNumber.
Few Print Agent Commands:
–aipn -> used for starting the print from a specific page. Hence we specified here –aip02, which starts the print from page 02.
-c -> it specifies the number of copies to be printed/emailed.
-asp -> Specifies the type of output to be produced, in this case it is PDF.
There might be a confusion, that why do we need to change again in script level when the changes are made in template level.
It is because, in jet form template the first page is the default page and it will be automatically printed. Hence while start of the print agent itself, we need to make sure that we start the printing with page 2.
After making all these changes, observed the output with the new page and the page 1 was not displayed.
There are lot many other Intelligent Pagination commands, I will be posting soon in my next blog with suitable examples. Thank you for reading.
Thanks for Posting .....Keep Posting.