Skip to Content

How to implement a "Preview PDF" function in SAP Gateway?

Hello!

We need to implement the following scenario with SAP Gateway:

Using a SAPUI5 application it shall be possible to submit a form, containing notification (PM) related data in the following format:

  • header data (structure)
  • item data (table data)

After submitting the form, an OData service shall use the form data, generate a PDF and return it to the client/UI.

What kind of implementation do you recommend on the SAP Gateway? My thoughts:

  • Normally a function like "Preview PDF" should be implemented as a function import in my understanding. But I believe function imports do not support media queries and also parameters can only be passed via URL parameters. Therefore function imports can't be the solution, right?
  • In order to sent table data (items) we normally need to implement $expand, but not sure if there Media queries are supported?

So actually I am not sure which implementation on SAP Gateway will do the trick. I appreciate any ideas.

Kind regards,

Paolo

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Hi Paolo Erhardt Sfilio,

    You can go with the normal stream methods (Read stream) but in your case you can pass an addition header parameter to the read stream which tells if you are doing the 'Preview' operation or 'Create' operation.

    This way, you can put a check in the backend and save the pdf to db if it is not preview.

    In case if you want to know the process of reading the headers, link below:

    https://blogs.sap.com/2014/11/10/custom-header-parameters-in-gateway/

    BR,
    Mahesh

    Add comment
    10|10000 characters needed characters exceeded