Lessons Learned from Adobe Forms Development
Introduction
I have been working on a few projects where I have used the new Adobe Forms tool from within the ABAP side of the WebAS 640 (Transaction SFP). These projects use the Adobe tool to create printed forms not interactive ones. Basically I have a BSP application that I need to produce a nicely formatted printed version for. Although my first form took about a day to design because I was still learning the tool; my latest one only took about 45 minutes total (that includes writing the print program, the form interface, context mapping and of course the form design). I would like to share these experiences, specifically focusing on the techniques that once learned made it possible to go from 1 day to 45 minutes of build time.
We will start by looking at the BSP application that I am trying to represent in the Adobe Forms Tool.
As you can see from the screen shots, I have scrollable areas and tab strips in my application. These are great UI components for the interactive experience, but don’t make for very good print outs from the browser. This was the reason that drove me to offer a print option via one of SAP’s forms technologies.
Long Text Area
The first place where I thought I was going to have a problem was with my Long Text Description. Back in R/3 this is Document Information Record Long text stored like most long – in multiple records with fixed length (132 characters in this case). For my BSP application I had already concatenated all these text lines into single string for passing to the textView element. I originally thought that I would have to go back to the separate record format. This is what I have done in the past with SapScript. As it turns out I can just pass the entire string through to the Adobe Form. It will pick the Carriage Return/Line Feeds that I inserted into the string for proper display in the BSP page. All I had to do is set the following parameters on the field in the designer.
Tables
It is fairly common to have tabular data within SAP form output. Although I really like the Adobe forms designer tool, the creation of tables is one area where I though the process was cumbersome. I nice table designer like we have in SmartForms would be appreciated. Once I had done a few tables however I found that the process wasn’t too bad. There certainly are more and better visual formatting options for tables within the Adobe tool.
I had sent my internal table through the Form interface and added it via drag and drop to the Context. I could see the table, and its components in the data view of the forms designer.
You start the table creation process by dragging a subform object from the Library palette/Standard tab. This first subform represents your entire table, so place it where you want your table to be. Also resize it large enough to easily insert additional elements inside the subform area.
Next you need to insert two more subforms. One will become your header and one will become your table body.
Now you can insert the individual fields that will make up your Table header and body elements. You can insert static text, text fields or any of the other standard form elements. Drag and drop the fields from your internal table represented in the Data View to bind to the data from your context. The size that you make the individual elements doesn’t really mater at this point nor does your exact alignment. You can see that they are quite a mess in my designer at this point. They will be resized in a few steps. Notice that you have to type static headers. I never found an easy way to bring in field titles. You can see from my screen shot earlier that the language dependent field descriptions map through the interface and into the content. You can see them in the data view under Descriptive info. It sure would be nice if these automatically mapped to the table headers or to text fields that are bound to context items.
Finally we are ready to turn this mess into a table. We return to our highest level subitem that represents the table itself. We need to go to the Object palette, Subform tab. The default Subform type is Position Content. We need to change this to Flow Content. Now a new option opens up that allows us to choose the Flow Direction. For this element we choose table. Now we reach the point where we will define our column sizes. A new field has appeared where we must list all the column widths separated by commas. We had two columns that we will make 4 inches each.
The process is now repeated for the subform that represents our table header and our table row.
The layout in the designer now looks much nicer.
What we have so far will give us a nice looking table with exactly one row. We must go into the subform that represents our table row and in the Object Palette/Binding tab make the proper setting so that the row will repeat for each item in the internal table that is bound from the context. To do this we set the Repeat Subform for Each Data Item option. If you want to get fancy you can even set an overflow leader so that the table header is repeated if the table must span more than one page.
There are two types of Graphic Nodes within Adobe Forms Context – Graphical Context and Graphical Reference. With Graphical Reference, you only have to supply a URL where the image content can be read from. I had originally started to use this option and just pass the URL to the icons. However there appears to be a bug in my WebAS 640 SP12 system that produces a short dump for this type of graphic node if it is placed in a table node (Updated 7/18/2005: This problem is now fixed via OSS note 862915). This left me with only the Graphic Context Option. I therefore just supply the fields of my table that contain the content and the mime type. Also note that there is a bug in SFP in 640 SP12 that causes the Graphic Context not to syntax check if the mime type is supplied via a content attribute instead of static string. This problem is also solved via OSS note 862431.
The graphic node now appears within your data view in the forms design and can be dragged onto the form and placed within a table row subform. I did find one problem however. When it drug this node element over to my form, it didn’t generate a image field. By default it created a text field. I had to manually change it to an image field.
!https://weblogs.sdn.sap.com/weblogs/images/1918/AdobeGraphicDataView.jpg|height=247|alt=image|width=287|src=https://weblogs.sdn.sap.com/weblogs/images/1918/AdobeGraphicDataView.jpg|border=0! !https://weblogs.sdn.sap.com/weblogs/images/1918/AdobeGraphicImageField.jpg|height=178|alt=image|width=263|src=https://weblogs.sdn.sap.com/weblogs/images/1918/AdobeGraphicImageField.jpg|border=0!
Form Paging
When I first printed my form everything looked good, until I found an example that should have wrapped around to a second page. Instead the content ran right off the first page and that was all I got. The Form Designer really seems to default to fixed position content. With lots of variable length table output, that just doesn’t work well. I found that I needed to change some settings ont eh Main SubForm that all of my content lived within. This subform needed to be changed from Position Content to Flow Content. Since I just wanted my content to flow out like a continuous report I only have one Master Page with a single content area. However with the use of multiple Master Pages and Content Areas within them, you could have static content (such as a header area) that repeats on each page mixed with variable content (like the table items). The following were the settings that I came up with that best fit my needs on the Main SubForm.
Form Output
In the end I was quite happy with the results of integrated my Adobe Document in with my BSP application. Because the resulting document is printed from the Server, I just created a small printer dialog much like the one in the SAPGui for producing the form output.
Also because I had used the Adobe tool, the default format is PDF. Therefore I don’t have to do any conversion if I want to offer the content as a downloadable PDF file as well. There is a flag in the output parameters structure of the open Job function module (FP_JOB_OPEN) called getpdf. If you mark this flag, the binary content of the document will be returned to your application in the formoutput return structure. This single binary string is all ready your document in the PDF format. No further manipulation is necessary.
In case anyone is interested this is what the finished document ended up looking like in PDF, I have included some screen shots. I have marked over the top of some sensitive information. I should also note that capturing the form as an image and shrinking it did lose some of the detail of the lines and shadows around the tables and table headers.













