Display the Adobe form in the PDF format through Gateway Service (2024)

Introduction:

This blog post is about to display the Adobe form in the PDF format through the Gateway Service.

In this blog post you can see the steps for how to display the Adobe form in the form of PDF through Gate way Service.

Requirement:


Display the PDF Format of Adobe form using the Gate Service. Whenever execute the URL from the Gateway system, it needs to display the adobe form in the form of PDF Format.


Steps to Required:


Step1: Need to create a ODATA Project.


  • Go to the Transaction SEGW and click and on Create Button to create a project.

  • Create a Project as ZPPM_PDF_AAR, and Package details as shown in the below screen.


Display the Adobe form in the PDF format through Gateway Service (1)


  • Expand the Project which we have created just now then need to create entity type to define the Properties.

  • Expand the Data Model, under that Right click on the Entity types then click on create as show in below.



  • Display the Adobe form in the PDF format through Gateway Service (2)

  • Enter the Entity Name as required and click on ok.



  1. Display the Adobe form in the PDF format through Gateway Service (3)



  • After that will get the below screen. Here we need to check the check box for Media type as in the below screen shot.



  1. Display the Adobe form in the PDF format through Gateway Service (4)


Note: Don’t forgot to check the Media type for the Entity Type, If not we did not get the image in the Service output.


  • To define the Properties, expand the Entity type and double click on the Properties then click on the Append row button to add the properties as shown in the below screen.


Display the Adobe form in the PDF format through Gateway Service (5)


  • Then define the properties as required. For the AAR Adobe form I have defined the below properties and check the Key box for the Key fields as shown in the below screen.


Display the Adobe form in the PDF format through Gateway Service (6)


  • Once done with the above steps click on the Generate Runtime Artifacts as below.

  • Display the Adobe form in the PDF format through Gateway Service (7)

  • It will help us to create the Classes to define custom Code. It will navigate to the next screen as show in the below and click on ok button.



  • Display the Adobe form in the PDF format through Gateway Service (8)

  • To define the Code, go to the Runtime Artifacts of the Project and double click on the DPC_EXT as shown in the below.



  1. Display the Adobe form in the PDF format through Gateway Service (9)


Step2: Implement the Code to Download the Adobe form

Redefine Define method marking Mime Type and the GET_STREAM


  • Now we need to redefine DEFINE Method in MPC_EXT class as below.

  • In this class we can define the type of media. Like as per requirement we need to PDF so I have defined as pdf .


Display the Adobe form in the PDF format through Gateway Service (10)


  • Need to maintain the below piece of code in the Define Method.


METHOD define.


DATA:


lo_entity TYPE REF TO /iwbep/if_mgw_odata_entity_typ,


lo_property TYPE REF TO /iwbep/if_mgw_odata_property.


super->define( ).


lo_entity = model->get_entity_type( iv_entity_name = ‘pdf’ ).


IF lo_entity IS BOUND.


lo_property = lo_entity->get_property( iv_property_name = ‘mime_type’ ).


lo_property->set_as_content_type( ).


ENDIF.


ENDMETHOD.


In DPC_EXT Class:


  • Redefine the Get stream method and as in the DPC_EXT as below.

  • Get Stream mainly useful for the Upload or download the files.


Display the Adobe form in the PDF format through Gateway Service (11)



  • Maintain the below Piece of code in the GET_STREAM Method.


METHOD /iwbep/if_mgw_appl_srv_runtime~get_stream.


**-- Data Declarations


DATA: lv_funcname TYPE funcname,


ls_outputparams TYPE sfpoutputparams,


ls_docparams TYPE sfpdocparams,


ls_formoutput TYPE fpformoutput,


ls_stream TYPE ty_s_media_resource,


lv_pia TYPE char32,


lv_proj TYPE char32.


**-- Constants


CONSTANTS: lc_pia TYPE char32 VALUE 'PIAGuid',


lc_proj TYPE char32 VALUE 'ProjGuid',


lc_name TYPE fpname VALUE 'ZPPM_AAR_FORM',


lc_us TYPE land1 VALUE 'US'.


***__ Read key data.
LOOP AT it_key_tab INTO DATA(ls_data) ##INTO_OK.


CASE ls_data-name.


WHEN lc_pia.


lv_pia = ls_data-value.


WHEN lc_proj.


lv_proj = ls_data-value.


ENDCASE.


ENDLOOP.


**--Call the Function Module Name for the Adobe Form


TRY.


CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'


EXPORTING


i_name = lc_name


