Previously, the tutorial of customizing output form template using Adobe LifceCycle are mainly focused on tasks like adding custom fields, changing company logo, changing address layout. I strongly recommend to read this very nicely blog which showing everything step by step to customize output form template. While Adobe Forms also support programming to add logic for data source processing, this blog would like to give a short glimpse on how to write FormCalc code to change the behavior of your Form Template.
This blog would split into 2 parts where the first part would introduce the composition of Abode LifeCycle and how to use the code editor. The second part would introduce the syntax of FormCalc with a customizing example. In the following phase, the term “Designer” would refer to Adobe LifeCycle Designer.
1.Designer in the SAP environment.
The Layout Editor is the main area where you create and maintain the form design. It contains four tabs: "Design View", "Master Page", "XML Source", "Preview Tab".
"Design View" tab Displays the pages that make up the form design. The pages in Design View contain a form design’s content. In #S/4HANA Cloud Output, we don't need to create any new form template cause we have the pre-delivered output template. What you need to do is just to adjust the template. Secondly, "Master Pages" tab displays the master pages that can be applied to pages in Design View. Master pages specify the layout and the background for the form design. You add objects that will occur in the same position throughout the form design on a master page. The Master Pages tab is hidden by default. Objects in the Design View page do not appear in the master page. "XML Source" tab displays the XML source code that describes the structure of the form design and its objects. It is recommended that you do not edit the XML source code directly. Preview PDF tab Displays a PDF form based on the current form design. As you work, if you have Acrobat or Adobe Reader installed, you can preview the form in the Preview PDF tab. Use the Preview PDF tab to view and test the operation of a form or template as if it were a PDF file. You can set options for previewing interactive forms or printable forms in PDF by using the Form Properties dialog box (Preview tab).
In the Script Editor, you can create, edit, and review calculations and scripts specific to a form. This tool allows you to develop anything from basic calculations that sum numeric fields to intricate scripts that dynamically adjust the form's layout based on user interactions. Designer provides support for scripting in its proprietary language, FormCalc, as well as in JavaScript, offering flexibility to cater to different scripting requirements.
The palettes offer convenient access to tools without cluttering your workspace. They can consist of multiple tabs, each housing common properties. For instance, the Object palette may feature several tabs. You have the flexibility to organize the palettes within the workspace to align with your preferred working style. Among the most frequently utilized palettes are the Hierarchy palette and Data View palette.
The Hierarchy palette visually represents the contents found in the Design View and Master Pages tabs. Selecting an item in the Hierarchy palette also highlights it in the associated body or master page.
Regarding the Data View palette, when a data connection is present, it showcases the hierarchy derived from that connection. The top nodes in this hierarchy represent individual data connections by displaying their names. Data connections establish a link between the form and the data source. When designing a form based on a data connection, Designer constructs a data structure for the form using the provided data source. Users can filter nodes for manipulation and efficiently create a form using selected or all data sources. Subsequently, binding is utilized to connect a node from the data source to an object on the form
2. Customizing Example
Requirement: You are an SAP implementation consultant for a consulting services company. The consulting services company has a long-term contract with their customer and has created a continuous multi-year Service Sales Order in the SAP system. Every year-end, one single item was added to the sales order. Due to business specifics, the consulting company wants to send only the Order Confirmation Change for the last item added that year which means to only print the last item in the PDF output.
Implementation Steps:
Find the code editor area.
When first received this requirement, the most important point is to find out the working mechanism for Adobe Designer. In a nutshell, the goal is to display the data source in a formatted manner. We can write logic to customizing how data was shown. In the script editor, Designer offers various trigger points for the script, such as 'initialize,' 'enter,' 'exit,' and so on. If the form connected to a data source, we can manipulate the data directly.
Click on the Hierarchy palette, select the node "tabInnerTable" located at the following path: Form -> bdyMain -> frmTableBlock -> tblRemarkRowTable -> rowItem -> tabInnerTable.
Then open the Script Editor(click Window tab and choose Script Editor) for the chosen node. Choose the dropdown list with “calculate*”. Add the below code to control that only show the last item:
var tblrow = frmTableBlock.tblRemarkRowTable.resolveNodes("rowItem[*]").length - 1;
if ( $.parent.parent.rowItem[tblrow].tblInnerTable.rowItem.colItem.rawValue <> $.rowItem.colItem.rawValue )
then
$.presence = "inactive"
endif;
When calculate the each row item's value: Get the last row's index in the data source table(rowItem) first. Then compare the value in current row with the value in the last item through the gotten last item's index. If they are different which means current row item are not the last item, set the presence of current row as inactive. With this code, only the last item will be shown in the PDF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |