Monday, April 7, 2014

SAP ADOBE Forms is part of SAP Web Application Server. 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: Create the Form Interface

  • Go to transaction SFP(Form Builder).
  • Create Interface(ZOVH_INTERFACE) by selecting Interface radio button.
  • Provide interface Description and Select ABAP Dictionary-Based Interface as Interface Type.
  • Save as Local object or transportable object.
  • Interface TabàImportàCreate three importing parameters(PERNR, ENAME, BUKRS). 

  • Save and Activate.

Step 2: Create and Design the Form

  • Go to transaction SFP(Form Builder).
  • Create Form(ZOVH_SIMPLE_FORM) by selecting Form radio button.
  • Provide form Description and provide Interface as ZOVH_INTERFACE created in the above step.
  • Save as Local object or transportable object.
  • Context TabàOpen Import nodeàSelect all importing parameters(PERNR, ENAME, BUKRS) by holding CTRL key, drag and drop parameters from Interface area to Context area as shown in the screen shot.

  • Layout TabàClick on Layout button. You can view form designer in larger. 

  • Click on Data View tab on the form. Drag parameter(PERNR, ENAME and BUKRS) and drop on to the form. By doing this binding will take place automatically. 



  • Save and Activate. When you activate, system generate function module.

Step 3: Create ABAP Driver program to call Form

  • Go to transaction SE38(ABAP Editor) and create an executable program ZTEST_SIMPLE_ADOBE.
  • Save as Local object or transportable object.
  • Program steps
    • Get the function module of generated Form using FP_FUNCTION_MODULE_NAME.
    • Open the spool job using function module FP_JOB_OPEN.
    • Call the generated function module.
    • Close the spool using function module FP_JOB_CLOSE.
  • Program code
    REPORT ztest_simple_adobe.
    *&--------------------------------------------------------------------&
    *  Declarations
    *&--------------------------------------------------------------------&
    TYPES:
          ty_outputparams TYPE sfpoutputparams, "Form Parameters for Form Processing
          ty_docparams    TYPE sfpdocparams.    "Form Processing Output Parameter
    DATA:
          wa_outputparams TYPE sfpoutputparams,
          wa_docparams    TYPE sfpdocparams.
    DATA:
          gv_fm_name      TYPE rs38l_fnam,
          gv_pernr        TYPE pa0001-pernr,
          gv_ename        TYPE pa0001-ename,
          gv_bukrs        TYPE pa0001-bukrs.
    *&--------------------------------------------------------------------&
    *  Selection-Screen
    *&--------------------------------------------------------------------&
    PARAMETERS:
          p_pernr       TYPE pa0001-pernr.
    
    
    *&--------------------------------------------------------------------&
    *  Start-Of-Selection
    *&--------------------------------------------------------------------&
    START-OF-SELECTION.
    
      " Sets the output parameters and opens the spool job
      wa_outputparams-device    =  'PRINTER'.
      wa_outputparams-dest      =  'LP01'.
      wa_outputparams-NODIALOG  = 'X'.
      wa_outputparams-preview   = 'X'.
    
      CALL FUNCTION 'FP_JOB_OPEN'
        CHANGING
          ie_outputparams = wa_outputparams
        EXCEPTIONS
          cancel          = 1
          usage_error     = 2
          system_error    = 3
          internal_error  = 4
          OTHERS          = 5.
      IF sy-subrc <> 0.
        " <error handling>
      ENDIF.
      " Get the name of the generated function module
      CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
        EXPORTING
          i_name     = 'ZOVH_SIMPLE_FORM'
        IMPORTING
          e_funcname = gv_fm_name.
      IF sy-subrc <> 0.
        "<error handling>
      ENDIF.
    
      wa_docparams-langu   = 'E'.
      wa_docparams-country = 'SG'.
    
      " Fetch the Data and store it in the Internal Table
      SELECT SINGLE pernr ename bukrs
        FROM pa0001
        INTO (gv_pernr, gv_ename, gv_bukrs)
        WHERE pernr EQ p_pernr.
    
      CALL FUNCTION gv_fm_name
        EXPORTING
          pernr          = gv_pernr
          ename          = gv_ename
          bukrs          = gv_bukrs
        EXCEPTIONS
          usage_error    = 1
          system_error   = 2
          internal_error = 3.
    
      " Close the spool job
      CALL FUNCTION 'FP_JOB_CLOSE'
        EXCEPTIONS
          usage_error    = 1
          system_error   = 2
          internal_error = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
        " <error handling>
      ENDIF.
    

Step 4: Execute driver program 

  • Execute the program ZTEST_SIMPLE_ADOBE.
  • Selection Screen.
  • Output

3 comments:

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.