IMPORTING


e_funcname = lv_funcname.


CATCH cx_root ##NO_HANDLER ##CATCH_ALL.


**--Handle Exceptions with Try – catch


ENDTRY.


**--Opening the Job


ls_outputparams-nodialog = abap_true.


ls_outputparams-preview = abap_true.


ls_outputparams-getpdf = abap_true.


CALL FUNCTION 'FP_JOB_OPEN'


CHANGING


ie_outputparams = ls_outputparams


EXCEPTIONS ##FM_SUBRC_OK


cancel = 1


usage_error = 2


system_error = 3


internal_error = 4


OTHERS = 5.


ls_docparams-langu = sy-langu.


ls_docparams-country = lc_us.


**-- Function to get the Form


CALL FUNCTION lv_funcname


EXPORTING


/1bcdwb/docparams = ls_docparams


iv_proj_guid = lv_proj "'005056B056C91ED89DA0FA3E3E1BE0DC'


iv_pia_guid = lv_pia "'0A14860E3D8A1EE98691CCF06AF99B66'


IMPORTING


/1bcdwb/formoutput = ls_formoutput


EXCEPTIONS ##FM_SUBRC_OK


usage_error = 1


system_error = 2


internal_error = 3


OTHERS = 4.


**--Closing the Job


CALL FUNCTION 'FP_JOB_CLOSE'


EXCEPTIONS ##FM_SUBRC_OK


usage_error = 1


system_error = 2


internal_error = 3


OTHERS = 4.


**--Converting the PDF to XString


ls_stream-value = ls_formoutput-pdf.


ls_stream-mime_type = TEXT-001. “application/pdf”


copy_data_to_ref( EXPORTING is_data = ls_stream CHANGING cr_data = er_stream ).


ENDMETHOD.

Step3: Testing the Service

Register GW service, and we are ready for testing.

URI:


/sap/opu/odata/sap/ZPPM_PDF_AAR_SRV/FormSet(PIAGuid='005056B056C91ED88AF1496BDB4080DC',ProjGuid='005056B056C91ED88AF1496BDB27A0DC')/$value

Note: In the above URL, $value refers to the Stream method.

Output Screen:


After Execution of above URL:

Display the Adobe form in the PDF format through Gateway Service (12)

Downloaded Adobe Form:


Display the Adobe form in the PDF format through Gateway Service (13)

Conclusion:

By following above steps we can download or view the adobe form through the Gate way Service or we can download the smart form also but there is a small difference between these two. The difference is function modules what ever we are using in the DPC_EXT class but the remaining Steps are same.

Hope this is useful.

Thanks in Advance !!

Display the Adobe form in the PDF format through Gateway Service (2024)

FAQs

How to view Adobe forms in SAP? ›

Procedure
  1. In the SAP system, call transaction SA38 and run program FP_CHK_REPORT. ...
  2. Under Form, enter the name of the form template to be checked. ...
  3. Under Activity, specify whether the system is to execute just the check or also an update.
  4. Under ADS Connection, specify the RFC connection to Adobe Document Services.

What are Adobe Document Services in SAP? ›

Adobe Document Services (ADS) enable form-based processing of business data triggered by both ABAP- and Java-based applications. As ADS are running on an AS Java, the basic configuration differs dependent of the development environment, that needs to communicate with ADS.

What is the Adobe form in SAP ABAP? ›

Adobe Forms reads the associated master and transaction data from the SAP system. The application then displays the data in the desired and predefined form, for example, as a print form. It is also possible to enter data in forms. SAP Interactive Forms by Adobe is the successor to SAPscript and SmartForms.

How to transport adobe forms in SAP ABAP? ›

sfp t-code -> open the form -> Translation -> PDFA(double click) -> Maintain translation in target language. You have save and activate the adobe forms after translation done and save it in one TR. This is the way to transport the translation to other system.

Top Articles
Latest Posts
Article information

Author: Clemencia Bogisich Ret

Last Updated:

Views: 6391

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Clemencia Bogisich Ret

Birthday: 2001-07-17

Address: Suite 794 53887 Geri Spring, West Cristentown, KY 54855

Phone: +5934435460663

Job: Central Hospitality Director

Hobby: Yoga, Electronics, Rafting, Lockpicking, Inline skating, Puzzles, scrapbook

Introduction: My name is Clemencia Bogisich Ret, I am a super, outstanding, graceful, friendly, vast, comfortable, agreeable person who loves writing and wants to share my knowledge and understanding with you.