cancel
Showing results for 
Search instead for 
Did you mean: 

RAP - sending base64 content/document type from ABAP backend to Fiori Element Front-end?

jctx15
Discoverer
0 Kudos
207

Hey there. ABAP developer here that is slowly learning Fiori/RAP. I am building a RAP application in Eclipse using SAP Fiori Elements, that is based on a older SAP program we have using one underlying database table. I am trying to mimic some print to PDF functionality and my main question is how we can send a base64 file/file type from the ABAP backend to the fiori elements front end? 

In our current SAP program, clicking this particular print button will prompt the user to select a document to print for the selected table row data. Backend ABAP logic will then generate a JSON request -> REST call -> and in the JSON response we have some document binary data that is converted to Base64. We then use SAP "cl_gui_frontend_services" to download the file, usually in PDF format. Document then opens up on users screen. This is what I want to mimic in RAP. I currently have a OdataV4 service exposing my database table through CDS entities. I created a action event in my behavior definition that generates a "Print" button on the front-end.

So far my Print action event in my RAP app, I have the code in place to retrieve the binary data from the response of the REST call which is working correctly. Now I'am trying to work through sending the base64/file type of this RAP action event to the front-end so that the user can see the document. I'm currently doing some research on this, and have found some other articles on this particular subject, but most of them are for uploading files/attachements. I believe its the same functionality that I am looking for, but I wanted to ask if anybody has had any similar requirements? 

__PRESENT

__PRESENT

__PRESENT

__PRESENT

__PRESENT

View Entire Topic
zhuang_xian
Discoverer
0 Kudos

Hello jctx15,
I think you can extend Fiori elements by using the custom button, then implement the logic with JavaScript. In the background, you can develop an OData service that implements generating the PDF file (binary). The JS can call the OData service and print it.