Skip to Content
Technical Articles
Author's profile photo Prabhjot Bhatia

Handle Different Paper Size templates into single Adobe Form

Note : I have also published the same article in SAPYard in Adobe Forms section as follow:

https://sapyard.com/adobe-forms-part-22-handle-different-paper-size-templates-into-single-adobe-form/

I have thought of sharing in this community to help our community members.

 

In this article, we would see an interesting approach of handling multiple paper size forms into single form. In different roll-outs for different countries, we have a legal requirement to use LETTER paper size for US based countries while most of the countries are using A4 paper size. To accommodate this requirement, usually we have to create 2 different templates – one for US and one for rest of the countries and maintain multiple forms. It would be really helpful if we would have only one Global Form Template and can be used for A4 as well as for LETTER.

Prerequisites:

  1. Good knowledge of Adobe Forms and ABAP is must.
  2. Must be aware of generating and testing Adobe forms through a driver program as it’s not in the scope of current article.

Steps to create single Template using Adobe Form:

  • Create Adobe form with 2 master Pages – LetterMaster and A4Master

  • Set Paper Type of LetterMaster page as ‘LETTER’
    • Go to Object Palette->Select “Master page” tab->Select ‘paper type” as Letter

  • Set paper Type of A4Master page as ‘A4’.
    • Go to Object Palette->Select “Master page” tab->Select ‘paper type” as A4

 

  • Create 2 body pages – LetterDetails and A4Details and create a text field in each body page

 

If we try to generate output with this template, we would see 2 pages. As an end result, we would need only one page to be generated – Either Letter or A4. For that, we have to declare a flag containing identifier for both paper sizes and based on that flag, we have to hide/ display the relevant pages.

  • Declare an import parameter in Form interface as IV_PAPER_TYPE with type BOOLEAN.
  • In Driver program, we have to pass the value of the above flag as :
    • When LETTER is needed, set IV_PAPER_TYPE = ‘X’
    • When A4 is needed, set IV_PAPER_TYPE = ‘-‘
  • Drag and drop the import parameter from interface to Form Context

  • On LetterDetails Page, add the following Java script in INITIALIZATION event to hide the LetterDetails page based on flag value relevant to A4:
if( $record.FLAGS_DYNAMIC_CONTENT.IV_PAPERTYPE_FLAG.value == "-" )
 {
 	this.presence = "hidden";
 }
  • On A4Details Page, add the following Java script in INITIALIZATION event to hide the A4Details page based on flag value relevant to LETTER :
if( $record.FLAGS_DYNAMIC_CONTENT.IV_PAPERTYPE_FLAG.value == "X" )
 {
 	this.presence = "hidden";
 }

Here is the main trick

We need to link the body pages with the respective Master pages so that when Form processing runs, Live cycle designer should trigger the correct page.

  • Set the pagination of LetterDetails page with LetterMaster page

  • Set the pagination of A4Details page with A4Master page

Testing :

Execute the driver program and set the Paper Size import parameter as LETTER

Execute the driver program and set the Paper Size as A4

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ashish Lodhi
      Ashish Lodhi

      Nice Blog !!!

      Author's profile photo vanshdeep singh
      vanshdeep singh

      Thanks for sharing, it was very informative and helpful!

      Author's profile photo Marta Varino
      Marta Varino

      Hi all,

      I did this example in my SAP system but doesn't work fine.

      When I try without IF condition, it work's fine, I can hide one page, for example.

      But when I add the IF condition for the flag, doesn't work.

      Could you please help me?

      Thanks in advance

      Author's profile photo Marta Varino
      Marta Varino

      Solved.

       

      The problem is getting the value of the flag:

      Instead of

      $record.FLAGS_DYNAMIC_CONTENT.IV_PAPERTYPE_FLAG.value

      I did

      var lv_letter = xfa.resolveNode("$record.FLAGS_DYNAMIC_CONTENT.IV_PAPERTYPE_FLAG").value;