PDF using ADS Printing in SAP MII
While below document mentions clearly how to generate a static PDF or PDF using life cycle designer, it somehow misses on highlighting
how exactly you can map the xdp file with xml input(still a great document), also the attachment sample xml and xdp does not open and it would be difficult to look for mapping for a novice like me.
https://www.sap.com/documents/2016/09/864b7d45-8a7c-0010-82c7-eda71af511fa.html (Link 1)
I tried to look for couple of hints across web to see how I can break it through, finally got a solution after referring the basics on xdp from below link.
Sharing these links as these may be helpful for people working in SAP area.
The solution goes like this….
1. You have an input xml that should be mapped to xdp file. Assume your input looks like how it’s mentioned in Link 1 with an added tag.
<?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?>
2. The xdp file I used is the one from below link.
So if you see in this xdp file, you would notice it has <field> tags in it that should have <caption> and <Value> tags in it. <Value> tag should be outside <caption> and directly under <field> tag. <Value> tag was actually not available in the sample I copied from above link so I added it.
Under <caption>, you would see one more <value> tag which is used for labeling the field. Notice the case of two tags.
“name” attribute in <field> denotes the node under <PrintContent> of input xml from where the xdp should pick data.
Eg. <field name=”Quantity” ……
With this, ADS printing action would give you a pdf to save in web folder with data from input xml.
3. Next I tried to open this pdf using Runner service(below)
but it was giving an error as “Failed to load pdf” though I could save it in web, export and open successfully.
While looking for some more clue I came across below post and answer from @jeremy.good
The url I used was missing “&IsBinary=true” parameter, after adding it, the service opened pdf on browser without any issues.
I am no expert in xdp, but trying to fill some gaps here. Hope it helps, do let me know your views in comments.