Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member726345
Discoverer

Introduction


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:

  1. preliminary work

  2. implementation of a model provider

  3. implementation of a data provider

  4. test

  5. conclusion


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

Embedded Scenario

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"

Preliminary work


Before we start with the OData Implementation, we will create for our case a simple Adobe Form without any variables with a simple interface.


Simple Adobe Form


 


Simple Adobe Form Interface


For our OData Model I created a following structure


OData Model - 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.


Line Type of ZSDEMO_ODATAV4_AF_TAB


Now we can start with our Model Implementation.

OData V4 Model Provider Class


We enhance our Model Provider Class from blog post.


Model Provider Class – Define Method



Model Provider Class – Define Adobe Form Method



Model Provider Class – Define Container Adobe Form Method


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


Data Provider Class – Create Entity Method


Delegate to a private Method


Data Provider Class – Create Entity Af Deep Method Part I



Data Provider Class – Create Entity Af Deep Method Part II



Data Provider Class – Create Entity Af Deep Method Part III


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.

Test


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:

{
"DocRecn": "00000000-0000-0000-0000-000000000000",
"AfContainerToAfNav": [
{
"Data": "00003"
}
]
}

 


POST Request - Part I


With an external Break Point you can debugg your code:


POST Request - Part II


Result of the response:


POST Request - Part III


Result in our ZDEMO Database Table


POST Request – Part IV



Conclusion


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.
Labels in this area