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 ).

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

  • Webdynpro Java and Webdynpro ABAP

    hi all,
    Im working in webdynpro java. Im confused about WD java and WD ABAP. which one we should select for what? And now a days people are telling that SAP is coming up all business packages in WD ABAP. Is it true? Which one is better either WD Java or ABAP?
    Thanks,
    J.Smitha.

    Smitha,
    It's tough question to answer. Which one to choose either Web Dynpro java or Web Dynpro ABAP , it depends on which technology you are comfortable. In relation to the business packages SAP already provided allmost all of them in java and in the future all the Business packages also available in ABAP. It's all how you want to develop the application. In sap portal world some applciation which we can develop with ABAP Web Dynpro and some applications with JAVA Web Webdynpro as SAP Web AS available as dual stack.
    If someone already has a strong ABAP background and has WD for ABAP available they should probably use that. If they are a J2EE developer they should probably use WD for Java but it is likely they will also then need some ABAP support for the backend systems.
    I think more customers may be asking for WD for Java projects simply because it has been around longer and is more widely available to customers where as some cutomers prefer to develop their application using ABAP Web Dynpro because of SAP propritary. But ultimately it's again all our interest and customer.
    Thanks
    Krishna

  • Start both Webdynpro JAVA and WebDynpro ABAP from UWL

    Hi all:
    We are facing a situation. We need to start both JAVA dynpro and ABAP dynpro applicaiton from uwl. The JAVA dynpro application is the ESS absense request. And we also developed other workflow which use ABAP dynpro as work item . The problem is when we regist our ECC system to UWL, the system can only provide  WAS java information or WAS ABAP. So there are alway one type of our work items can't start correctlly. How can I modify the UWL configuration to meet our requirement?
    Anyone knows please notify, thank you very much!
    Wayne

    Hi,
    when you try to register backend system , you will choose system alias which was already existing in the portal which has WAS hostname and port.
    that is sufficient. Based on visualzation parameters , you can launch webdynpro abap/java tasks.
    check below article
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20java/wdjava%20archive/using%20web%20dynpro%20java%20and%20web%20dynpro%20abap%20applications%20in%20universal%20work%20list.pdf
    Regards,
    Koti Reddy

  • 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

  • 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

  • Launching webdynpro ABAP application from workflow task  (without UWL)

    Hello,
    How can i start webdynpro ABAP application from workflow without portal?
    Workflow and webdynpro ABAP are located on the same system.
    I assume it must be possible without transaction SWFVISU.
    thanks
    Regards
    Paul

    First you need to define a external service then you have to generate a task from this external service and then you need to include this task id in you workflow for a ACTIVITY step then this step can be either background or can be assigned to any agent
    you have to make use the below two Txn
    WF_HANDCUST and WF_EXTSRV

  • Calling smartform and displaying ALV grid in ABAP WEBDYNPRO

    Hi all,
    I am new to ABAP web dynpro.I ahve few custom reports which are simple ALV list reports which I now need to convert to ABAP web dynpro application .
    For one particular report,based on the selection screen input,I need to display the ALV list and when I select the records from the ALV list,I need to call a smartform on clik of a push button.
    My questions:
    1. Im using 'REUSE_ALV_GRID_DISPLAY' FM  to display the o/p in my report.Is there any similar FM in webdynpro ABAP which will display my list in ALV GRID in my web dynpro application??/
    2. How to call a smartfrm in ALV grid in web dynpro??
    Edited by: abap_1000 on Jan 9, 2011 6:09 PM

    Hi,
    You can search SDN, there are several posts available. Just to get some idea, you can check --
    [Beginneru00B4s questions on WDA ALV;
    [Reg ALV Display;
    For clicking event on ALV --
    [Reg Row Data fetching on click in ALV;
    For ALV display on WDA --
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110?quicklink=index&overridelayout=true]
    Thanks.
    Kumar Saurav.

  • Where do i find daily posted question on sap abap and sap webdynpro abap

    Hi
    where do we find Daily posted questions on sap abap and sap webdynpro abap in scn sap  so that i can go through the questions and answer them .

    Hi,
    Go to the Content tab of any space and click on discussions. Then you can sort them by date created or any other
    For ex: This link for WDA discussions: - Web Dynpro ABAP
    You can also click on Receive email notifications for any space to get updates on that space.
    hope this helps,
    Regards,
    Kiran

  • My Trips and Expenses - Webdynpro ABAP - Change Copy Delete button links

    Hello All,
    We are using ESS and MSS applications in our scenario. We are using EHP4 version of ECC6.0.
    I have configured my homepage framework with custom entries in SAP (resources, services, ... ) and custom Portal content (iviews, pages, ...  copied from SAP delivered stuff ). I have a very good understanding of this and I have no issues with the portal navigation and tying my custom homepage framework entries to the custom PCD locations.
    The only problem I have is with the Webdynpro ABAP application for "My Trips and Expenses". I can get to this application without any problem.
    Within the My Tirps and Expenses application, there are buttons for Displaying, Changing, Copying and Deleting existing Travel Trip Requests and Expense Reports. When I click on any of these buttons, the corresponding page/iview from the standard SAP ESS role is being launched. I would like to point these buttons to my custom page/iview from my custom role.
    I did not find any place where I can make this setting. I am not sure how the Service IDs for the standard SAP services are being linked to the application.
    I hope some one might have looked into this and any input would be really appreciated.
    Thanks,
    Raj

    I figured this out.
    This application makes use of Object Based Navigation and if you adjust the roles assigned to the user accordingly, this will automatically pick up the custom pages form the custom role.
    Thanks,
    Raj

  • Any difference between webdynpro for java and webdynpro for abap ?

    Hi all:
       I would like to build one small system in EP.
       I can choose to use webdynpro for java and webdynpro for abap.
       I would like to ask any major difference between webdynpro for abap and webdynpro for java ?
       Is fpm supported in webdynpro for abap ?

    Hi,
    see this thread,
    ABAP Vs JAVA WebDynpro
    Regads,
    J.Joe

  • WebDynPro ABAP iViews not picking the portal look and feel

    Hi,
    In our case , WebDynPro ABAP iViews not picking the portal look and feel.
    Is there any way to provide the custom developed portal theme link or css file to the WebDynPro application.
    Can it be done programmatically in the WD ABAP application.
    Best Regards
    Sid

    Look at the below link, it will answer your question:
    Re: EP 7 Portal stylesheet with WD ABAP
    Raja T

  • DIfference Between OOPS ALV and WEBDYNPRO FOR ABAP ALV?

    Hi to All,
    i want some information that What is main difference when we develop ALV Report in OOPS and WEBDYNPRO For ABAP.which is good n in what way it is good?
    In the Same way I m also want know that WHICH IS BETTER AMONG WEBDYNPRO FOR JAVA/ABAP.In which way?
    Regards,
    Ravi K

    Thanku for ur valuble Information.
    could u give me information regarding OOPS ALV and WEBDYNPRO FOR ABAP ALV?which is better?is there differences?
    Edited by: ravi k on Mar 26, 2008 12:23 PM

  • Drag And Drop In Webdynpro Abap

    Hi,
    Is It  Possible For Drag And Drop Option For Text Elements ( not For Images) In Webdynpro Abap..
    Do NeedFull Help..

    Hi,
    Drag and drop option is not possible for Text elements.
    It is possible only for Trere,Image,Itemlistbox,Table.
    Have a look at
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/307f2eae-8cf0-2d10-6088-8aa2b1f00b23?quicklink=index&overridelayout=true
    http://help.sap.com/saphelp_sm70ehp1_sp26/helpdata/en/a5/bf47414eca430794189fbb5919cc2f/frameset.htm
    Regards,
    Karthiheyan M

  • How to exit from a WebDynpro ABAP application and open another url

    Hi Friends,
    How to exit from a WebDynpro ABAP application and open another url like (www.yahoo.com) in the same window of the WD4 application on click of a Button?
    Regards,
    Xavier

    Hi,
    First of all you should create outbound plug in the window you are trying to exit with plufg type "Exit"
    Then create method handler in the view with this code
            data lo_view_cntr type ref to if_wd_view_controller.
            data lo_win_cntr type ref to if_wd_window_controller.
            data: l_parameter_list type wdr_event_parameter_list,
                  l_parameter type wdr_event_parameter,
                  l_val type ref to data,
                  l_val_url type REF TO data.
            field-symbols: <fs> type any,
                           <fs_url> type any.
            lo_view_cntr  = wd_this->wd_get_api( ).
            lo_win_cntr = lo_view_cntr->get_embedding_window_ctlr( ).
            CREATE DATA l_val type c.
            CREATE DATA l_val_url type string.
            ASSIGN l_val->* to <fs>.
            ASSIGN l_val_url->* to <fs_url>.
            <fs> = 'X'.
            <fs_url> = 'http://your-link.com'.     
            l_parameter-name = 'URL'.
            l_parameter-value = l_val_url.
            INSERT l_parameter INTO TABLE l_parameter_list.
            lo_win_cntr->if_wd_view_controller~fire_plug( EXPORTING plug_name = 'EXIT_PLUG'
                                                                    parameters = l_parameter_list ).
          You can easily change this logic to exit application instead of redirecting to the site
           just changing to
           l_parameter-name = 'CLOSE_WINDOW'.

Maybe you are looking for

  • Session facade vs Command object pattern

    Hello, I am debating using the Command pattern as my primary strategy for implementing my J2EE enterprise app business logic and would like some advice. The general idea is to have only a few types of abstract commands (such as a ReadComand, an Updat

  • Itunes repeatedly crashes when it starts up

    I even updated but it still crashes seconds after it starts up. It gives me the error: Process:         iTunes [146] Path:            /Applications/iTunes.app/Contents/MacOS/iTunes Identifier:      com.apple.iTunes Version:         10.3.1 (10.3.1) Bu

  • Java Error: Need Help/Lib/obiwan you are my only hope/error...

    I recieve this message on my new iMac Dual Core 10.4: Uncaught exception in main method: java.lang.UnsatisfiedLinkError:/Applications/Groupwise.1.app/Contents/Resources /Java/libgwapijni.jnilib Okay, I know that this happens more often than when I ju

  • Download failure of itunes on windows xp

    bought a new ipod nano for my bf who can't download itunes on his pc now. the new versions don't come with a cd, so i am not sure how to do it. everytime we try to download itunes it just says it is successful downloaded, but not to be found anywhere

  • Problem with materialized views DDL generation

    Hi, there is no check box in the *'Drop' Selection* tab for materialized views so no option to drop this objet type. It does drop the corresponding table but not the MV. Is there another way to automatically drop this type of object when generating D