Tour of Adobe Forms Print Scenario

Published on July 2016 | Categories: Documents | Downloads: 57 | Comments: 0 | Views: 226
of 9
Download PDF   Embed   Report

Tour of Adobe Forms Print Scenario

Comments

Content

October/November 2010

On ABAP

A Tour of the Adobe Forms Print Scenario: A Guide for SAP Developers and Consultants
By Rehan Zaidi
Editor's Note: Adobe Forms are creating a buzz—do you have all the knowledge you need to help your users maximize this technology? In this article, Rehan Zaidi provides an overview of Adobe Forms, focusing on PDF generation. Learn the advantages to using Adobe Forms, how to develop a form, and the structure of the programs that call Adobe Forms.

Introduction
An important topic today for SAP developers is Adobe Forms. This technology provides numerous advantages to the SAP user community, including the PDF generation of data as well as providing a means for Interactive forms development. For the developer, SAP has provided an easy-to-design and Due to the numerous powerful set of tools in addition to the previously used advantages for both Smartforms technology. Due to the numerous advantages for developer and users, both developer and users, learning Adobe Form basics is a learning Adobe Form must for ABAP consultants. The aim of this article is to provide an overview of the Adobe Forms. The questions that this article will address are:    

basics is a must for ABAP consultants.

What are the various components of an Adobe Form and how do they interact at runtime? What are the advantages of using this technology? What are the steps required in creating a form? What is the structure of programs that call Adobe forms?

The primary emphasis of this article will be on the Print Scenarios of Adobe Forms and not the Interactive Scenarios. I will start with the advantages and the overview of Adobe Forms. I will then dive in the details of the components of the forms, such as the context and the layout, as well as the steps required in developing an Adobe form. Finally I will cover the structure of programs that call Adobe forms. This article is primarily intended for ABAP developers and consultants. I will assume that the reader is familiar with basic ABAP concepts, and has some knowledge of Smart forms. For more information, refer to the SAP documentation on http://help.sap.com. All the screen shots have been taken from ECC 6.0.

Copyright © 2010 by Klee Associates, Inc. www.ERPtips.com

A Tour of the Adobe Forms Print Scenario

Adobe Interactive Forms: An Overview
The Adobe Interactive Forms option lets you generate forms in PDF format (Print Scenarios), both for printing as well as for taking input from the user (Interactive Scenarios). A typical output of a generated PDF is shown in Figure 1.

Figure 1: Typical PDF Output Technically speaking, a form is composed of two parts, the Context and the Layout. Context is a hierarchical (tree-like) structure that comprises all data that is available for display in PDF format. (The Context is generated using an Interface, the starting point of form development, which comprises the data that is passed from the calling program to the form.) The Context may contain additional coding as well as checks that need to be executed before data is populated in the appropriate data nodes.

Figure 2: PDF-based Forms Components Copyright © 2010 by Klee Associates, Inc. www.ERPtips.com Page 2

A Tour of the Adobe Forms Print Scenario

Both the Interface and Forms (Context and Layout) are generated using the transaction SFP as shown in Figure 3.

Figure 3: Form Builder Transaction SFP Main Screen The steps required in putting an Adobe Form to work involve: 1. Creating a suitable Interface 2. Creating the Context – using the fields of the Interface created in step 1 in addition to system fields, along with deactivating Interface fields for performance 3. Designing the Layout; i.e., the look and feel of the form when printed 4. If required, writing the additional code scripts within the form for data formatting 5. Developing the ABAP program for integrating (calling) the Adobe form Note: The Interface contains the data passed from the program to the form. Multiple forms can be used meaning the same set of data may be passed on. The layout of the PDF-based forms is designed using the Adobe Livecycle Designer (ALD), The ALD is an XML-language tool and also provides support for the scripting for formatting data. After creation of the form, a function module is generated that should be called from the calling (print) program. At runtime, similar to the Smart forms, the ABAP program executes a function module generated for displaying the form. The PDF generation from the form layout and logic is carried out by the Adobe Document Service (ADS) residing on the Java Stack of the application server. At runtime, the ABAP processor fetches the data and then executes the code and supplies an XML data stream to the ADS for generating the PDF. Adobe Document Services (ADS) is used to output the print form output. The ADS generates the PDF and sends it back to the calling program. This is necessary because the ADS resides on the Java Stack installed on the application server. Note: Runtime rendering of PDF is done by the ADS that runs on the Java Stack. There are numerous advantages that interactive forms technology provides, such as:     The designing of the layout is very easy and rendering tabular data is possible. The graphics need not be uploaded to the SAP server. An existing PDF file may be imported and modified. Smartforms may be migrated into the Adobe Form format.

