Disply SmartForm in webdynpro

Hi,
We have few smart forms which need to be displayed in webdynpro. Apartfrom developing Adobe Interactive forms for the existinng smartforms is there any other way to bring the smartform in to the webdynpro application?
Thanks and Regards,
Abdul raheem .S

Hi abdul
  Well you can use this code as a RFC.
Function in ABAP.
function zpdf_demo.
*"*"Local interface:
*"  IMPORTING
*"     VALUE(IM_SF_DEMO) TYPE  SSFSCREEN-FNAME DEFAULT
*"       'PDF_DEMO'
*"  EXPORTING
*"     VALUE(LV_SIZE) TYPE  I
*"     VALUE(BIN_FILE) TYPE  XSTRING
*"  TABLES
*"      ET_PDF STRUCTURE  TLINE OPTIONAL
  data : out_opt type ssfcompop, ctrl type ssfctrlop, out_info type
ssfcrescl.
  data: function_name     type rs38l_fnam.
  out_opt-tdnoprev = 'X'.
  out_opt-tddest = 'WIND'.
*NO_OPEN
*NO_CLOSE
*DEVICE
  ctrl-no_dialog = 'X'.
  ctrl-preview   = ' '.
  ctrl-getotf    = 'X'.
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting
            formname           = im_sf_demo
*         VARIANT            = ' '
*         DIRECT_CALL        = ' '
       importing
            fm_name            = function_name
       exceptions
            no_form            = 1
            no_function_module = 2
            others             = 3.
* call function to process smart form
  call function function_name
       exporting
*           archive_index        = is_archive_index
           control_parameters   = ctrl
           output_options       = out_opt
      importing
           job_output_info      = out_info
*           job_output_options   = es_job_output_options
      exceptions
           output_canceled      = 1
           parameter_error      = 2
           others               = 3
  call function 'CONVERT_OTF'
   exporting
     format                      = 'PDF'
*   MAX_LINEWIDTH               = 132
*   ARCHIVE_INDEX               = ' '
*   COPYNUMBER                  = 0
*   ASCII_BIDI_VIS2LOG          = ' '
importing
   bin_filesize                = lv_size
   bin_file                    = bin_file
    tables
      otf                         = out_info-otfdata
      lines                       = et_pdf
exceptions
   err_max_linewidth           = 1
   err_format                  = 2
   err_conv_not_possible       = 3
   err_bad_otf                 = 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.
endfunction.
Here is the relevant thing that you need to do in WebDynpro. Create a button and in the action for the button write the following code.
The RFC export parameter BIN_FILE will give you the content as a byte array.
//Code written in onActionClick of Button ui element
byte[] pdfContent= wdContext.currentZPDF_Demo().getBin_file();                             
IWDCachedWebResource pdfResource=WDWebResource.getWebResource                  
     (pdfContent,WDWebResourceType.PDF);                                        
wdComponentAPI.getWindowManager().createExternalWindow(                        
      pdfResource.getURL(),"Report View",true).open();
Well that will display the output in PDF on the Webpage when you click the button.
Hope that was helpful.
regards
ravi

