와글와글 잡담2013. 5. 23. 17:50

-------------------------------------------------------------------------------------------------

Layout

-------------------------------------------------------------------------------------------------

<%@page language="abap"%>




<script language="javascript">

  function doInit(){

    window.open('<%=e_url%>');

  }

</scrip>



<html>

  <body onLoad="doInit()">

    <%=e_url%>

  </body>

</html>


-------------------------------------------------------------------------------------------------

OnInitialization

-------------------------------------------------------------------------------------------------

* event handler for data retrieval


DATA: lref_cached_response TYPE REF TO cl_http_response,

      lv_guid         TYPE  guid_32,

      lv_page_name    TYPE  string,

      lt_parameters   TYPE  tihttpnvp,

      lv_file_content TYPE string,

      lv_local_url    TYPE string.


CALL FUNCTION 'SWN_CREATE_SHORTCUT' DESTINATION 'HR_RFC_ADMIN_KRD'

  EXPORTING

    i_transaction           = 'PA30'

  IMPORTING

    shortcut_string         = lv_file_content

  EXCEPTIONS

    inconsistent_parameters = 1

    OTHERS                  = 2.

IF sy-subrc <> 0.

* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.


CREATE OBJECT lref_cached_response

  EXPORTING

    add_c_msg = 1.


lref_cached_response->set_cdata( lv_file_content ).

lref_cached_response->set_header_field( name  = if_http_header_fields=>content_type

                                        value = 'application/octet-stream ' ).

lref_cached_response->if_http_response~set_status( code = 200 reason = 'OK' ).

lref_cached_response->if_http_response~server_cache_expire_rel( expires_rel = 43200 ).


CALL FUNCTION 'GUID_CREATE'

  IMPORTING

    ev_guid_32 = lv_guid.


CONCATENATE lv_guid '.sap' INTO lv_page_name.


*GET server information

CALL METHOD cl_http_ext_webapp=>create_url_for_bsp_application

  EXPORTING

    bsp_application      = runtime->application_url " mref_appl->mref_runtime->application_url

    bsp_start_page       = lv_page_name

    bsp_start_parameters = lt_parameters

  IMPORTING

    local_url            = lv_local_url

    abs_url              = e_url.


cl_http_server=>server_cache_upload( url      = e_url

                                     response = lref_cached_response ).

Posted by la30321