Copyright © 2010 by Klee Associates, Inc.

www.ERPtips.com

Page 3

A Tour of the Adobe Forms Print Scenario

Interface
As the name signifies, the interface is the connection between the calling program/application and the form. It is through the interface that the data to be displayed is passed from the program to the form. The interface corresponds to the parameters of the function module generated by the form. An interface may be created without the form. From the main screen of the transaction SFP, the name of the interface to be created is entered and the Create button clicked. Once the new interface is created, the screen appears as shown in Figure 4. When creating the Interface, you must specify the Interface Type on the Properties tab. There are three options available on the form attributes, as shown in Figure 4. The most commonly used type for usage from calling ABAP programs is the Dictionary Structure.

Figure 4: Interface Creation On the Interface tab, the importing and exporting parameters are defined. The importing parameters are of primary importance; as the name implies, these importing parameters are the data that are passed from the program to the form for display.

Figure 5: Interface Tab

Copyright © 2010 by Klee Associates, Inc.

www.ERPtips.com

Page 4

A Tour of the Adobe Forms Print Scenario

You may also define Coding within the Initialization node. At runtime, the code written within user Initialization is called by the ABAP processor; the XML stream is then created and sent to the ADS for PDF generation. Note: For use within an ABAP print program, you should create interface based on ABAP Dictionary type.

Context
All data that is part of the context may be used in designing the layout for display. The context is part of the form using the transaction SFP. When you create a form, you specify the context and the layout design. Within the Form Builder, on the Properties tab of the form (Figure 6), enter the name of the interface that is to be used. The context may contain additional coding as well as checks that need to be completed.

Figure 6: Creating a Form Click the Context tab to go to the screen shown in Figure 7.

Figure 7: Example of Context On the left pane, you are shown the data defined in the Interface along with system fields such as Date and Time. You may drag and drop of the data of the interface to the right pane in order to include it in the context. You may also inactivate the fields within the context that are not needed. Deactivating fields reduces the amount of XML stream passed on to the Adobe Document Services and thus may increase performance. If you have used the XML interface, there is no context generated. Copyright © 2010 by Klee Associates, Inc. www.ERPtips.com Page 5

A Tour of the Adobe Forms Print Scenario

Form Layout
As mentioned earlier, the layout is created using the Adobe Livecycle Designer. Let us now discuss a few terms that are relevant to the Adobe Livecycle Designer.  Master Pages: Master pages are fixed data content pages. Any static data that you need to be printed irrespective of the data send to the form needs to be included in the Master Pages. You may define a number of master pages within a given form. These objects that appear repeatedly on all page sequences at time of PDF generation are known as Boilerplate Objects. The information size of the page and the orientation is also specified while defining Master Pages. These include any text or image such as company logo. The master page also contains special areas known as Content Areas that form placeholders for dynamic content. Body Pages: The dynamic content to be printed on your form is included/specified in the body pages. Dynamic data such as text or tables is included in Body pages, which are then linked to content areas defined within the Master Pages. You may define the flow of the dynamic data as well as define page breaks.



You may have a number of master pages and design pages in your form. Within Master pages are content areas, on which Design views are embedded. From within the form builder in display or change mode, choose the Layout tab. This will take you to the screen shown in Figure 8.

Figure 8: Adobe Livecycle Designer The left pane comprises the Hierarchy node that lets you define Master Pages and Body Pages. There is also a tab named Data view that allows you to select data residing in the context. The preview of the Design view, Master page, and the entire PDF form may be seen in the middle of the pane. The right side provides the tools need to add elements to your form.

Copyright © 2010 by Klee Associates, Inc.

www.ERPtips.com

Page 6

A Tour of the Adobe Forms Print Scenario

The sophisticated designer provides a number of menu options for designing forms and provides functionality for adding elements (such as text, graphics, input fields, and tables), as well as options for drawing and shading those elements. The data defined in the context is available in the left pane under the node Data View (see Figure 9). To include a field defined in the context into your form, simply drag and drop the field from the Data View to the layout. For example, Figure 9 shows a Master Page defined by the name FIRST. It contains text SENDER_ADDRESS and the logo graphic, as well as a customer address. A dynamic content also exists by the name CONTENT_AREA. A body pages BODY_01 is also created, having the text INTRO_LINES and a table IT_BOOKINGS.