Similar Messages

  • Smartforms in Webdynpro Abap

    Hi Experts,
    I am having smartform using this smartform i need to use in Webdynpro Abap.Can any one tell how to use is there any example component using smartform in webdynpro Abap.

    Hello Durga,
    you want to display the smart form in WDA or do you want to just get the output of the smartform and display it in PDF.
    for the first case you need to use Interactive forms and for the second case you need to simply call the FM generated for the smart form and display th output in PDF
    check this thread
    smart forms in web dynpro abap
    BR, Saravanan

  • Problem while calling smartform in webdynpro

    Hi Experts,
    I  am calling a smartform in webdynpro abap. It was working fine in development server. I have ported the same request to Quality Server, there it was not working.it is giving sy-subrc = 1 and it is displaying a blank screen
    I m following the following steps for calling smartform in webdynrpo.
    I am calling the smartform by
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM_NAME'
    importing
    fm_name = fname
    exceptions
    no_form = 1
    no_function_module = 2
    others = 3
    if sy-subrc  0.
    Error MESSAGE
    endif.
    call function fname
    exporting
    control_parameters = lv_control_parameters
    output_options = lv_output_options
    user_settings = space
    pernr = stru_input1-zpernr
    reinr = stru_input1-zreinr
    pdvrs = stru_input1-zpdvrs
    importing
    job_output_info = lv_ssf_output
    exceptions
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 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.
    But it is not passing otfdata and it is returning 1 in sy-subrc.
    Please help me to solve this issue.

    I m not using any image.
    I have checked through debug and the function module is not transfering any file to OTF table.
    Please suggest me..
    Edited by: zakirriyaz on Nov 4, 2011 9:47 AM

  • Can i Use Smartforms in Webdynpro? If so how ?

    Can i Use Smartforms in Webdynpro? If so how ? Sample Codes are Welcome..

    Hai Sai,
    U can convert the smart form into PDF format and use it.
    U can the check the below URL and understand it perfectly:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785">Smartform as pdf in webdynpro for abap</a>

  • Smartform & ABAP Webdynpro & Internal table

    Hi Expert,
    I am able to open the smartfrom by using ABAP Webdynpro.
    But when I try to add the table under "Global Settings -> From Interface -> Table"
    Paramemter Name       Type Assignment    Associated Type
    I_ZSG_PAY_DATA     Like                          ZSG_PAY_DATA
    It works fine when I test it in t-code SMARTFORMS. But when I use the same ABAP Webdynpro program to open this smartform, the error appear.
    "Calling Parameter incorrect"
    Could you please let me know how to fix it?
    Thanks a lot,
    WF

    Hi William,
    If you have a working smartform then you should be able to display it in WD by passign its XSTRING to the PDFSOURCE of it.
    Just check that where you have written the code to get the XSTRING of smartform in WD. You might have modified the smartform interface and forgot to call the revised FM generated after the smartform was changed in WD.
    Just re-write the entire code to generate XSTRING for smartform and see if it works or not.
    You can also try to put a break point in the code and see where exactly it is failing i.e. whether it is to do with calling smartform or converting it or WD related.
    Thanks,
    Abhishek

  • Call smartform from webdynpro

    Hi everybody
    Can you plesae tell me whether its possible to call a smartform from a webdynpro application?
    I know its possible to call adobe forms

    HI,
    You have to use the FM to convert to PDF then use this data and bind this to the node type XSTRING.
    Check components WDR_TEST_ADOBE_PDF_ONLY or WDR_TEST_ADOBE for reference.
    Regards,
    Lekha.

  • Displaying Smartforms in Webdynpro ABAP

    Hi All,
    I have to display smartforms in WDA. For that I'm using following link.
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785?quicklink=index&overridelayout=true]
    Now, in my case --
    Form Name - 'ZFORM'
    Importing Field - 'VBELN'
    But, my problem is I'm unable to understand some of the fields, used in Tutorial in the link above, which are --
    element_zinput
    pernr = stru_input1-zpernr
    reinr = stru_input1-zreinr
    pdvrs = stru_input1-zpdvrs
    I can understand that these must be user-defined. But, it has not defined in tutorial and hence, I'm confused.
    Can anyone tell me what are these fields and from where are these coming?
    Thakns.
    Kumar Saurav.

    hi:Thomas
         I have a requirement which smartform convert to pdf in web dynpro for abap ,But garbled for the Chinese.why is this?
        my code:
    method ONACTIONPDF2 .
    DATA FM_NAME TYPE RS38L_FNAM.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    FORMNAME                 = 'ZTEST_WDA'
    IMPORTING
    FM_NAME                  = FM_NAME
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DATA: JOB_OUPUT TYPE SSFCRESCL,
    LT_OTFDATA TYPE TABLE OF ITCOO.
    DATA: LA_CTRL_FORM TYPE SSFCTRLOP,
    LA_OUTPUT_OPT TYPE SSFCOMPOP.
    ** Spool Parameters
    *LA_OUTPUT_OPT-TDIMMED = 'X'.
    *LA_OUTPUT_OPT-TDDELETE = 'X'.
    *LA_OUTPUT_OPT-TDLIFETIME = 'X'.
    *LA_OUTPUT_OPT-TDDEST = 'LOCL'.
    * Parameters passes to get the output in PDF format
    LA_CTRL_FORM-NO_DIALOG = 'X'.
    *LA_CTRL_FORM-PREVIEW = 'X'.
    LA_CTRL_FORM-GETOTF = 'X'.
    LA_CTRL_FORM-LANGU = '1'.
    *LA_CTRL_FORM-DEVICE = 'PRINTER'.
      LA_OUTPUT_OPT-tdprinter = 'PDF1'.
    CALL FUNCTION FM_NAME
    EXPORTING
    CONTROL_PARAMETERS         =  LA_CTRL_FORM
    OUTPUT_OPTIONS             = LA_OUTPUT_OPT
    IMPORTING
    JOB_OUTPUT_INFO            = JOB_OUPUT
    EXCEPTIONS
    FORMATTING_ERROR           = 1
    INTERNAL_ERROR             = 2
    SEND_ERROR                 = 3
    USER_CANCELED              = 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.
    REFRESH LT_OTFDATA.
    LT_OTFDATA[] = JOB_OUPUT-OTFDATA[].
    CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
    EXPORTING
    I_OTF                    = LT_OTFDATA
    EXCEPTIONS
    CONVERT_OTF_TO_PDF_ERROR = 1
    CNTL_ERROR               = 2
    OTHERS                   = 3.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DATA: L_DUMMY TYPE STANDARD TABLE OF TLINE,
    PDF_DATA TYPE XSTRING,
    PDF_SIZE TYPE I.
    CLEAR: PDF_DATA, PDF_SIZE.
    * convert otf to pdf
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT                = 'PDF'
    MAX_LINEWIDTH         = 255
    IMPORTING
    BIN_FILESIZE          = PDF_SIZE
    BIN_FILE              = PDF_DATA
    TABLES
    OTF                   = LT_OTFDATA[]
    LINES                 = L_DUMMY
    EXCEPTIONS
    ERR_MAX_LINEWIDTH     = 1
    ERR_FORMAT            = 2
    ERR_CONV_NOT_POSSIBLE = 3
    OTHERS                = 4.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(
    *    *path to the word file
    I_FILENAME = 'WDA_SMARTFORMS.pdf'
    *     String Variable
    I_CONTENT =  PDF_DATA
    *     File Type
    I_MIME_TYPE = 'PDF' ).
    endmethod.
    image1 for smartforms
    image2 for pdf

  • Smartforms in Webdynpro - but no license for adobe

    Hi All.
    We want to embed the smartform in our web dynpro applications. I read some posts here that we can do that by doing some conversions, and emdedding it into the adobe UI element.
    I just want to know that we do not have license for Adobe interactive. So for doing this type of thing also, do we need a license? We are not using any interactive feature. So do we still need a license for it?
    Another thing: How can we print our smartform if the user does not have SAPGUI installed?
    Thanks in adv.

    Hi swetha,
    You must need licence to adobe live cycle designer to run interactive forms.Actualy we will not show directly any smartform output to enduser.We will call the smartform inside the Web Dynpro application and we will convert it to PDF to show the output.
    Check this Article for your reference
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785

  • Smartforms and webdynpro ABAP

    Hi
    I want to download a smartform to PDF file.
    Can anyone post the code please from calling the FM of smartforms to the call of 
    cl_wd_runtime_services=>attach_file_to_response
    Best regards

    I'm sharing my code to call smartforms and pass value through internal table. Enjoy guys.
      DATA lt_c_et_result TYPE STANDARD TABLE OF WD_THIS->Element_et_result .
      DATA wa_et_result LIKE LINE OF lt_c_et_result .
      DATA lo_nd_et_result TYPE REF TO if_wd_context_node.
      DATA lo_el_et_result TYPE REF TO if_wd_context_element.
      DATA ls_et_result TYPE wd_this->element_et_result.
    *   navigate from <CONTEXT> to <ET_RESULT> via lead selection
      lo_nd_et_result = wd_context->get_child_node( name = wd_this->wdctx_et_result ).
    *   @TODO handle not set lead selection
      IF lo_nd_et_result IS INITIAL.
      ENDIF.
      lo_nd_et_result->get_static_attributes_table(
        IMPORTING
          table = lt_c_et_result ).
      DATA it_sfaktviti TYPE TABLE OF ZPM_AKTIVITI_STRUC.
      DATA wa_sfaktviti  LIKE LINE OF it_sfaktviti.
      LOOP AT lt_c_et_result INTO  wa_et_result.
        MOVE-CORRESPONDING wa_et_result TO wa_sfaktviti .
    *      MODIFy it_sf_et_result FROM wa .
    *      APPEND wa_sf_result TO it_sf_et_result.
        APPEND wa_sfaktviti  TO it_sfaktviti.
      ENDLOOP.
      DATA: l_pdfstring TYPE xstring.
      DATA: lv_buffer TYPE xstring.
      DATA: lv_string TYPE string.
      DATA: lv_fnam  TYPE rs38l-NAME.
      DATA: lv_bytecount TYPE i.
      DATA: l_xline TYPE xstring.
      DATA: lt_lines TYPE TABLE OF tline,
            ls_line TYPE tline.
      DATA: ls_ssfctrlop TYPE ssfctrlop,
            ls_output_options TYPE ssfcompop,
            ls_job_output_info TYPE ssfcrescl,
            ls_job_output_options TYPE ssfcresop.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = 'ZPM_KERJA'
    *   VARIANT                  = ' '
    *   DIRECT_CALL              = ' '
       IMPORTING
         FM_NAME                  = lv_fnam
    * EXCEPTIONS
    *   NO_FORM                  = 1
    *   NO_FUNCTION_MODULE       = 2
    *   OTHERS                   = 3
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ls_ssfctrlop-no_dialog = 'X'.
      ls_ssfctrlop-getotf = 'X'.
      ls_ssfctrlop-preview = 'X'.
      " Call smartforms
      call function lv_fnam
        EXPORTING
          control_parameters = ls_ssfctrlop
          output_options     = ls_output_options
        IMPORTING
          job_output_info    = ls_job_output_info
          job_output_options = ls_job_output_options
        TABLES
          IT_Aktiviti        = lt_c_et_result
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          others             = 5.
      " Convert to PDF
      call function 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
        IMPORTING
          bin_filesize          = lv_bytecount
        TABLES
          otf                   = ls_job_output_info-otfdata
          lines                 = lt_lines
        EXCEPTIONS
          err_conv_not_possible = 1
          err_bad_otf           = 2.
      loop at lt_lines into ls_line. "into l_line.
        lv_string = ls_line.
        export my_data = lv_string to data buffer lv_buffer.
        import my_data to l_xline from data buffer lv_buffer in char-to-hex mode.
        concatenate l_pdfstring l_xline into l_pdfstring in byte mode.
      endloop.
    *  p_pdf = l_pdfstring.
      " Call print
      cl_wd_runtime_services=>attach_file_to_response(
      i_filename = 'AktivitiKerja.pdf'
      i_content = l_pdfstring
      i_mime_type = 'application/pdf'
      i_in_new_window = abap_false
      i_inplace = abap_false ).

  • Calling a smartform from a webdynpro component

    hi,
    I am working with E-REC project and I am using ERC_C_WORKCENTER_UI which is the main component, while clicking on the link ''My planned activities'' it displays teble with candidate name link, while I click this particular link it should display details in a smartform and not in an application. Is there any way to do this modifying this standard component or any other way? can anyone help finding a solution for this.......
    regards,
    Hamsapriya

    Hi Kruthik,
    You have to use SSF_FUNCTION_MODULE_NAME   FM to call Smartform.
    and have to call another FM - CONVERT_OTF.
    Please go through this example..
    http://abapcodexperiments.wordpress.com/2011/03/20/smartform-pdf-webdynpro-abap/
    also check..
    Displaying Smartforms in Webdynpro ABAP
    Call smartform in web dynpro abap
    Cheers,
    Kris.

  • How to Retrive data from db using EJB in WebDynpro

    hi...
    i m using EJB's for backend connection in WebDynpro .in which i m able to store data in sapdb .for this i followed one tutorial which i have mentioned bellow which works perfectly.Now in the same Tutorial i want to retrive the data from database and disply it in WebDynpro
    i .e i want to disply bonus when i give ssn no and also i want to disply all data in db.
    Please help me as i m totaly new to this environment and also first time i m working on EJB.its very urgent
    Thanks and Regards
    Sonal<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c</a>

    hi...
    i m using EJB's for backend connection in WebDynpro .in which i m able to store data in sapdb .for this i followed one tutorial which i have mentioned bellow which works perfectly.Now in the same Tutorial i want to retrive the data from database and disply it in WebDynpro
    i .e i want to disply bonus when i give ssn no and also i want to disply all data in db.
    Please help me as i m totaly new to this environment and also first time i m working on EJB.its very urgent
    Thanks and Regards
    Sonal<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c</a>

  • Getting error in dispaling smartform

    Hi ,
    I have an application where the below BAPI is displaying the smartform in ABAP webdynpro.
    The output is taken from a TLINE table which consists of the special characters.
    The requirement is to display this smartform from Webdynpro Java but the output is not correctly displayed in WD java because WD Java is not able to handle the special characters.
                    *********************BAPI**************************
    FUNCTION information_details
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(SPOOLNO) TYPE  ZSMART-SPOOL_ID OPTIONAL
    *"  EXPORTING
    *"     VALUE(RETURN) TYPE  BAPIRETURN
    *"  TABLES
    *"      PDFDATA STRUCTURE  TLINE OPTIONAL
      DATA: v_spoolid TYPE tsp01-rqident.
           vspool(10) VALUE '4904'.
      DATA otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
      DATA cancel.
      DATA pdf LIKE tline OCCURS 100 WITH HEADER LINE.
      DATA doctab LIKE docs OCCURS 1 WITH HEADER LINE.
      DATA: numbytes TYPE i,
            arc_idx LIKE toa_dara,
            pdfspoolid LIKE tsp01-rqident,
            jobname LIKE tbtcjob-jobname,
            jobcount LIKE tbtcjob-jobcount.
      spoolno = '4904'.
      v_spoolid = spoolno.
    *SPOOLNO = 4904.
      CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
              EXPORTING
                src_spoolid                    = v_spoolid
           NO_DIALOG                      = 'X'
          DST_DEVICE                     =
               pdf_destination                = 'C:\File.pdf'
              IMPORTING
                pdf_bytecount                  = numbytes
                pdf_spoolid                    = pdfspoolid
          OTF_PAGECOUNT                  =
                btc_jobname                    = jobname
                btc_jobcount                   = jobcount
              TABLES
                pdf                            = pdfdata[]
              EXCEPTIONS
                err_no_otf_spooljob            = 1
                err_no_spooljob                = 2
                err_no_permission              = 3
                err_conv_not_possible          = 4
                err_bad_dstdevice              = 5
                user_cancelled                 = 6
                err_spoolerror                 = 7
                err_temseerror                 = 8
                err_btcjob_open_failed         = 9
                err_btcjob_submit_failed       = 10
                err_btcjob_close_failed        = 11.
    ENDFUNCTION.
    Can anyone please let me know the approach to solve this error??
    Thanks in advance..

    Hi ,
    I am getting the pdf data in pdf[] .
    Can anyone please let me know how to display this data( for displaying the smartform)  in webdynpro java.
    Regards
    Rahul

  • Regarding webdynpro

    hi all,
         I want to know can we call smartform in webdynpro.
        If possible can any body give me the procedure how we can do it.
    Thanks And Regards,
    Sreelatha Gullapalli

    Sure you can call a smartform in WebDynpro (ABAP):
    This is the procedure:
    1. Create your smartform (if not already available).
    2. Create a view in which smartform should be displayed.
    3. Insert interactive form UI element for smartform to be displayed in.
    4. In method WDDOINIT (for example), retrieve the FM for the smartform.
    5. Call function module for smartform (set control parameter getotf to 'X' and no_dialog also to 'X'. Set device type).
    6. In import parameter job_output_info-otfdata the pdf is contained.
    7. call FM CONVERT_OTF to convert to pdf format.
    8. Now the bin_file will be returned (import parameter).
    9. Use this data to set the attribute of the smartform UI element.
    Example coding:
    METHOD wddoinit.
      DATA:
        node_diamond_data   TYPE REF TO if_wd_context_node,
        elem_diamond_data   TYPE REF TO if_wd_context_element,
        stru_diamond_data   TYPE if_smartform_view=>element_diamond_data,
        tab_diamond_data    TYPE if_smartform_view=>elements_diamond_data.
      DATA:
        node_remarks         TYPE REF TO if_wd_context_node,
        elem_remarks         TYPE REF TO if_wd_context_element,
        stru_remarks         TYPE if_smartform_view=>element_remarks ,
        item_remarks_text    LIKE stru_remarks-remarks_text.
      DATA:
        node_smartform_pdf   TYPE REF TO if_wd_context_node,
        elem_smartform_pdf   TYPE REF TO if_wd_context_element,
        stru_smartform_pdf   TYPE if_smartform_view=>element_smartform_pdf ,
        item_stones_data     LIKE stru_smartform_pdf-stones_data.
      DATA:
        lt_diamonds          TYPE zpo_ssp_list_t,
        lt_lines             TYPE TABLE OF tline.
      DATA:
        ls_output_options      TYPE ssfcompop,
        ls_control_parameters  TYPE ssfctrlop,
        ls_output_data         TYPE ssfcrescl.
      DATA:
        lv_form_name            TYPE tdsfname  VALUE 'ZMM_P_SSPS',
        lv_function_module_name TYPE rs38l_fnam,
        lv_devtype              TYPE rspoptype,
        lv_pdf_len              TYPE i,
        lv_pdf_xstring          TYPE xstring.
    * navigate from <CONTEXT> to <DIAMOND_DATA> via lead selection
      node_diamond_data =
          wd_context->get_child_node(
                    name = if_smartform_view=>wdctx_diamond_data ).
    * Retrieve diamond data from context.
      node_diamond_data->get_static_attributes_table(
          IMPORTING
             table  = tab_diamond_data ).
    * Copy Diamond data.
      lt_diamonds[] = tab_diamond_data[].
    * navigate from <CONTEXT> to <REMARKS> via lead selection
      node_remarks =
          wd_context->get_child_node(
                    name = if_smartform_view=>wdctx_remarks ).
    * get element via lead selection
      elem_remarks = node_remarks->get_element(  ).
    * get single attribute
      elem_remarks->get_attribute(
        EXPORTING
          name =  `REMARKS_TEXT`
        IMPORTING
          value = item_remarks_text ).
    * Get name of generated function module
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING  formname           = lv_form_name
    *                 variant            = ' '
    *                 direct_call        = ' '
           IMPORTING  fm_name            = lv_function_module_name
           EXCEPTIONS no_form            = 1
                      no_function_module = 2
                      OTHERS             = 3.
      IF sy-subrc <> 0.
    *   error handling
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        EXIT.
      ENDIF.
    * Setting of output options
    * language
      ls_control_parameters-langu = sy-langu.
    * set control parameters to get the output format (OTF) from Smart Forms
      ls_control_parameters-no_dialog = 'X'.
      ls_control_parameters-getotf    = 'X'.
    * get device type from language
      CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          i_language                   = sy-langu
    *     i_application                = 'SAPDEFAULT'
        IMPORTING
          e_devtype                    = lv_devtype
        EXCEPTIONS
          no_language                  = 1
          language_not_installed       = 2
          no_devtype_found             = 3
          system_error                 = 4
          OTHERS                       = 5.
      IF sy-subrc <> 0.
    *   error handling
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    * set device type in output options
      ls_output_options-tdprinter = lv_devtype.
      CALL FUNCTION lv_function_module_name
        EXPORTING
          control_parameters = ls_control_parameters
          output_options     = ls_output_options
          user_settings      = 'X'
          it_diamonds        = lt_diamonds
          iv_remarks         = item_remarks_text
        IMPORTING
          job_output_info    = ls_output_data
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 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.
    * now convert the final document (OTF format) into PDF format
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
             format                      = 'PDF'
           IMPORTING
             bin_filesize                = lv_pdf_len
             bin_file                    = lv_pdf_xstring       " binary file
           TABLES
             otf                         = ls_output_data-otfdata
             lines                       = lt_lines
           EXCEPTIONS
             err_max_linewidth           = 1
             err_format                  = 2
             err_conv_not_possible       = 3
             err_bad_otf                 = 4
             OTHERS                      = 5
      IF sy-subrc <> 0.
    *   error handling
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    * navigate from <CONTEXT> to <SMARTFORM_PDF> via lead selection
      node_smartform_pdf =
          wd_context->get_child_node(
            name = if_smartform_view=>wdctx_smartform_pdf ).
    * get element via lead selection
      elem_smartform_pdf = node_smartform_pdf->get_element(  ).
    * get single attribute
      item_stones_data = lv_pdf_xstring.
      elem_smartform_pdf->set_attribute(
        EXPORTING
          name =  `STONES_DATA`
          value = item_stones_data ).
    ENDMETHOD.

  • Calling Smartform in WD application?

    Hi,
       Is it possible to call Smartform in WD application?
    Thanks

    Yes it is. Check out the thread [Displaying Smartforms in Webdynpro ABAP   |Re: Displaying Smartforms in Webdynpro ABAP; and check the code as Vikrant Trivedi suggested.
    Also check the SAP document [How to Display a Smartform as PDF document in Web Dynpro for ABAP|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785].
    Hope it helps.

  • Calling a smart form on click of a button in web dynpro abap

    Hi experts,
    I have a requirement like if I click a button in a view i need ti generate a PDF through smart form.
    Is this possible. If so please tell me the way..
    Thanks & Regards

    Hi Sharma,
    Create Interactive form in your view, create one node say PDF_SOURCE under this one attribute PDF_SOURCE of type XSTRING.
    Bind this to IF form Datasource and pdfsource.
    in your button action write code to call your smartform
    using SSF_FUNCTION_MODULE_NAME
    using FM  CONVERT_OTF and attach_file_to_response
    *convert to pdf
      call function 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
        IMPORTING
          bin_filesize          = lv_bytecount
        TABLES
          otf                   = ls_job_output_info-otfdata
          lines                 = lt_lines
        EXCEPTIONS
          err_conv_not_possible = 1
          err_bad_otf           = 2.
      loop at lt_lines into ls_line.
        lv_string = ls_line.
        export mydata = lv_string to data buffer lv_buffer.
        import mydata to l_xline from data buffer lv_buffer in char-to-hex
        mode.
        concatenate l_pdfstring l_xline into l_pdfstring in byte mode.
      endloop.
      call method cl_wd_runtime_services=>attach_file_to_response
        EXPORTING
          i_filename      = 'ZWTY_PACKINGSLIP'
          i_content       = l_pdfstring
          i_mime_type     = 'BIN'
          i_in_new_window = abap_false
          i_inplace       = abap_false.
    also check this..
    http://abapcodexperiments.wordpress.com/2011/03/20/smartform-pdf-webdynpro-abap/
    Call smartform in web dynpro abap
    Cheers,
    Kris.

Maybe you are looking for

  • Unable to Delete Folder, Could not find this item

    Currently, I'm having problem deleting an old Folder. Previously, I used its parent as a shared folder, but one day when I tried to clear that folder there is one folder that has duplicate. The problem is one of them (the old one) can't be deleted ev

  • PDF does not deliver sometimes with Mac mail even though it shows in my sent mailbox

    Sometime when I attach a PDF I'm mail on my MacBook Pro the email delivers without the PDF even though it shows in my sent mail. This happens with 2 different mail boxes, one being pop3 and the other mail for exchange.. I had to eventually install ou

  • Enable Multi Stream ICA parameter in WAAS(5.1.1c)

    Hi all! I have questions about the settings of Multi Stream ICA(MSI) in WAAS (ver 5.1.1c). (1) Setting Parameter * Enable only the parameter "Enable Multi Stream ICA" ? * Is there other parameter for such quality of service(QoS)?   We should set the

  • MAC OS 10.5 LEOPARD?

    I will most likely be purchasing Leopard when it comes out. I am wondering if when I install it will there be an option to just update it. I have a lot of things on my computer i would not like to change, is there an option to just update the OS?

  • I bought the software through my University Bookstore how do I download the product?

    If you purchase an Adobe product through your University or another educational retailer, they may have instructed you to visit Adobe.com to download your purchased product. In this case, you can download your purchased product from our Downloads pag