“Share your knowledge. It’s a way to achieve immortality” – Dalai Lama
Based on above fact, I would like to share my experience here hoping that it could help some experts someday.
It was a fine morning until i receive this call saying “hey, We need to make our Adobe form to generate 4 copies each time when the output is triggered”. Copies should be in order as below,
- Original Copy
- Customer Copy
- Vendor Copy
- Management Copy
I just learnt about Adobe forms and i started to search for solutions online. I couldn’t manage to find clear examples. I decided to try by self which led me to write this blog to make life easier.
First, let me give an overview on my form layout.
We need to add an extra text field on top to the right of logo at the center of page which should display name of the copy.
An easy way would go like this,
- Start spool Job via “FP_JOB_OPEN”.
- Loop N times.
- Call Adobe FM within this loop with text name as a separate parameter.
- Stop spool job via “FP_JOB_CLOSE”
But doing so will bring document navigator at top which means it will create as separate document which my functional is not happy with.
Solutions form my thoughts:
- My form has single page. I can copy the same page into 4 pages with copy names at top. But, I can’t find any copy option. So this approach means i should develop same layout again and again for 3 more times.
- To use the current form page as a template.
To me the second approach felt easy and i went with that approach.
Steps I did for second solution.
Overall Idea: Each Adobe form will have a body page on hierarchy tab. My idea is to make this body page as table and encapsulate each subform within the body page in a subform which acts like row for my table(body page). My current layout is as below,
Interface Changes: First, We have different internal table as import parameters as below,
I have defined a custom deep structure which includes all these above internal table within itself. In Code initialization part,i have appended all values as required. example as below,
Now we have our internal table IT_INVOICE with all data. Lets concentrate on form layout changes.
Form Layout Changes: First change would be include the copy name text (IT_INVOICE-TEXT) at top of layout. To do this, Insert->Standard->Text Field and bind it to IT_INVOICE-TEXT as below.
From above Layout image, My page area name is “Main_area”. select all layout elements in body page of form and wrap them inside a subform named “Body_row”. (Select all->Right Click->Wrap in subform). Change below settings,
In Page subform(in my case “Main_area”): Palettes->object->Binding-> (Bind IT_INVOICE to this subfom and check “Repeat subform for each item” checkbox and give maximum as 1.
Also change: Palettes->object->Accessibility->Role as “Table”.
In body_row subform: palettes->object->Binding->(Bind data[*] of internal table IT_INVOICE in this subform. Do check “Repeat subform for each item” checkbox and set Min Count as 1.
Also change Palettes->object->Accessibility->Role as “Body row”.
We are almost done. Try to test at this point, Form will generate 4 copies sequentially without page break at each new copy( if 1st copy ends at middle of page 3, second copy will follow immediately instead of breaking to next page).
To achieve page break for each new copy, We can add conditional page break as below,
By this, we come to the end of development. Enjoy !!
Important Note: Each element in layout within body_row subform should be binded to respective element from within IT_INVOICE->DATA->[respective internal table]. If this is not done, values with only appear in first copy of Adobe form rest will follow empty.
PS: I welcome comments of all kinds. I’m new to adobe forms. I’m not aware of any easier approach to achieve the same. If there is any easy approach to achieve the same, do let me know in comments. I do apologize for my bad language.