Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

Embedding Flash content in SAP GUI

$
0
0

Embedding Flash content in SAP GUI

 

 

We as ABAP Developers are always interested in making SAP more and more interesting as well as take things to the extreme. In this post I will try to embed a Flash animation in the SAP GUI.

Embedding Flash animations, unlike images, cannot be done by uploading content in SWO0 and then using a function module to fetch the content. Instead, the content needs to be displayed in a container which will somehow support flash content. We know that flash content is easily displayed in web browsers and thus can be displayed in SAP GUI as well if we are able to create a container for HTML content. There is a simple report available in SAP which helps us create a container for HTML in SAP GUI. You can go to SE38 or SE80 to check the report SAPHTML_DEMO1. This is a good example of cl_gui_html_viewer.

The report is quite simple to understand for an ABAPer and we can copy the report and screens and then customize the container using screen painter.

Given below is an example on a demo I made for test purposes.

 

gif.gif

(link: http://cdn.makeagif.com/media/8-01-2013/Cjh2Qa.gif)


Here, instead of linking the container's HTML content to a web page, I linked it to the swf object in a local drive. However, the flash object can be placed in

banner.jpg

a web server or an FTP server so that the content is available to all users. You may also upload the swf file in the MIME repository of a BSP application from where you can directly access the file.

 

 

The benefits of embedding a flash animation in SAP are many. For example, the customer might be intrigued by the idea that there exists a dynamic content in a particular SAP transaction where the user can view a demo or presentation. Interactive Flash animations can also serve many more purposes and extends the capabilities of SAP.

 

I know that you would like to try this for yourself, so check the above mentioned demo report or the code below. To get the report working you need to draw a custom container named 'HTML' in screen 100 of the report and a use the menu painter to enable the back button.

 

 

 

 

 

 

 

 

 


 

*&---------------------------------------------------------------------*

*& Report  ZTEST_GAURAB_01

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

 

 

REPORT ztest_gaurab_01 MESSAGE-ID z1.

 

 

DATA: html_control TYPE REF TO cl_gui_html_viewer,

      my_container TYPE REF TO cl_gui_custom_container,

      fcode LIKE sy-ucomm,

      edurl(2048),

      alignment TYPE i.

 

 

SET SCREEN 100.

 

 

*&---------------------------------------------------------------------*

*&      Module  STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*

MODULE status_0100 OUTPUT.

  SET PF-STATUS 'TESTHTM1'.

  SET TITLEBAR '001'.

 

 

  IF my_container IS INITIAL.

 

 

    CREATE OBJECT my_container

        EXPORTING

            container_name = 'HTML'

        EXCEPTIONS

            others = 1.

    CASE sy-subrc.

      WHEN 0.

*

      WHEN OTHERS.

        RAISE cntl_error.

    ENDCASE.

  ENDIF.

 

 

  IF html_control IS INITIAL.

    CREATE OBJECT html_control

         EXPORTING

              parent    = my_container.

    IF sy-subrc NE 0.

      RAISE cntl_error.

    ENDIF.

 

 

    PERFORM load_home_page.

  ENDIF.

ENDMODULE.                             " STATUS_0100  OUTPUT

 

 

*&---------------------------------------------------------------------*

*&      Module  USER_COMMAND_0100  INPUT

*&---------------------------------------------------------------------*

MODULE user_command_0100 INPUT.

 

 

  CASE fcode.

    WHEN 'BACK'.

      IF NOT html_control IS INITIAL.

        CALL METHOD html_control->free.

        FREE html_control.

      ENDIF.

      IF NOT my_container IS INITIAL.

        CALL METHOD my_container->free

          EXCEPTIONS

            OTHERS = 1.

        IF sy-subrc <> 0.

*         MESSAGE E002 WITH F_RETURN.

        ENDIF.

        FREE my_container.

      ENDIF.

 

 

      LEAVE PROGRAM.

 

 

    WHEN OTHERS.

      CALL METHOD cl_gui_cfw=>dispatch.

 

 

  ENDCASE.

  CLEAR fcode.

ENDMODULE.                             " USER_COMMAND_0100  INPUT

 

 

* Homepage form

FORM load_home_page.

  DATA: doc_url(80).

 

 

    doc_url = 'U:\Desktop\banner.swf'.

    CALL METHOD html_control->show_url

         EXPORTING

              url       = doc_url.

 

 

ENDFORM.                               " LOAD_HOME_PAGE



Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>