Figure 9: Data View Node You may create either Static tables or dynamic tables displayed in your form. Static tables may be those whose contents are known by programmers. A variety of tabular data formats are also possible using the Livecycle Designer. You may, for example, print data in simple table format as shown in Figure 10. Column 1 Value 1 Value 4 Column 2 Value 2 Value 5 Column 3 Value 3 Value 6

Figure 10: Simple Table Sorted tables, such as the one shown in Figure 11, are also possible. 10000 ABC XYZ DEF DCF SDF 178 555 890 789 888

20000 Figure 11: Sorted Tables

In addition, you may also create nested tables. Note: You may display both Static and Dynamic text and tables with your form.

Copyright © 2010 by Klee Associates, Inc.

www.ERPtips.com

Page 7

A Tour of the Adobe Forms Print Scenario

For adjustment (refinement) or conversion of data before final display to the user, you may also write code within the form using Scripting. This code is written in ether Adobe's scripting language Formcalc or Javascript.

Calling Adobe Forms from ABAP Programs
In this section, we will discuss the coding needed to call an Adobe form within your program. Note: The concepts mentioned in this section pertain to the calling of forms whose interfaces have been generated using transaction SFP. The coding does not apply to Smartforms-based interfaces and are only to dictionary-based interface. The code in the application program that calls an Adobe form follows a somewhat similar structure. Programs that call Adobe forms from ABAP programs use three important function modules, shown in Figure 12. Function Module Name FP_FUNCTION_MODULE_NAME Used for Gets the function module name for the corresponding Adobe form FP_JOB_OPEN Opens the form for printing FP_JOB_CLOSE Closes the form Figure 12: Function Modules in Adobe Form Calling Programs A typical excerpt of a program that uses these modules is shown in Figure 13. SELECT * FROM TABLE….. " fetch data to be displayed …………. TRY. CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' EXPORTING I_NAME = MYFORM IMPORTING E_FUNCNAME = MYFUNCTIONMODULE. ENDTRY. CALL FUNCTION 'FP_JOB_OPEN' ………. LOOP …… CALL FUNCTION MYFUNCTIONMODULE EXPORTING DATA = MYDATA …….. ENDLOOP. CALL FUNCTION 'FP_JOB_CLOSE'….. Figure 13: Calling PDF Print Forms from ABAP Programs

Copyright © 2010 by Klee Associates, Inc.

www.ERPtips.com

Page 8

A Tour of the Adobe Forms Print Scenario

At the beginning, the function module FP_FUNCTION_MODULE_NAME is called in order to get the generated function module of the Adobe Form. This function has two important parameters; the parameter FORM_NAME and the name of the generated function module E_FUNC_NAME. The FP_JOB_OPEN is then called in order to start the form printing. The function module of the Adobe form is then called within a loop and provided with the necessary data to be printed at the time of PDF generation. Finally the function module FP_JOB_CLOSE is called to end the form printing process.

Conclusion
Adobe Forms is a useful tool for SAP developers and consultants. I hope that this article will prove to be a useful resource for you. Rehan Zaidi, Senior SAP Consultant, Siemens Pakistan. Rehan has been involved in both ABAP development and functional configuration for SAP HR implementations at multinational and local companies, and also has experience with SAP Workflow. He has contributed articles to the SAP Professional Journal, the HR Expert newsletter, and to the TechRepublic Website. He is currently working on his first book, specifically designed for SAP HR Users and Managers, as well as a guide for ABAP/Workflow Consultants titled “201 Interview Questions on Workflow”. Rehan is the founder of the web site www.siteofSAP.com. You may contact the author at [email protected]. Be sure to mention the author’s name and/or the article title.

The information in our publications and on our website is the copyrighted work of Klee Associates, Inc. and is owned by Klee Associates, Inc. NO WARRANTY: This documentation is delivered as is, and Klee Associates, Inc. makes no warranty as to its accuracy or use. Any use of this documentation is at the risk of the user. Although we make every good faith effort to ensure accuracy, this document may include technical or other inaccuracies or typographical errors. Klee Associates, Inc. reserves the right to make changes without prior notice. NO AFFILIATION: Klee Associates, Inc. and this publication are not affiliated with or endorsed by SAP AG. SAP AG software referenced on this site is furnished under license agreements between SAP AG and its customers and can be used only within the terms of such agreements. SAP AG and mySAP are registered trademarks of SAP AG. All other company and product names used herein may be trademarks or registered trademarks of their respective owners.

Copyright © 2010 by Klee Associates, Inc.

www.ERPtips.com

Page 9

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close