cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

In S/4HANA Public Edition, you can create custom forms. This works great as long as you can use the SAP standard data providers (IDP). You can see where this is going... we can't use those, our data selection is completely custom and involves several data sources.

In this scenario you have no alternatives but to take control and build everything in a piece of custom coding. In our case, due to the need for other on-stack features/APIs, we built this code on stack as well. This is all still in a Public Edition environment.

A large part of the process is perfectly explained in this blog:
SAP Forms service by Adobe in SAP BTP, ABAP environment

There are several steps required to eventually get to the PDF form. A connection to the template store on BTP, a reference to a data service which exposes a CDS view, and of course in the end a method to combine form layout with form data. Very basic versions of all these steps are in place and do work.

" This creates the MT_OUTLINE structure that contains the data layout
data(lo_fdp_util) = cl_fp_fdp_services=>get_instance( 'ZSD_customform' ).

" Based on the key, this should always return a single top level record
data(lv_data) = lo_fdp_util->read_to_data( lt_keys ).     " In readable data format
data(lv_xml)  = lo_fdp_util->read_to_xml_v2( lt_keys ).   " In XML format
data(lv_xsd)  = lo_fdp_util->get_xsd_v2( ).               " In XSD schema format

Now comes the tricky bit. Besides having a CDS view as data source, we require to query an external data source as well. When loading the initial data service, SAP generates the data structure for you. Very convenient and it saves you the trouble of manually building the XML and XSD. This of course only includes the fields known to the data service, not the ones from the external data source.

What would be a sensible solution here? Manually creating the XSD feels wrong in every way. How can we integrate both data sources into a working XML file (for actual data) and XSD schema (for data layout)? That schema can then be uploaded to the template store.

0 Likes
View Entire Topic
Jerry_Lowery
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi EgbertVenema,

Are you using the BTP Adobe forms service from Developer Extensibility?

Have you already checked the Developer Extensibility Print Forms?

https://help.sap.com/docs/SAP_S4HANA_CLOUD/6aa39f1ac05441e5a23f484f31e477e7/959664fed2114b7ba070c5bc...

Seems if you are developing an onstack app to do it, you should be able to pull the data you need?

Thank you

Jerry

EgbertVenema
Participant
0 Likes

Hi Jerry,

Pulling the data or generating the PDF itself isn't the issue, that works as expected. The challenge is generating the XSD data schema based on both the Service Definition (custom CDS view) and an external data source (Rest API).

The Service Definition seems to be the one and only supported entry point for the FDP services to generate the data schema. However, as long as that does not include the external data source, it contains only a fraction of the required data.

That's the bit I'm trying to figure out... can it be done, or should we be looking at a different approach altogether?

Jerry_Lowery
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi EgbertVenema

I hope that someone who knows the exact answer can also reply as I am probably not the most qualified.

Looking deeper into the Runtime API (looks like for Developer Extensibility or BTP it is the same api)

https://help.sap.com/docs/SAP_S4HANA_CLOUD/6aa39f1ac05441e5a23f484f31e477e7/3d8686d312bc426d8b2aa323...

or 

https://help.sap.com/docs/btp/sap-business-technology-platform/runtime-api-for-ads-rendering-calls?l...

The API only really cares about the XML data, the XDP form file, locale and specific options.

But you will need the XSD before you can properly define the form layout in Adobe Lifecycle Designer (it is needed to populate the Data View tab) - the Data View tab seems to be read only and doesn't seem to support edit to modify the XSD.

At some point, I guess you will need to do some manual work to combine the two data sources to define the data for your form.

I have not found that SAP makes a tool directly, but seems there are several XML to XSD convertors out there.

These two community posts seem related.

https://community.sap.com/t5/technology-blog-posts-by-members/graphical-xsd-builder-amp-xml-to-xsd-c...

https://community.sap.com/t5/technology-q-a/convert-xml-to-xsd/qaq-p/654911

I hope that helps or someone else provides a better answer.

Thank you

Jerry

EgbertVenema
Participant

@Jerry_LoweryFor someone 'not the most qualified' you manage to link interesting posts 🙂 Tthanks for that! Haven't got it to work, but not giving up just yet.