Tuesday, April 15, 2014
In this tutorial we create simple Adobe Form showing Employee details and then calling this form in Web Dynpro ABAP application.
Step 1: Create the Form Interface
Check Simple ADOBE Form and calling it from ABAP Program for Step 1 & Step 2.
Tutorial Steps
Step 1: Create the Form Interface
Step 2: Create and Design the Form
Check Simple ADOBE Form and calling it from ABAP Program for Step 1 & Step 2. Step 3: Creating Web Dynpro ABAP Component
- Create Web Dynpro Component(ZOVH_WD_ADOBE) with window name W_WINDOW with default iview V_VIEW.
- Save as local object or transportable object.
- Double click on V_VIEW->Context tab: Define one attribute ADOBE_FORM(of type XSTRING) for the PDF that comes from Adobe forms.
- Layout tab: Insert screen element ADOBE_FORM(of type InteractiveForm) to display Adobe form in PDF format.
- Goto ADOBE_FORM element properties->Bind PdfSource property with ADOBE_FORM attribute for Context.
- Methods tab->WDDOMODIFYVIEW method. Here we write code to get the PDF format of ADOBE form.
- Get the function module of generated Form using FP_FUNCTION_MODULE_NAME. Set GETPDF to 'X'
- Open the spool job using function module FP_JOB_OPEN.
- Call the generated function module. Get PDF data
- Close the spool using function module FP_JOB_CLOSE.
- Pass PDF to Context attribute for PDF.
- Code
METHOD wddomodifyview . TYPES: ty_outputparams TYPE sfpoutputparams, "Form Parameters for Form Processing ty_docparams TYPE sfpdocparams, "Form Processing Output Parameter ty_fpformoutput TYPE fpformoutput. DATA: wa_outputparams TYPE ty_outputparams, wa_docparams TYPE ty_docparams, wa_fpformoutput TYPE ty_fpformoutput. DATA: gv_fm_name TYPE rs38l_fnam, gv_pernr TYPE pa0001-pernr, gv_ename TYPE pa0001-ename, gv_bukrs TYPE pa0001-bukrs. DATA lo_el_context TYPE REF TO if_wd_context_element. DATA ls_context TYPE wd_this->element_context. DATA lv_adobe_form TYPE wd_this->element_context-adobe_form. DATA: c_pernr TYPE pernr_d VALUE '10008289'. " 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'. wa_outputparams-getpdf = '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 c_pernr. CALL FUNCTION gv_fm_name EXPORTING pernr = gv_pernr ename = gv_ename bukrs = gv_bukrs IMPORTING /1bcdwb/formoutput = wa_fpformoutput EXCEPTIONS usage_error = 1 system_error = 2 internal_error = 3. lv_adobe_form = wa_fpformoutput-pdf. " 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. * get element via lead selection lo_el_context = wd_context->get_element( ). * set single attribute lo_el_context->set_attribute( name = `ADOBE_FORM` value = lv_adobe_form ). ENDMETHOD.
Step 4: Creating Web Dynpro ABAP Application
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.