logo

Are you need IT Support Engineer? Free Consultant

Get XML Data for Local Print Form Preview in SAP S…

  • By Sanjay
  • 30/04/2026
  • 4 Views


I decided to create a separate article to avoid duplicate content in each print form blog post and simplify the maintenance. You can find the list of print form-related Blogs, information on Live Sessions and an Onboarding Video for beginners in the following blog post:

Print Form Adaptation with Adobe LiveCycle Designer Overview – Onboarding, Blogs and Live Session

 

Previewing print forms “locally” within the Adobe LiveCycle Designer is an essential feature. Otherwise, you spend too much time uploading the print form to the system to preview it online after every small change. However, not only changing the template and testing it straight away is a significant advantage. Simply adapting the XML sample data to see, for instance, how a field looks when containing a different value, longer text, etc., is beneficial in contrast to creating a new sample document within the system for this purpose.

If you are looking for details on this topic for SAP Sales/Service Cloud version 1 (formerly known as “Cloud for Customer”), you should have a look at this blog post: How to get XML data for local preview of print forms without output history.

 

SAP Sales/Service Cloud Version 2 heavily relies on REST APIs, for instance, to load object data in the web frontend. You can see this in the browser's Developer Tools / Network monitor. In general, the object structure provided by these services is compatible with the form template sample data. For Sales Quotes, there is a special parameter that returns additional data (pricing elements with pre-calculated totals) for the output.

There are two challenges:

  1. Find the right service endpoint and object id
  2. The response of the REST API is in JSON format, whereas the Adobe LiveCycle Designer requires XML

I'll solve both challenges in this blog.

 

As part of the procedure, we must convert JSON to XML. This is also mentioned in the SAP Note / Knowledgebase Article 3620996 (Sales Quote XML – How to Retrieve JSON Data for Conversion in Sales Cloud Version 2).
In this guide, I use Visual Studio Code (VSCode) in combination with plugin:

Visual Studio Code is free and available for all common platforms. The mentioned plugins are published under the MIT license, and their source code can be found on Git Hub.
Never use any kind of free or publicly available online services for such kinds of tasks due to data protection and privacy reasons!

Felix_Wyskocil_5-1776122383286.Png

 

 

Log in to SAP Sales/Service Cloud Version 2 with your browser and navigate to the screen from where you can open the desired business object.

Browser Developer Tools

Open your browser's Developer Tools and activate the Network tab. In most browsers they look very similar and offer the same feature set. Depending on your browser, some elements might have a different caption. The screenshots of this blog were created using the Windows version of Google Chrome. In many browsers you can also access the developer tools by pressing [F12] or the key combination [Ctrl]+[Shift]+[ i ].

Felix_Wyskocil_1-1776119228533.Png

In Chrome, there are two buttons on the very left (A) that allow you to start and stop recording network activities and clear the log in case you have recorded too much and want to start over again. Make sure the recording is active while carrying out the next step.

Find the right URL

In SAP Sales/Service Cloud Version 2, you can now hit the button to generate the PDF. In the sales quotes, it's called Preview and can be found in the three-dots menu. In other objects, it might be called differently, such as Generate Summary, etc.

After that, the network monitor reveals the actual URL we need:

  • For the sales quotes, it'll show two calls: call with a UUID followed by ?$forOutput=true and a preview.
    Copy the URL with forOutput=true as it is.
  • For other objects, it'll only show preview. The full URL also contains a UUID and ends with /preview.
    Copy the URL of this call without the /preview at the end.

The following two screenshots show examples for sales quotes and leads.

Screenshot for Sales Quotes:

Felix_Wyskocil_2-1776119680728.Png

 

Screenshot for Leads:

Felix_Wyskocil_3-1776120041221.Png

Alternatively, you activate the network monitor right before you open the object. Then, you have to search for the call to the object itself (with its UUID) instead of a preview call. That means, when opening a lead in SAP Sales/Service Cloud Version 2, the Network monitor will show a call to the service /sap/c4c/api/v1/lead-service/leads/ that returns the lead data as JSON.

Retrieve the JSON Data

Paste the copied URL into the address bar of your browser. The browser will show a JSON document. (It's important that you're logged in to SAP Sales/Service Cloud Version 2 when accessing the copied URL. In case you have been logged out, for instance due to inactivity, the call will fail. You won't be redirected to a login screen.

Felix_Wyskocil_4-1776122202355.Png

 

Convert JSON to XML

Copy the JSON text into a new file in Visual Studio Code. Then, open the command palette and search for JSON, YAML, XML and more. After selecting it, you have to enter the source and the target format in a second prompt. Enter “json | xml” (without the quotes) and wait a moment. The plugin will automatically create the XML representation of the JSON file in a new document tab.

Felix_Wyskocil_6-1776122466831.Png

The final step is to replace the root element  and the XML declaration with the one for Adobe form templates:



	
		...
	

The following screenshot shows the XML before (left) and after (right):

Felix_Wyskocil_7-1776122527763.Png

After replacing the root element, you have the final sample data XML that you can load into the Adobe LiveCycle Designer for local preview.

Felix_Wyskocil_8-1776122547443.Png

That's it!

At first, this procedure might seem a bit complex and cumbersome. But it's worth the effort! The good news is: You can do it whenever you need it without opening a support ticket and waiting for an answer, or uploading a special template, which might not be possible in a productive environment, etc.

 

When comparing the data from the REST API response with the data that is actually used for rendering PDFs, I found out that there are differences. In my test, the REST API was missing some fields (for instance, for the sales quote: formatted address fields). In addition to that, some number/currency fields used a different number formatting.

Felix_Wyskocil_10-1776123678217.Png

 

While the data of the REST API might serve as valid XML sample data from the structural point of view, it might still differ. Hence, you cannot completely rely on this approach for the entire design and testing process, at least not without knowing the differences and where to pay attention to. However, knowing these differences can still help you quickly get sample data even if it is out of productive systems.

If you want to be sure you're looking at the exact same data as the Adobe Document Services receive when rendering the form, you should consider using my Debug Sheet, which can be found in my other blog post: DebugSheet: Get XML Data for Local Print Form Preview in the Adobe LiveCycle Designer.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *

//
Our customer support team is here to answer your questions. Ask us anything!
👋 Hi, how can I help?