Download of a webform within a BSP application

Hi SDN members,
I wrote a ESS BSP application with a 3 step wizard. Within the first step the user can enter some data in some form fields.
In the second step a webform (SMARTFORM) with the form data is displayed and in the third step the user can save the document.
Is there any possibility to save the web form as a document when the user saves the document. It would be sufficient to save the webform to the application server and get back a link.
Later on the webform should be linked as a kind of attachment. This means when the user calls again the saved document a link should be available where the form can be called.
The webform is called in the following way within my BSP:
Call the generated function module
  call function l_function_module_name
       exporting
                archive_index        =
                archive_parameters   =
                  control_parameters   = ls_control_parameters
                mail_appl_obj        =
                mail_recipient       =
                mail_sender          =
                  output_options       = ls_output_options
                  user_settings        = space
                  customer             = lt_customer
                  bookings             = lt_bookings
                  connections          = lt_connections
       importing
                document_output_info =
                  job_output_info      = ls_output_data
                job_output_options   =
       exceptions formatting_error     = 1
                  internal_error       = 2
                  send_error           = 3
                  user_canceled        = 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.
  ls_xmloutput = ls_output_data-xmloutput.
  lt_html_raw  = ls_xmloutput-trfresult-content[].
Fill HTTP request
  response->set_header_field( name = 'content-type'
                               value = 'text/html; charset=UTF-8').
SAP Smart Forms returns XML data island in raw data format.
method 'set_data' of the response object needs the output
in XSTRING. The next loop convertes the raw table into xstring.
  loop at lt_html_raw into l_xstring.
     concatenate l_html_xstring l_xstring into l_html_xstring
                                               in byte mode.
  endloop.
  l_xlength = xstrlen( l_html_xstring ).
  response->set_data( data   = l_html_xstring
                      length = l_xlength ).
Any ideas how to save the form in any way?
Best regards
Thomas

Hi,
thanks for your answer!
Let me explain more in detail what I want to do.
I am calling my BSP application from our SRM system. When the user saves the data which were entered in my BSP application, the data are transferred via OCI (Open Catalog Interface). This is already working.
The only thing which is missing is the transfer of my webform to the SRM via OCI.
OCI is waiting for a link to my form. Only then, the SRM can attach a document. See OCI description
http://www.sdn.sap.com/irj/sdn?rid=/webcontent/uuid/ff03d072-0501-0010-aa88-8018506a2ebe">oci [original link is broken] [original link is broken]
Therefore I have to download the form to get a link which can be written to the OCI interface. This could also be a temporary link.

