steps to create a simple sap adobe form

Upload: kishore-reddy

Post on 04-Apr-2018

230 views

Category:

Documents


1 download

TRANSCRIPT

  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    1/12

    http://www.saptraininghq.com/steps-to-create-a-simple-

    sap-adobe-form-and-calling-it-in-a-web-dynpro-abap-

    application

    Steps To Create A Simple SAP ADOBE FormAnd Calling It In A Web Dynpro ABAPApplicationIn this step by step guide we will create a simple SAP Adobe Form showing employee

    address and then call this form in our Web Dynpro ABAP Application. To develop SAP

    Adobe forms you will require the Adobe Life Cycle Designer installed in your system and

    Adobe Document Services (ADS) installed and configured on the server.

    Step 1. Creating The Form Interface

    Go to transaction code SFP. Select the radio button Interface, give a name to your interface

    and click on the create button.

    In the Create Interface pop-up give a description and then click on the Save button.

    http://www.saptraininghq.com/steps-to-create-a-simple-sap-adobe-form-and-calling-it-in-a-web-dynpro-abap-applicationhttp://www.saptraininghq.com/steps-to-create-a-simple-sap-adobe-form-and-calling-it-in-a-web-dynpro-abap-applicationhttp://www.saptraininghq.com/steps-to-create-a-simple-sap-adobe-form-and-calling-it-in-a-web-dynpro-abap-applicationhttp://www.saptraininghq.com/steps-to-create-a-simple-sap-adobe-form-and-calling-it-in-a-web-dynpro-abap-applicationhttp://www.saptraininghq.com/steps-to-create-a-simple-sap-adobe-form-and-calling-it-in-a-web-dynpro-abap-applicationhttp://www.saptraininghq.com/steps-to-create-a-simple-sap-adobe-form-and-calling-it-in-a-web-dynpro-abap-application
  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    2/12

    Provide the Transport package and the transport request details.

    Double click on the import parameter of the form interface and create a new import

    parameter PERNR of type PERNR-PERNR.

    Similarly, double click on the Global Data in the Global Definitions and create a new

    variable PA0006 of type PA0006.

    Now, double click on the Code Initialization in Initializations, specify PERNR as an import

    parameter, PA0006 as and output parameter and copy and paste the following code lines to

    read the permanent address of an employee from infotype 0006.

    http://www.saptraininghq.com/wp-content/uploads/2012/10/3.png
  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    3/12

    DATA :lt_p0006 TYPE TABLE OF pa0006 .

    REFRESH lt_p0006.

    CALL FUNCTION 'HR_READ_INFOTYPE'

    EXPORTING

    tclas = 'A'

    pernr = pernr

    infty = '0002'

    begda = '18000101'

    endda = '99991231'

    TABLES

    infty_tab = lt_p0006

    EXCEPTIONS

    infty_not_found = 1

    OTHERS = 2.

    IF sy-subrc 0.

    * MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    READ TABLE lt_p0006 INTO pa0006 WITH KEY subty = '2' .

    Save and activate your Form Interface.

    http://www.saptraininghq.com/wp-content/uploads/2012/10/5.png
  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    4/12

    Step 2. Creating And Designing The Form

    Come back to the main screen of the transaction SFP, select the radio button Form, give

    your form a name and click on the create button.

    In the Create Form pop-up box enter a description and the interface name created in Step 1,

    then click on the save button.

    Provide the Transport package and the transport request details.

    Now drag and drop the structure PA0006 of Global Data from the Interface in the left hand

    side to Context window on the right-hand side.

  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    5/12

    Click on the tab Layout tab to go to the Form Builder.

    Drag and drop all required fields from the Data View to the Body Pages, and set the field

    properties as per your requirement.

    http://www.saptraininghq.com/wp-content/uploads/2012/10/10.pnghttp://www.saptraininghq.com/wp-content/uploads/2012/10/8.png
  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    6/12

    Save and activate your form.

    Step 3. Creating Web Dynpro Application.

    Go to Transaction SE80, choose Web-Dynpro-Comp./Intfin the object list and provide a

    new name (Y_WDA_ADOBE_FORM) and press enter key.

    In the create objectpop-up click on the Yes button to create a new Web Dynpro

    Application. Enter the description and choose the Type radio button as Web Dynpro

    Component.

    Provide the Transport package and the transport request details.

    Double click on the MAIN view and select the Context tab and create a new context attribute

    with name PERNR and type as PERNR-PERNR.

    http://www.saptraininghq.com/wp-content/uploads/2012/10/12.png
  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    7/12

    Now go to the Layout tab and insert a new Label UI, an Input field UI and a Button UI

    element in the ROOTELEMENTCONTAINER.

    Bind the Input field UI elements value property with the context attribute PERNR.

    http://www.saptraininghq.com/wp-content/uploads/2012/10/14.pnghttp://www.saptraininghq.com/wp-content/uploads/2012/10/13.png
  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    8/12

  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    9/12

    lv_mesg TYPE string,

    gs_fpoutparams TYPE sfpoutputparams.

    * get element via lead selection

    lo_el_context = wd_context->get_element( ).

    * get single attribute

    lo_el_context->get_attribute(

    EXPORTING

    name = `PERNR`

    IMPORTING

    value = lv_PERNR ).

    gs_fpoutparams-nodialog = 'X'. " suppress printer dialog popup

    gs_fpoutparams-getpdf = 'X'.

    * gs_fpoutparams-getxml = 'X'.CALL FUNCTION 'FP_JOB_OPEN'

    CHANGING

    ie_outputparams = gs_fpoutparams

    EXCEPTIONS

    cancel = 1

    usage_error = 2

    system_error = 3

    internal_error = 4

    OTHERS = 5.

    IF sy-subrc 0.

    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    TRY.

    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'

    EXPORTING

    i_name = 'Y_FORM'IMPORTING

    e_funcname = gv_fmname.

    CATCH cx_root INTO lv_w_cx_root.

    lv_mesg = lv_w_cx_root->get_text( ).

    * MESSAGE e201(hrpadin01) WITH lv_formname3 lv_mesg.

    ENDTRY.

  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    10/12

    CALL FUNCTION gv_fmname

    EXPORTING

    pernr = lv_pernr

    IMPORTING

    /1bcdwb/formoutput = formoutput.

    IF sy-subrc 0.

    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL FUNCTION 'FP_JOB_CLOSE'

    * IMPORTING

    * E_RESULT =

    EXCEPTIONSusage_error = 1

    system_error = 2

    internal_error = 3

    OTHERS = 4.

    cl_wd_runtime_services=>attach_file_to_response( i_filename = 'SAP_ADOBE_FORM.pdf'

    i_content = formoutput-pdf

    i_mime_type = 'application/pdf' ).

    endmethod.

    Create the Web Dynpro Application by right clicking the Web Dynpro Component. Give

    your application a name and description.

    http://www.saptraininghq.com/wp-content/uploads/2012/10/17.png
  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    11/12

    Save and activate your Web Dynpro Application.

    The Final Output

    Right click on the Web Dynpro application and click on Test to test your application in the

    web browser.

    http://www.saptraininghq.com/wp-content/uploads/2012/10/19.pnghttp://www.saptraininghq.com/wp-content/uploads/2012/10/18.png
  • 7/30/2019 Steps to Create a Simple SAP ADOBE Form

    12/12

    Closing Notes:

    You can also call the Adobe Form in Web Dynpro Application by using the UI element

    Interactive-Form. But, it is a good idea to design your ADOBE form separately in

    transaction code SPF as shown in this tutorial. This way you can also call the same form in

    reports and other applications too.

    Also, instead of opening the Adobe form in the web browser, we have used the

    methodattach_file_to_response( ) of class cl_wd_runtime_services to open the

    ADOBE form via download pop-up, this is also a good way because many a times users have

    performance issues when showing the form in the web browser.

    http://www.saptraininghq.com/wp-content/uploads/2012/10/21.png