Wednesday, May 18, 2016

Adding a formatted free text to your pdf forms in SAP Cloud for Customer

Since the 1511 release it is possible to define your own formatted text field as an extension to basically any object in SAP Cloud for Customer and add this field to your PDF form templates. Relatively simple in concept, but it provides the flexibility to add (formatted) free text to the generated output for all transactional- and master data objects in C4C that did not have the option before.

This blog shows how it can be done for the tickets in SAP C4C. Generating a PDF summary for a ticket has always lacked the option to add a formatted free text or note, but with this extension mechanism we can add a free text to the ticket and have it included in the PDF summary. This upgrades this ticket summary to a potential letter or any other kind of output that can be sent to your customers in a well formatted way.

Define the extension field

Let's start with adding the extension field to the ticket detail screen in SAP C4C. Open a ticket from the ticket queue and start the adaptation mode for the master layout (from the adapt menu in your administrator role). Using the key user tool, one can add a new extension field basically anywhere within this ticket screen. In this case we choose to add the new field of the formatted text type on an empty, additional tab page, because the extension fields of this type are quite spacious.

The result is a new field that, in edit mode of a ticket, offers the possibility to add your free text or notes with some basic formatting possibilities to your tickets. (As a side comment: also see the large explanatory text in blue 'Additional tab for the Acorel blog', which is a new option in the 1605 release).

Make the extension field available to the form templates

The next step is making this new extension field available to all ticket or service request related pdf form templates. Still in adaptation mode of the master layout, hoover over the new field and select the wrench icon to go to the field definition.

In the field definition of our new extension field, open the form templates tab and select the + icon for one of the available pdf form templates. Selecting just one of the icons will nevertheless make this field available to all pdf form templates that are assigned to the ticket object in SAP C4C.

Add the field to your own form template

Now that the field is available to the form templates, the next step is actually adding this field to our own pdf form template. Launch the Silverlight user interface from the adapt menu in your administrator role and open the form template maintenance tool.

We have copied the standard 'Service Request' form template to our own form template, named it the 'Acorel blog sample' and removed all fields from it that are not relevant for this explanation. Now we will further edit this form template to add the new text field. The necessary settings to correctly add a field of the formatted text type can only be done using the Adobe LiveCycle Designer (which can be downloaded and installed from the 'Downloads' section in SAP C4C).

Download the relevant form template to your local drive, extract the contents of the resulting zip file and open the .xdp file in the Adobe LiveCycle Designer. Once the form template has been opened in this tool, add a new text field to it and change its object field properties to give it a caption (in this example we choose not to have a caption), allow for multiple lines and set the field format to rich text. The field format setting is important to ensure that the formatting of the text is also reflected in the pdf form template.

Then move to the object binding properties to enter a field name and to define a data binding that connects this text field to our newly created extension field (of the formatted text type).

Save the changed form template in the Adobe LiveCycle Designer and upload the changed .xdp file using the upload function (to replace the existing variant) in the form template maintenance tool in SAP C4C.

Generate the PDF

All preparations have been done now and it is time to test our new pdf form template. Open a ticket from the ticket queue in SAP C4C, add some formatted free text to the extension field and click the Summary button on the ticket detail button. From the template selection popup select the newly created pdf form template. It will generate the PDF file which will show our formatted free text (see also the image in the starting section of this blog).