Similar Messages

  • How to Download displayed output to Excel Using Bsp Application

    Hi Experts,
    please give me some idea because I am New In BSP.
    How to Download displayed output to Excel Using Bsp Application.
    If any sample code please do send me.
    In my condition I am getting data in  2-3 table view formats on one page and i want download that in Excel.
    please help me.
    Regards & Thanks,
    Yogesh

    Hi,
    This is more a question for the BSP forum.
    Anyway, as such it's realy easy since you can use HTML in order to import to Excel. All you need to do is add
    runtime->server->response->set_header_field( name = 'Contnet-Type'
    value = 'application/vnd.ms-excel' ).
    runtime->server->response->delete_header_field( name = 'Cache-Control' ).
    runtime->server->response->delete_header_field( name = 'Expires' ).
    runtime->server->response->delete_header_field( name = 'Pragma' ).
    Also check threads like
    Download BSP data into Excel
    export bsp-table to excel
    Export BSP Table to Excel
    Eddy
    PS. Reward useful answers and earn points yourself

  • User switch scenario involving BSP application

    Hi
       I am new to BSP application design. We have requirement from a BSP  application wherein different sales force personnel need to see different segments of same data on the BSP application - owing to security requirements. We are thinking of using a default user and then user switch to specific  SAP reference user ( based on maybe their windows logon credentials within the BSP application - each reference will have a security that has authorization to see a particular segment of data for a group of sales force people.
    Is this approach ok ( of switching user from default to specific reference user and having a reference user as the representative user for each sales force group ) ?  Any thoughts/suggestions on experiences that can be shared here to architect this scenario would be highly appreciated.

    Hi,
    you can do this. Therefore you have to setup an use the nodes via sicf. User switch involves also
    a new registration with authorization. You can lok at bsp application SYSTEM for that.
    On the otherhand: build role via Profile generator: TXN PFCG and do authorization checks as you do
    it in SAPGui Dynpro Programmining. Why not. We have build big applications with many user roles
    using this approach.
    The first ones makes only sense, when you have a public area using a public user. Therefore you enter the public account in thze right sicf nodes.
    Best regards,
    Stefan

  • Question on passing parameters between 2 pages in a BSP application

    Hi Group,
    I have defined a page attribute "zcid" in both the pages where I need this attribute value. And in one page I calculated a value and assigned it to this attribute. And also I checked the attribute as "Auto" in both pages.
    And I used navigation->set_parameter( name = 'zcid' and value = zcid ), I was getting an error saying, use "." after name and not proceeding any further.
    Please let me know the procedure for accessing a value of an attribute in Multiple pages within a BSP application.
    Thanks in advance.
    Regards,
    Vishnu.

    Hi Vishnu
    To pass the parameter,
    Firstly the name of attributes should be same of both pages and the check of AUTO should be checked on target page.
    I am giving you small example to pass the Firstname parameter from Default.htm to Result.htm .
    the Parameter name in Default.htm is --> fname type string.
    --> Auto should not check
    the Parameter name in Result.htm is --> fname type string.
    --> Auto should be checked.
    in Default.htm inputprocessing use the code
    navigation->set_parameter( 'fname' ).
    navigation->next_page( 'TORESULTS' ).
    or
    For more detail you may also go through the following links
    /people/raja.thangamani/blog/2006/12/26/bsphow-to-navigation-between-bsp-applications-part-i
    /people/raja.thangamani/blog/2007/01/05/bsphow-to-navigation-between-bsp-applications-part-ii
    If this will helpful please reward the points
    Kuldeep Verma

  • Use a Customizable Logo / Image in a BSP Application

    Dear All,
        I am developing a BSP Application for a client. My company wants to use this same application for two clients. How can I dynamically change the logo of the company, used in the BSP Application? Say, how can the application administrator, who has access to a customization page, also upload the logo, once the application is transported to his server? Can this be done from within the BSP Application? I believe, we have to import it into the mime folder. But fow?
       Thank you all in advance.
    Regards
    Gladson

    <i>The administrator of Client A, should be able to upload a logo through the Administrator's page of the BSP Application,</i>
    Are you developing this Administrator page as well?
    what you could do in your code is just refer to image called logo.gif
    Ask Client A  to load their image to the BSP application from SE80 in dev (in their server) and ask them to transport to prod.
    ask Client B also to do the same.
    Both client A and Client B has to upload the image with the same name i.e logo.gif
    Regards
    Raja

  • How to create downloadable pdf report as hyperlink within BSP application

    Hi,
    I'm developing a BSP application using MVC and htmlb extensions on a WAS 6.40. One of the requirements of my webapplication is:
    - the ability to generate a report in pdf format at runtime, using data retrieved from a backend SAP CRM 3.0 system
    and
    - make this report available/downloadable via a hyperlink in the application.
    I am aware of tools like Smartforms and Adobe interactive forms but need some help to get started and choose the right tool.
    regards, Roelof Jan

    Hi,
    we've done that by firstly building a RFC which prints the report to sap-spool:
    call function 'GET_PRINT_PARAMETERS'
          exporting
            expiration     = 1
            immediately    = ' '
            new_list_id    = 'X'
            line_count     = 65
            line_size      = 132
            report         = sy-repid
            no_dialog      = 'X'
          importing
            out_parameters = wf_params
            valid          = valid_flag.
        if sy-subrc ne 0 or valid_flag eq false.
        endif.
        new-page no-heading no-title print on parameters wf_params
                          no dialog .
    ... list processing ...
    new-page print off.
      concatenate programname sy-uname+0(3) into lc_rq2name separated by '_'.
      select * from tsp01 into tsp01_wa
                          where rq2name = lc_rq2name
                          and rqowner   = sy-uname
                          order by rqcretime descending.
        wf_spono = tsp01_wa-rqident.
        exit.
      endselect.
      if sy-subrc ne 0.
        clear wf_spono.
      endif.
    Then convert the spooljob:
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        exporting
          src_spoolid              = wf_spono
          no_dialog                = 'X'
        tables
          pdf                      = witab
        exceptions
          err_no_abap_spooljob     = 1
          err_no_spooljob          = 2
          err_no_permission        = 3
          err_conv_not_possible    = 4
          err_bad_destdevice       = 5
          user_cancelled           = 6
          err_spoolerror           = 7
          err_temseerror           = 8
          err_btcjob_open_failed   = 8
          err_btcjob_submit_failed = 9
          err_btcjob_close_failed  = 10
          others                   = 11.
      if sy-subrc ne 0.
        return.
      endif.
    Delete Spooljob and generate cached response:
      data del_spono type  tsp01_sp0r-rqid_char.
      del_spono = wf_spono.
      call function 'RSPO_R_RDELETE_SPOOLREQ'
        exporting
          spoolid = del_spono.
      if witab is not initial.
        loop at witab into itab .
          translate itab using ' ~'.
          concatenate output itab into output in character mode.
        endloop.
        translate output using '~ ' .
        create object cached_response
               type cl_http_response
               exporting add_c_msg = 1.
        l_pdf_len = strlen( output ).
        cached_response->set_cdata( data   = output
                                    length = l_pdf_len ).
        cached_response->set_header_field( name  = if_http_header_fields=>content_type
                                           value = 'application/pdf' ).
        cached_response->set_status( code = 200 reason = 'OK' ).
        cached_response->server_cache_expire_rel( expires_rel = 180 ).
        data: guid type guid_32,
              display_url type string.
        call function 'GUID_CREATE'
          importing
            ev_guid_32 = guid.
        concatenate runtime->application_url '/' guid '.pdf'
                    into display_url.
        cl_http_server=>server_cache_upload( url      = display_url
                                             response = cached_response ).
        app ?= application.
        app->print_url = display_url.
      endif .
    The display_url has to be used in the normal response-view:
    <script type="text/javascript">
    var param = 'width=700'
          + ',height=550'
          + ',left=0'
          + ',top=0'
          + ',menubar=no'
          + ',location=no'
          + ',resizable=yes'
          + ',status=no';
      window.open('<%= application->print_url%>', 'DRUCK', param ).focus();
    </script>

  • Download the PDF Form as a attachment when button click in BSP application

    Hi All,
    I have scenario, when button click in the BSP application PDF Form want to download in the IE (like one window open with Open,Save and cancel button).
    I have written this code:
    data: pdf type fpformoutput-pdf.
    < Logic for populate value to pdf field ....
    .>
    response->set_header_field(
                         name  = 'cache-control'
                         value = 'max-age=0' ).
      response->set_header_field(
                         name  = 'content-disposition'
                         value = 'attachment; filename=webforms.pdf' ).
      response->set_data( data   = pdf ).
    Once button is clicked pop up is opened and closed automatically because of browser or adobe reader issue.
    How can I resolve this problem ?
    In the IE i need to change any settings ?
    IE version = 7.0
    Adobe reader = 9.0
    I have tried in the same code with IE = 6.0 and adobe reader 8.1.2 its getting download the pdf form working fine.
    The same think i want in IE 7.0 and adobe reader 9.0, what needs to be done ?
    Regards,
    Boopathi M

    Hello Ravi,
    Best would be to bind the dataSource of the InteractiveForm ui element to the parent node containing the table's data. Then specify a name of a template to be created in the templateSource and hit <enter>. Some popups later, the system will have created a template from the structure of the context. All you need to do now is to drag&drop the data structure inside the template designer to the template itself. This will result in a table. Save, activate and return the Web Dynpro view. Don't forget to unbind the pdfSource and enjoy.
    Best regards,
    Thomas

  • Download out of BSP Application

    Hi @ all,
    I built a BSP Application and like to up- and download some files. Upload is no problem, because If got a BSP element for that.
    But how to handle the downloads, because in my opinion all GUI* methods should not work...
    Regards
    Matt

    Hi Matthias,
         I think there is no direct method to download.
         We can write a small code based on the requirement
         What type of the file you need to down load?
         if it is .pdf file you can use the following code
         Generally ( Smart form )
         If it is .xls or .txt file let me know
    You can crate a method and
    Import Parameters are :
    NAVIGATION TYPE REF TO IF_BSP_NAVIGATION
    RESPONSE TYPE REF TO IF_BSP_RESPONSE
    Code is
    data: l_pdf_xstring type xstring,
    lt_lines type table of tline,
    ls_line type tline,
    l_devtype type rspoptype,
    l_pdf_len type i.
    parameters for generated function module
    data: l_function_module_name type rs38l_fnam,
    ls_output_options type ssfcompop,
    ls_control_parameters type ssfctrlop,
    l_function_name type rs38l_fnam,
    ls_output_data type ssfcrescl,
    form_name type tdsfname.
    generated result: HTML with embedded CSS
    data: ls_xmloutput type ssfxmlout,
    lt_html_raw type tsfixml.
    data: l_xstring type xstring, "needed for HTTP response
    l_xlength type i,
    l_html_xstring type xstring.
    form_name = 'ZINVOICE'.
    get name of generated function module
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = form_name
    importing
    fm_name = l_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.
    activate XSF Output Mode
    get device type from language
    call function 'SSF_GET_DEVICE_TYPE'
    exporting
    i_language = 'E'
    importing
    e_devtype = l_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 = l_devtype.
    ls_control_parameters-langu = 'E'.
    ls_control_parameters-no_dialog = 'X'.
    ls_control_parameters-getotf = 'X'.
    CALL FUNCTION l_function_module_name
    EXPORTING
    CONTROL_PARAMETERS = ls_control_parameters
    OUTPUT_OPTIONS = ls_output_options
    USER_SETTINGS = space
    INVOICE_NO = me->I_INVOICE
    FROM_DATE = me->ST_PDF_HEADER-BILL_FROM
    TO_DATE = me->ST_PDF_HEADER-BILL_TO
    INVOICE_COVER = me->ST_PDF_HEADER
    IMPORTING
    JOB_OUTPUT_INFO = ls_output_data
    TABLES
    INVOICE_DETAILS = me->IT_PDF_ITEMS
    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.
    call function 'CONVERT_OTF'
    exporting
    format = 'PDF'
    importing
    bin_filesize = l_pdf_len
    bin_file = l_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.
    Fill HTTP request
    response->set_header_field( name = 'content-type'
    value = 'application/pdf' ).
    response->delete_header_field(
    name = if_http_header_fields=>cache_control ).
    response->delete_header_field(
    name = if_http_header_fields=>expires ).
    response->delete_header_field(
    name = if_http_header_fields=>pragma ).
    some Browsers have caching problems when loading PDF format
    response->set_header_field(
    name = 'content-disposition'
    value = 'max-age=0' ).
    start PDF viewer either in the Browser or as a separate window
    response->set_header_field(
    name = 'content-disposition'
    value = 'attachment; filename=webforms.pdf' ).
    finally display PDF format in Browser
    l_pdf_len = xstrlen( l_pdf_xstring ).
    response->set_data( data = l_pdf_xstring
    length = l_pdf_len ).
    navigation->response_complete( ).

  • PDF download from BSP application

    hi all,
    With the bellow code i am able to download to PDF from BSP application
    Issue is when i click on the download button waiting popup window is not disappearing even after PDF displayed.
    Please help me to resolve how to stop this waiting popup window.
    response->delete_header_field( name = 'Cache-Control' ).  "#EC NOTEXT
      response->delete_header_field( name = 'Expires' ).        "#EC NOTEXT
      response->delete_header_field( name = 'Pragma' ).         "#EC NOTEXT
    Deactivated because of Note 904314 and Kompression in Kernel
      response->set_compression( options = '4' ).
      response->set_header_field( name  = 'content-type'
                                  value = 'application/pdf' ).
      response->set_header_field(
                         name  = 'cache-control'
                         value = 'max-age=0' ).
        response->set_header_field(
                           name  = 'content-disposition'
                           value = 'attachment; filename=candidate.pdf' ).
      l_pdf_len = XSTRLEN( l_pdf_xstring ).
      response->set_data( data   = l_pdf_xstring
                          length = l_pdf_len ).
      navigation->response_complete( ).
    Any help on this is highly appreciated.
    Thanks,
    Ravi

    May be you can navigate to another page AFTER the response_complete() method and show the message that 'PDF is downloaded successfully'
    or something meanful message. so that it will get a response back from server and 'wait...Processing' message might disappear.
    I'm not sure and didnt try..may be you can give it a try and let us know..
    navigation->response_complete( ).
    navigation->goto_page(....)

  • Download Text file to Local drive from BSP Application

    Hi Guys,
    I am new to BSP, and I am doing a BSP application in which i want to download a text file to local drive C: on click of button. For that I am having a data in Internal table and Onclick event, in model class method DO_HANDLE_EVENT i want to download text file to local machine drive.
    Can anybody provide me full code with all data declaration and all?
    Your help would be appriciable. Thanks in Advance.

    Hi Jessy ,
    You can download the file from BSP pages using the method
    CL_BSP_UTILITY=>download.
    Please follow the below mentioned steps.
    1.Convert the text to a text table ie Internal table with a line type char255 or some others.
    2.Convert the text table into a string.
    3.Convert the string to XSTRING.
    4.Download that XSTRING as text file using the method
       CL_BSP_UTILITY=>download.
    Parameters:
    OBJECT_S    - XSTRING data
    CONTENT_TYPE  =  ' application/download'
    CONTENT_DISPOSITION = 'attachment; file=test.txt'
    RESPONSE                   = runtime->server->response
    NAVIGATION                   = navigation
    OBJECT_T
    I dont have system to give a programatical explanation to u.
    If you have any doubt kindly post.
    Reward for every useful solutions..
    Best Regards
    Renga

  • Download internal table from BSP application to C:\ drive of the user

    Hi,
    How do we download a internal table data from a BSP application to the C:\ drive of the user. Have tried GUI Download, but it doesn't work. Also don't want a pop up to appear while this is happening. The code has to there in 'OnInputProcessing' event.
    Regards,
    Jaison

    Hi Raja,
    I went through few of the blogs and wrote the below code for downloading data. My requirement is that in the InputProcessing event i need to write a subset of data to the users C:\ drive. But even after doing the below change i'm unable to get the requirement done. Can you please tell me as to what i'm missing. I'm new to BSP development and help would be highly appreciated.
    if not it_messages1[] is initial.
      clear wa_messages1.
      loop at it_messages1 into wa_messages1.
       clear temp_string.
       concatenate wa_messages1-PROJECT wa_messages1-FILENAME.......
       into temp_string separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
       concatenate main_string temp_string into main_string separated by
       CL_ABAP_CHAR_UTILITIES=>CR_LF.
      endloop.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        TEXT                 = main_string
        MIMETYPE        = 'APPLICATION/MSEXCEL;charset=utf-16le'
      ENCODING       =
    IMPORTING
       BUFFER         =  xmain_string.
    EXCEPTIONS
      FAILED         = 1
      OTHERS         = 2
    CALL METHOD cl_bsp_utility=>download
    EXPORTING
        object_s = xmain_string
        content_type = 'APPLICATION/MSEXCEL;charset=utf-16le'
        content_disposition = 'attachment;filename=test.xls'
        response = mresponse
        navigation = navigation.
    Edited by: Jaison Yohannan on Jun 3, 2009 2:16 PM

  • Download File from BSP-Application

    Hello !
    i hope i can get some help for my problem.
    from my BSP-Application i want to download an internal table to p:\eigenedateien\bv.txt (always the same filename)
    the internal table ist type table of string.
    i read that gui_download doesn't work in my BSP
    so i went through this weblog 756
    but it is really hard.
    i put some code from the weblog in my application:
    concatenate 'attachment; filename='
    w_para-pwert = p:\eigenedatieen\bv.txt
                w_para-pwert into dl_pathfile.
    Download der Datei
    Create the cached response object that we will insert our content into
    dl_xstring = 'Test'. "nur zum testen
                CREATE OBJECT CACHED_RESPONSE TYPE CL_HTTP_RESPONSE
                       EXPORTING ADD_C_MSG = 1.
    set the data and the headers
                CACHED_RESPONSE->SET_DATA( DL_XSTRING ).
                CACHED_RESPONSE->SET_HEADER_FIELD( NAME  =
                                        IF_HTTP_HEADER_FIELDS=>CONTENT_TYPE
                                                   VALUE = 'text/html' ).
    Set the filename into the response header
           CACHED_RESPONSE->SET_HEADER_FIELD( NAME  = 'Content-Disposition'
                                       VALUE = DL_PATHFILE ).
    Set the Response Status
                CACHED_RESPONSE->SET_STATUS( CODE = 200 REASON = 'OK' ).
    Set the Cache Timeout - 60 seconds - we only need this in the cache
               CACHED_RESPONSE->SERVER_CACHE_EXPIRE_REL( EXPIRES_REL = 60 ).
    Create a unique URL for the object
                CALL FUNCTION 'GUID_CREATE'
                  IMPORTING
                    EV_GUID_32 = GUID.
                CONCATENATE RUNTIME->APPLICATION_URL '/' GUID INTO URL.
    Cache the URL
                CL_HTTP_SERVER=>SERVER_CACHE_UPLOAD( URL      = URL
                                               RESPONSE = CACHED_RESPONSE ).
    Ende Download
    now it should be cached.
    but hot can i start the download to p:\eigenedateien... now?
    thanks very much for your help
    Helmut

    Hi,
    Could you try adding at the end:
    navigation->response_complete( ).
    and/or
    data: guid type guid_32,
          display_url TYPE string.
    call function 'GUID_CREATE'
    importing
    ev_guid_32 = guid.
    concatenate runtime->application_url '/' guid into display_url.
    cl_http_server=>server_cache_upload( url = display_url response = cached_response ).
    Best regards,
    Guillaume
    Message was edited by: Guillaume Garcia

  • Download and upload bsp application

    Hi All,
    Pl. guide me with my requirement. I have a bsp application in one server and for some reasons the same bsp application is required in another server but these two servers are not in land scape and hence i cannot transport. Is there any way to download the whole application and upload it into the target server. I feel this approach is silly but is there any other way or should i create it again fron the scratch in the new server.Pl. guide me.
    thanks & regards,
    jeeva.

    Hi Jeeva
       Why dont you try the above link given by Raja..
    It works fine .... You will get the sourcecode downloaded in a .bsp extension file for each page....But the only major problem is ... It doesnot talk about anything related to How to upload those files in the application....For that you had to take the help of BASIS ..
    But if your problem get solved by just getting the source code downloaded then try this code...This is the same code that RAJA has linked to...Just paste the code in a report program...and execute it...
    type-pools: SO2.
    types: t_page_list type standard table of o2pagkey.
    parameters: g_appl type O2APPLNAME.
    constants: c_separator_line type string value
    perform main.
    form main.
      data: l_pages type t_page_list,
      l_ref_page type ref to cl_o2_api_pages,
      l_table type o2pageline_table,
      l_folder type string,
      l_lower type string,
      l_filename type string.
      field-symbols: <f_page> type o2pagkey.
    * get local directory path
      call method CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE
    * EXPORTING
    * WINDOW_TITLE =
    * INITIAL_FOLDER =
      CHANGING
      SELECTED_FOLDER = l_folder
      EXCEPTIONS
      CNTL_ERROR = 1
      ERROR_NO_GUI = 2
      NOT_SUPPORTED_BY_GUI = 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.
        return.
      ENDIF.
      if l_folder is initial. return. endif.
    * get all pages of selected BSP application
      perform get_all_pages changing l_pages.
    * perform each page
      loop at l_pages assigning <f_page>.
    * load page data
        perform load_page using <f_page>
        changing l_ref_page.
        if l_ref_page is bound.
    * collect the content of the page in an internal table
          perform print using l_ref_page
          changing l_table.
          if not l_table is initial.
            l_lower = <f_page>-pagekey.
            translate l_lower to lower case.
    * determine file path for the page
            concatenate l_folder '' l_lower into l_filename.
    * download the content of the page to file
            perform download using l_filename l_table.
          endif.
        endif.
      endloop.
    endform.                    "main
    form download using p_filename type string
    p_table type standard table.
    * download the content of an internal table to a local file
      call method CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        EXPORTING
          FILENAME                = p_filename
        CHANGING
          DATA_TAB                = p_table
        EXCEPTIONS
          FILE_WRITE_ERROR        = 1
          NO_BATCH                = 2
          GUI_REFUSE_FILETRANSFER = 3
          INVALID_TYPE            = 4
          NO_AUTHORITY            = 5
          UNKNOWN_ERROR           = 6
          HEADER_NOT_ALLOWED      = 7
          SEPARATOR_NOT_ALLOWED   = 8
          FILESIZE_NOT_ALLOWED    = 9
          HEADER_TOO_LONG         = 10
          DP_ERROR_CREATE         = 11
          DP_ERROR_SEND           = 12
          DP_ERROR_WRITE          = 13
          UNKNOWN_DP_ERROR        = 14
          ACCESS_DENIED           = 15
          DP_OUT_OF_MEMORY        = 16
          DISK_FULL               = 17
          DP_TIMEOUT              = 18
          FILE_NOT_FOUND          = 19
          DATAPROVIDER_EXCEPTION  = 20
          CONTROL_FLUSH_ERROR     = 21
          NOT_SUPPORTED_BY_GUI    = 22
          ERROR_NO_GUI            = 23
          others                  = 24.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    "download
    form get_all_pages changing p_pages type t_page_list.
    * get all pages of the application
      select applname pagekey from o2pagdir into table p_pages
      where applname = g_appl and
      pagetype <> so2_controller.
    endform.                    "get_all_pages
    form load_page using p_key type o2pagkey
    changing p_data type ref to cl_o2_api_pages.
    * load the data of one page
      clear p_data.
      call method cl_o2_api_pages=>load_with_access_permission
        EXPORTING
          p_mode    = 'SHOW'
          p_pagekey = p_key
          p_version = 'A' "'I' for inactive version
        IMPORTING
          p_page    = p_data
        EXCEPTIONS
          others    = 1.
    endform.                    "load_page
    form print using p_data type ref to cl_o2_api_pages
    changing p_table type o2pageline_table.
    * collect the content of a page into an internal table
      data: l_attrs type o2pagattr,
      l_params type o2pagpar_tabletype,
      l_source type rswsourcet,
      l_layout type o2pageline_table,
      l_ev_handlers type so2_ev_handler_list,
      l_typtyp(11) type c,
      l_line type string.
      field-symbols: <f_param> type o2pagpars,
      <f_evh_name> type so2_ev_handler_name.
      refresh p_table.
    * get page properties
      CALL METHOD P_DATA->GET_ATTRS
        IMPORTING
          P_ATTRS = l_attrs
        EXCEPTIONS
          others  = 1.
      check l_attrs-pagetype <> so2_controller.
      append c_separator_line to p_table.
      concatenate '*' l_attrs-applname '/' l_attrs-pagekey into l_line.
      append l_line to p_table.
      append c_separator_line to p_table.
      append space to p_table.
    * local types
      if l_attrs-pagetype = so2_full_page.
        CALL METHOD P_DATA->GET_TYPE_SOURCE
          IMPORTING
            P_SOURCE = l_source
          EXCEPTIONS
            others   = 1.
        if not l_source is initial.
          append c_separator_line to p_table.
          append '* local types' to p_table.
          append c_separator_line to p_table.
          append lines of l_source to p_table.
          do 3 times.
            append space to p_table.
          enddo.
        endif.
      endif.
    * page attributes
      if l_attrs-pagetype = so2_full_page or
      l_attrs-pagetype = so2_view_page.
        CALL METHOD P_DATA->GET_PARAMETERS
          IMPORTING
            P_PARAMETERS = l_params
          EXCEPTIONS
            others       = 1.
        if not l_params is initial.
          append c_separator_line to p_table.
          append '* page attributes' to p_table.
          append c_separator_line to p_table.
          loop at l_params assigning <f_param>.
            if <f_param>-typtype = so2_paramtyp_type.
              l_typtyp = 'TYPE'.
            else.
              l_typtyp = 'TYPE REF TO'.
            endif.
            concatenate <f_param>-aliasname l_typtyp
            <f_param>-type into l_line
            separated by space.
            append l_line to p_table.
          endloop.
          do 3 times.
            append space to p_table.
          enddo.
        endif.
      endif.
    * layout
      append c_separator_line to p_table.
      append '* layout' to p_table.
      append c_separator_line to p_table.
      CALL METHOD P_DATA->GET_PAGE
        IMPORTING
          P_CONTENT = l_layout
        EXCEPTIONS
          others    = 1.
      append lines of l_layout to p_table.
      do 3 times.
        append space to p_table.
      enddo.
    * event handler
      if l_attrs-pagetype = so2_full_page.
        CALL METHOD P_DATA->GET_EVENT_HANDLER_LIST
          EXPORTING
            P_WITH_ALL_PREDEFINED = ' '
          IMPORTING
            P_EV_HANDLER_L        = l_ev_handlers
          EXCEPTIONS
            others                = 1.
        loop at l_ev_handlers assigning <f_evh_name>.
          append c_separator_line to p_table.
          concatenate '* eventhandler' <f_evh_name>-name into l_line
          separated by space.
          append l_line to p_table.
          append c_separator_line to p_table.
          clear l_source.
          CALL METHOD P_DATA->GET_EVENT_HANDLER
          EXPORTING
          P_NAME = <f_evh_name>-key
          IMPORTING
          P_SOURCE = l_source
    * P_ATTRS =
          EXCEPTIONS
          others = 1.
          append lines of l_source to p_table.
          do 3 times.
            append space to p_table.
          enddo.
        endloop.
      endif.
    endform.                    "print
    RGDS
    Mithlesh

  • Download a BSP application

    Hi,
    stupid question : is there a way to download a bsp application into a .txt file for instance and upload it in another system like for Abap programs?
    Regards & Happy new year,
    Huy

    Hallo Huy,
    In R/3 systems, the transport system is the best way to move stuff between systems. You can place all the objects you wish onto a transport of copies, export it, and import the transport into the new system. The starting point is transaction SE09. You might need the help/approval of a system administrator, depending on your rights, etc. This is the simplest and best way to do it.
    If you should wish to develop your solution, look at CL_BSP_API_GENERATE. It is an API to create BSP applications.
    You can also look at our own report BSP_EXPORT_CLASSES (transaction SE38) that we use to dump BSP applications into text files. We use it for checking that our SP systems are in sync with our development system.
    brian

  • Download BSP Application Source Code for Backup

    Dear All,
        Is there any way, I can download the whole BSP Application as a Text or HTML or DOC file, for backup purpose?
    Thank you.
    Regards
    Gladson

    have you seen this code sample
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3330a5e1-0701-0010-6e81-e88984de611a">Tool to Download Complete BSP Application</a>
    Regards
    Raja

Maybe you are looking for