In blog post “Download File through NetWeaver Gateway with OData Version 4” I showed you how you can download a file via NetWeaver Gateway with OData Version 4. Now I would like to present you how you can generate an adobe form via post request. The result is that we have an entry in ZDEMO database table and the key of the entry is in the response of the OData Request.
The next sections contain following topics:
- preliminary work
- implementation of a model provider
- implementation of a data provider
In my case the system conditions were during the implementations as follows:
|Component||Release||SP-Level||Support Package||Short Description|
|SAP_GWFND||754||0000||–||SAP Gateway Foundation|
|SAP_UI||754||0002||SAPK-75402INSAPUI||User Interface Technology|
How you can register and publish a OData Service in SAP was already explained in blog post “Download File through NetWeaver Gateway with OData Version 4”
Before we start with the OData Implementation, we will create for our case a simple Adobe Form without any variables with a simple interface.
For our OData Model I created a following structure
The DOC_RECN field will be the key for the generated Adobe Form. This key corresponds to the key of the ZDemo Databse Table. See blog post.
The DOC_RECN will be set in the POST Request as response. The table AFCONTAINERTOAFNAV contains additional data for the adobe form generation. Here a simple example.
Now we can start with our Model Implementation.
OData V4 Model Provider Class
We enhance our Model Provider Class from blog post.
For our stucture I use navigation properties for our Adobe Form Data.
That’s all. The Model for Adobe Form generation is finished.
OData V4 Data Provider Class
We enhance our Data Provider Class from blog post.
In this class we redefine the method /IWBEP/IF_V4_DP_ADVANCED~CREATE_ENTITY
Delegate to a private Method
This method reads the request, generate an Adobe Form, creates an entry for our ZDEMO Database table. It sets also the document key into the response which is necessary for the consumer of this service. Afterwards the consumer can call a GET URL with that key to get the document as download file.
Befort we can test our small example we need to ensure that our OData Service is registered and published. See blog post.
Let’s test it with ARC Client. I installed the chorme app. I set the Method to POST and the path: AfContainerSet the Body looks like this:
With an external Break Point you can debugg your code:
Result of the response:
Result in our ZDEMO Database Table
This example shows you how you can implememt an Adobe Form Generation through SAP Gateway with OData Service 4.0.
I hope you liked it.
Please, let me know what you are thinking about it.