Between TechED (can you believe it is just 2 months away), ASUG, an Enterprise Portal Implementation, ERP2004 Upgrade, Unicode Conversion, normal development, and a few other things I can't even discuss yet; things have been rather hectic.
nice one 🙂 But can you show us the example pdf? After reading the complete weblog it would be nice to see how the final result looks like.
regards,
Thomas
thank you for this excellent Weblog. I remember we talked about this project at the ASUG conference, but this description clearly exceeded my expectations. This is a great guideline for everyone developing PDF output with Web AS 6.40.
Also I have good news for you. For our next release we are working on a much improved support of tables. I have seen the first version just recently and it is really slick and very developer friendly. We will show this for the first time to the outside world at TechEd.
Again I am excited to see our technology being used by customers to improve business processes.
Cheers!
Matthias
Sr. Product Manager
Adobe Systems
I am trying to use the getpdf option in "fp_docparams".
My requirement is to get the file in my abap code and save the pdf file in a file folder.
I do not see any parameters by which I can get this file either in FP_OPEN_FORM nor in the generated function module.
Can anyone help?
Thanks.
I see an import parameter called "FORMOUTPUT".
It has 3 parameters: pdf, pdl, pages.
I am sure "pdf" has te data I need. I need to figure out the way to download.
Thanks.
The question really comes to how and where to do you want to download this. In my example I am using a BSP page. The binary string is the perfect format for placing into the response object.
However you sound like you might want to download to the person's PC. Is this using the SAPGui?
If so you first need to turn this binary string into an internal table. You will use CL_GUI_FRONTEND_SERVICES to download the content, but unfortunetely that won't accept the binary string. I like to use the function modules from group SCMS_CONV. They are great for convertion to and from binary string/string and internal tables.
I have built an adobe form and interface, the code to collect data and pass it to the form. All these are tested in R/3 and work great. But I have hard time calling the form from BSP application. Your form is displayed in a BSP page. Could you show me some sample code you used in BSP page?
Thanks,
Li
That part is actually rather trivial. The only thing specific to the adobe forms development is know how to extract the PDF document as a binary string.
That can be done rather easily by the generated function module for your form.
First of all when you call the function module FP_JOB_OPEN you can specify several parameters. Use the following parameter to tell the system that you are going to later want a binary string with the PDF output in it:
ie_outputparams-getpdf = 'X'.
call function 'FP_JOB_OPEN'
changing
ie_outputparams = ie_outputparams.
Now when you call your generated function module you will get the formoutput:
call function i_funcname
exporting
/1bcdwb/docparams = fp_docparams
sflight = isflight
importing
/1bcdwb/formoutput = fp_formoutput
exceptions
usage_error = 1
system_error = 2
internal_error = 3.
There is field PDF (fp_formoutput-pdf in this example) that is a binary string. It has your document in PDF format all ready to go.
Now as far as adding it to your BSP application - that has been documented in several other weblogs (look at the listing of BSP weblogs - Brian McKellar has a particularly good one on the subject of handle of non-html documents that was published very early in SDN's lifetime). At this point it is just a binary content that can be downloaded similar to XML, or an Excel File. I prefer the Cached Response Method, but have a look around and you will have several approaches.
Now I have one more question. A new request comes up for the application. Supervisors would like to have ability to save all appraisals in his/her group into one PDF document. I have tried different ways, but without any luck. I am guessing the trick is to somehow combine all fp_formoutput-pdf strings together and pass to http response object. I did simple concatenation but it only shows the last appraisal document. Any ideas or suggestions you might have?
Thanks again,
Li
In the past I have taken a different approach this problem. I produce individual PDF documents (binary strings) and then put them together in one ZIP file (using CL_ABAP_ZIP). This way the user only has to download one file, but the individual PDFs are all contained inside the zip file.
Thanks Thomas:-)
Li
It is possible in WAS 640 to do a table with subtotals using Adobe Designer 6.0?
Something as:
Key1 Key2 Key3 Value
Key1 Key2 Key3 Value
Total Key3 Value
Key1 Key2 Key4 Value
Total Key4 Value
Total Key2 Value
Total Key1 Value
Regards.
It is possible in WAS 640 to do a table with subtotals using Adobe Designer 6.0?
Something as:
Key1 Key2 Key3 Value
Key1 Key2 Key3 Value
Total Key3 Value
Key1 Key2 Key4 Value
Total Key4 Value
Total Key2 Value
Total Key1 Value
Regards.
Regards.
Have we to make a special software or hardware installation to use the adobe forms technology in a ECC5 environment?
This is indeed a great blog.
We have 3 very complex smartforms in CRM system and we need to map the templates in the Adobe forms. On a scale of 1 - 10 I would say 10.
What is the complexity Level that PDF forms can handle?
Regards
Prasad
However overall Adobe Forms provides a far superior design tool. I would say on average any Samartform should be just as easy if not easier to build in Adobe once you get the hang of the tool.
This is certainly a fantastic weblog! Thanks so much for it!
BTW, I'm now creating a table for my PCR as well. I've already managed the form bit (subforms etc) but am unsure of how to pass the data from my internal table to the table in the form.
I believe I would need to populate the values in SPECIAL_DATA of the QISR BADI, but could you please give me some pointers for this? I've tried other forums but had no luck.
Thanks again!
Regards,
Adeline.
I have a table in a form for PDF.
The problem comes when the number of rows is big and there is not enough space in the first page.
I want the content to be shown in next page but the tab 'pagination' is disabled and i can not configure it.
Any solutions?
Thanks in advance.
I have a quite similar problem: I succeed when the table fits in at most two pages. But when there are hundreds of rows and the table spans for 3 or more pages - the header is shown twice: only at the beginning of the table and right after the first page break. I'd be really greatful if you could help me out on that.
Thx in advance.
Thomas
P.S.: And all the forms on the page are set to flow content.
Thx again
Thomas
Thanks for your weblog.
For my first form, I need to include a dynamic company logo. The issue is that these logos are SAP Script Text.
In SAP Library, it is said that graphics have to come from Mime Repository.
So is there any solution to use a graphic that points to a SAP Script Text.
Thanks,
Alain.
Now if you are refering to Graphics stored as Text, this format is obsolete even within SAPScript. However the replacement approach actually stores the documents as Bitmaps in the BDS (Business Document Store). It should theroteically be possible to read the files from the BDS and process them into binary strings and pass them into the Adobe Forms.
You might want to have a look at the function module, SAPSCRIPT_BITMAP_GET, to see how this reading from the BDS is done within SAPSCRIPT. This should get you most of the logic you will need.
Really nice Blog.
I see in your example, you have the same effect, as me in my Adobe Lifecycle Designer Application.
The background-color of the dynamically integrated icons, are in such a bad pink color... The original icons, doesn't have such a background color in the mime-repository.
Have you any idea to avoid this unaesthetic effect ?
Thanks in Advance & Kind regards.
Alex.
The only work around I know of is to download the files, edit them in an image editor to remove the mask, and then reupload them to the MIME repository in a folder of your own. You wouldn't want to overwrite the standard icons - they wouldn't function correctly in a browser if you did and the changes would be overwritten in Support Packages/Upgrades anyway.
I did download and edit some of the more common icons when I worked at Kimball for use in Adobe Forms.
I'm not sure what you mean by normal application. Print based Adobe forms can be called from function modules in the background, inside dialog and list programs - as well as BSP, Web Services, and Web Dynpro applications.
my aim is to display a image based on sales organization.
i have maintained a custom table in which i am storing the urls of the images stored on server.
Using a select querry in print program i am retriving the url from table in a variable (lv_name) and passing that url to ADS FORM.
In ads form i have placed a image and a text field. The URL of the image is assigned a value of text field(containg url path) in form calc.
Problem is the image is not displayed when i run my print program.
I have done R&D on this and found following
1) When i assign same URL to the textfield's default value and hit PRINT PREVIEW in SFP then that image is picked and displayed on form. but when i run that form from my print program(default value still intact) then image is not displayed.
my concern is why is it that image is displayed in print preview and not when i am calling my form from program.
I am using the below code to call a ADS Form..
TYPE-POOLS: abap.
START-OF-SELECTION.
DATA: ls_params TYPE sfpoutputparams.
* Form Processing Output Parameter : Request PDF return
ls_params-getpdf = 'X'.
* Start of Form Processing
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = ls_params.
TRY.
DATA: lv_name TYPE fpname,
lv_funcname TYPE funcname.
*Get the function module for Form
lv_name = 'ZSREE_ICI_TRAINING_PDF01'.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = lv_name
IMPORTING
e_funcname = lv_funcname.
ENDTRY.
DATA: customer TYPE scustom,
bookings TYPE ty_bookings,
connections type ty_connections.
DATA: fp_docparams TYPE sfpdocparams,
fp_output TYPE fpformoutput,
filename TYPE string,
path TYPE string,
fullpath TYPE string,
data_tab TYPE TABLE OF x255.
* Form Processing Form Parameter
fp_docparams-langu = 'EN'.
fp_docparams-country = 'US'.
* fp_docparams-fillable = 'X'.
CALL FUNCTION lv_funcname
EXPORTING
/1bcdwb/docparams = fp_docparams
scustom = customer
bookings = bookings
IMPORTING
/1bcdwb/formoutput = fp_output.
* End of Form Processing
CALL FUNCTION 'FP_JOB_CLOSE'.
cl_gui_frontend_services=>file_save_dialog( EXPORTING
default_extension = 'PDF'
CHANGING
filename = filename
path = path
fullpath = fullpath ).
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = fp_output-pdf
TABLES
binary_tab = data_tab.
cl_gui_frontend_services=>gui_download( EXPORTING
filename = filename
filetype ='BIN'
CHANGING
data_tab = data_tab ).
cl_gui_frontend_services=>execute( EXPORTING
document = filename ).
it may be a little OT, however I think you may know the things that I'd like to ask you about.
I generate a form and send it via email to a client. Could you tell me whether he is capable of making a subform or a single control (e.g. a textfield) disappear in the interactive form (e.g. by checking a checkbox or sth like that)? And if not - is it possible (and how) to add some kind of bookmarks while generating this kind of form that would make it easier to move between pages (especially when you have plenty of them)?
Thanks in advance for the reply.
Tom.
As far as bookmarks - I have never tried that. I don't know - even if the lifecycle designer let you put in bookmarks, I don't know if the ADS will render them. They are listed as a supported UI element. You might just have to experiment to try it out.
I want to know if it is possible to import a external pdf in a form without changing specific texts or fields which have been created in the form.
Actually, I have no issue to import pdf with SFP with this option: Preserve Appareances.
I've added specific texts and fields. But if I want to import another pdf file, the specific texts and fields are deleted.
Is there a way to keep the specific data but change the pdf in background?
Thanks for your reply.
Is it possible to design Interactive forms in ABAP. I have a requirement for a client using R/3, there is no Portal involved so WebDynpro ABAP is not an option.In this case I am wondering is this a possibility using general ABAP.
Cheers
Senthil
I don't understand why WDA is not an option. WDA will function correctly without a Portal.
>In this case I am wondering is this a possibility using general ABAP
It is not recommended. You should use WDA for interactive forms. It makes the binding of the XML based form interface much easier. Outside of WDA you would have to treat the interactive form like an offline form and do a lot of the processing yourself.
I don't understand why WDA is not an option. WDA will function correctly without a Portal.
>In this case I am wondering is this a possibility using general ABAP
It is not recommended. You should use WDA for interactive forms. It makes the binding of the XML based form interface much easier. Outside of WDA you would have to treat the interactive form like an offline form and do a lot of the processing yourself.
Thank you so much for the prompt reply. I used WDA before but only with portal. Do I have to use the URL of the WDA application to run it on the web page or can I create custom transaction using WDA application to execute it.
Cheers
S Kumar
Thank you for the valuable help.
Cheers
S Kumar
Now the Lifecycle Designer has both and the easiest way to build a table is to just drag and drop a context node onto the form layout.
Really nice and useful blog!.. I had a question. Is possible to populate some drop down fields, tables, etc from an external file in an offline forms? I'm asking this because we need to have a material master reference in a form and we're not connected to the network.
If the answer is yes, how can I achieve this?
Thanks a lot!!!
Best regards!
María Margarita
Hi Thomas,
G'Day. I understand this blog is relatively old, but if you are monitoring, i have a problem which is as described below
1) We have an existing Interactive offline adobe form operated from WedDynpro
My requirement is to have it called from ECC ABAP via DIalog/Module pool program rather than WebDynpro... I am kind of new to this, but managed to create a the program similar to print program with FP_JOB_OPEN, Call FM and Close FM.
The problem is it is -
1) Opening a Print Preview window, which we want to avoid
I set the No Dialog parameter, now there is no Print Preview, but not sure how to get the output as PDF Interactive form
Googled your Blog and then used SCMS_XSTRING_TO_BINARY to convert PDF to Binary, now I have hte Binary Data, but not sure how to use this to - Bring a Popup window to the user with PDF Form output ? Can you please share your thoughts ....
2) Second - Main problem is - when the Form is viewed thru the Print Preview window, when opened the Interactive property is lost and the action button we put are not displayed now - I have set the Fillable Parameter as well, still the same result
--is it because that we are using both JAVA and FormCalc on the form to control the actions ? and since now we are using ABAP program to call, is this not working ? Can you please share your thoughts
thanks again
Ganu
> I understand this blog is relatively old
Relatively old? I think its old enought to apply for retirement benefits. 🙂
I really haven't worked with Adobe Forms in a long time. I'm not up date on their functionality. Even then I didn't do that much with offline interactive forms. My experience was Interactive online forms and non-interactive forms. I suggest you post your questions in the appropriate forum.
Hi Thomas,
Thanks as always for your response...
btw i managed to figure out the solution, its working fine.
Basically I got the PDF data and then converted it to Binary and then used the
cl_gui_frontend_services to render and save it as required.
Its working fine now, thx a lot - many of your articles are helping a lot...
Ganu
Hi Thomas,
How to print PDF directly from Webdynpro without preview,Could you throw me a light.
Thanks,
Kaleel