Build a Custom PDF Form for a Standard BO
SAP Cloud for Customer supports generation of PDF (adobe) forms from Cloud Application Studio and Administrator UI (Silverlight) for Standard BOs and Custom BOs.
Some of the predelivered forms for Standard BOs-Account, Opportunity, Appointment, Phone Call, Visits, Sales order, Sales Quote which can be edited using Easy Form Editor or Adobe Livecycle Designer. However there are few limitations to this as well :-
• Limited updates are possible on the standard pre-delivered PDF form (summary/factsheet) on Standard BOs, which are – rearrangement of layout (using Adobe LiveCycle Designer), Displaying/Hiding of the existing Form Parameters
• Using PDI Studio or KUT, it is possible to add Extension Fields onto Standard forms, However fields from Node-Extensions cannot be added onto Standard Forms
• Display of data from different BOs, Associations, etc. on the standard form is not supported
• Sorting/Filtering of data displayed on the standard form is not supported
• Applying specific formats for Date, Amount on the standard form is not supported Often is the case, where customers have specific requirements to display data from additional sources and in specific formats.
It is possible to overcome these limitations, by reimplementing a complete new development which can be achieved by following the steps below-
Build a Custom BO:
1. Each Standard BO by default is associated with the predelivered PDF form using the unique Form Template Group ID Code. Due to this, it is not supported in PDI to create a new form and associate that with the Standard BO to be launched on PREVIEW request.
2. Inorder to accomplish this, we will create a CUSTOM BO with the exact list of fields as required in the new form. This BO will be marked as a TRANSIENT BO, so that data is not persisted The BO can be marked as transient by annotating all the fields in BO as [TRANSIENT] and not marking any field as a KEY field
3.Create an ‘AFTER MODIFY’ event on the Custom BO
.4.In the ‘AFTER MODIFY’ event, use RETRIEVE & QUERY statements to prepare the data for Form at runtime.
- The data from ‘Activities’ can be further filtered to display only ‘OPEN’ Activities or ‘Completed’ Opportunities, etc. -
The Amount fields can also be formatted in a custom way (display/not display Decimals)
-- Dynamic Labels can be set per section
--Format the date display
Generate Print Form on BO
5.Right click on the BO and click on Create Print Form
6.The Form Template Group Header is generated (with a Unique ID) along with the XDP file.
7.The Form Interface structure includes all the fields from the BO including the Sub-Nodes. You can selectively select/unselect these from the Form Interface for Form Template Creation
8.You can access the form by clicking on XDP file (which will launch the form in adobe livecycle designer)
On the right-hand column you will be able to see a tab- “Data View” which corresponds to the Form Template Interface fields (corresponds to the interface selected .FTHD) On the left-hand column the properties of each field on Designer Pane can be viewed and adjusted. The fields can be additionally bound by selecting ‘DATA BINDING’ and the field from Data Connection.
Under the tab – “Hierarchy” you will be able to see all the form blocks
- Create a single MASTER Page Layout which would appear on all the pages, e.g. Logo, Date, Page Numbers
- Create one Body-Sub Form Layout which contains all the sections required in form.
9.Once form is designed, save and activate the form. Click on CHECK-IN against the .XDP file in PDI to merge the changes back into Studio.
Create an Event to Fill Data at Runtime for Form
10.Create an Embedded Component with an INPORT in the Embedded Component tightly bound to the Parent TI’s Navigation ID (Account ID) and configure an event to be fired immediately
The event handler ‘AUTOFIRE’ is configured to fill in details of Account (at runtime) into the Custom BO which would then push the data onto the PDF Form.
- The 1st operation is the ‘BO READ’ Operation, which initially checks if the data has already been buffered in Custom BO? If yes, then it avoids re-reading the data back into BO.
- The 2nd operation, is an ‘IF Condition’ which checks if the attribute ‘ROOT/ACCTID’ gets a result from READ Operation, if NO (blank) then it starts the INSTANCE Creation operation.
If the Condition is met, i.e. /ROOT/ACCTID = “ “, then :- Create an Instance of BO
Assign the ACCOUNT ID to the CUSTOM BO
Create an Event to preview Form
11.Create BUTTON in the same Embedded Component to launch the custom preview form.
12.Create an Outport under CONTROLLER tab of EC- to pass the FORM Group Code and the parameter to force front-end preview as-is below
13.Create the Event Handler to trigger outport and assign this Event Handler to “ON CLICK” properties of the Button-
14.Next, add the PREVIEW Modal Dialog (from the reuse SAP BYD Application UI folder)
Also do a NodeReferenceBinding on ROOT
Link Custom EC to Standard TI
15.Next add the Embedded Component using a Stable Anchor in the Standard TI (Account TI used here in example) And, do the Outport-Inport Binding passing the Account ID (used in example here)
- Select the operation from a stable anchor under Extensibility Explorer