We have a requirement to have two copies.

1.Bank Copy.

2.Client Copy.

The Bank copy has two pages and has pagination as 1 of 2 and 2 of 2.

Now our Client copy should also have the same pagination similar to the Bank copy.

i.e. Client Copy 1 of 2 and 2 of 2.

These both Bank and Client Copies should come as a conitous PDF and NOT as seperate PDF’s.

Inorder to achieve this functionality.

1.We need to code in teh print program.

2.Write Formcalc for Pagination and Formcalc to display the BANK and CLIENT copies.

We follow the following steps:

In print program:

1.We call the Dyanmic FM generated through activating of the Adobe form through SFP txn TWICE.

2.We write form calc/JavaScript for both Bank Copy and Client Copy in the Adobe forms.For the initial Call we hide the Client Copy.

   Let us assume that if ‘CL’ is passed to FM then the Client copy is visible and if CL is not passed the Client copy is hid.

   This lv_copy should be a mandatory field.

First Call to FM:

While calling the FM first time we need to keep in mind that the variable lv_page is commented or removed.This parameter/variable is assigned as

optional in the Interface of the Adobe forms.

                CALL FUNCTION ‘ /XXXXX/YY00001317’

                EXPORTING
                  /1bcdwb/docparams  = ls_fp_docparams

               * lv_page                     =

                 lv_copy                     = ‘ ‘
                   IMPORTING
                  /1bcdwb/formoutput = ls_fp_formoutput
                EXCEPTIONS
                  usage_error        = 1
                  system_error       = 2
                  internal_error     = 3
                  OTHERS             = 4.

Now in structure ls_fp_formoutput we have the field  ls_fp_formoutput-pages.

This field has the total number of the pages generated with out Client copy.i.e.It gives only total no.of pages for Bank copy.

Collect this field value in a local variable lv_page = ls_fp_formoutput-pages.

Pass this lv_page to the Fm in the Second call to the FM.

Second Call to FM:

In the second call to FM we need to Pass the lv_page value and the CL value to obtain both client and bank copy.

CALL FUNCTION ‘ /XXXXX/YY00001317’ 

                EXPORTING
                  /1bcdwb/docparams  = ls_fp_docparams

                 lv_page                     = lv_page (Obtained from first call to FM)

                 lv_copy                     = ‘CL ‘
                   IMPORTING
                  /1bcdwb/formoutput = ls_fp_formoutput
                EXCEPTIONS
                  usage_error        1
                  system_error      2
                  internal_error      3
                  OTHERS           4.

IN Adobe forms:

The script can be written in both formcalc and Javascript.But here we follow formcalc.

We need to write the formcalc to display the respective forms.

if($.parent.lv_copy == ‘CL’)then

$.presence = ‘visible’

else

$.presence = ‘hidden’

endif

Here depending on the  child hirearchy $.parent is written.The formcalc is written over the Client Copy Subform.

When Ever the client copy is asked to display then only this is displayed.

In order to reset the Page number for the client copy.

1.We need to use different master pages for both client copy and bank copy.

2.In this scenerio we have two master pages P1 and P2 for both Bank and Client Copies respectively.

3.The pagination for P1 drag the pagination of format x of y from the std.library.

X –>   this.rawValue = xfa.layout.page(this);

Y –>  This value is made a floating field and binded with the variable lv_page.

4.For pagination P2 similary drag the pagination format x of y from the std.library.

X –> this.rawValue = xfa.layout.page(this) – this.parent.LV_PAGE.rawValue;(Here LV_PAGE is accessed from the parent child hirearchy)

Y–>  This value is made a floating field and binded with the variable lv_page.

With this the pagination is applied for both client and bank copies.

When we execute the form with both client and bank copies then the pagination is obtained similar for both bank and client copies.

This is completely a dynamic solution to achieve the pagination.

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. Valerie Lee

    Hello Varun,

    This may be the solution to my question that I just posted.  I have similar requirement to print customer address page in landscape, remittance copy in portrait with page number like page 1 of 2 and page 2 of 2 and then customer copy with page number like page 1 of 2, page 2 of 2.  Your approach is to call the FM in the print program.  So in my case, should I call 3 times?  First call is to get the address page, second call to get remittance page start from Page 1 and third call to get the customer copy page?  You mention the script but which event do I need to put in?  Is it in the initialize event.  Here is my requirements that I just posted.

    Form layout and reset page number | SCN

    Thanks.

    (0) 

Leave a Reply