Skip to end of metadata
Go to start of metadata

-----* We have to make one container, on that container we will display our logo   *------

              Don't forget to pass the name of logo in 'WWW_GET_MIME_OBJECT' Fun Mod

*&---------------------------------------------------------------------*
*& Report  YKC_ALV_OOPS_LOGO_DISPALY
*& Programmer : Krishna Chauhan
*& Dt:          18 Dec 08            
*&---------------------------------------------------------------------*
*&This prog will display LOGO
*&
*&---------------------------------------------------------------------*
REPORT  YKC_ALV_OOPS_LOGO_DISPALY.
TYPE-POOLS cndp.
*----declaration for logo display custom container
DATA  url(132).
* custom container
DATA pic_container TYPE REF TO cl_gui_custom_container.
* picture Control.
DATA picture TYPE REF TO cl_gui_picture.
* Definition of Control Framework
CLASS cl_gui_cfw DEFINITION LOAD.
  CALL SCREEN 100.
endform.                    " field_catalog
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
module STATUS_0100 output.
* create the custom container
    CREATE OBJECT pic_container
                  EXPORTING container_name = 'CUSTOM'. "name given in screen container
* create the picture control
* create the picture control
    CREATE OBJECT picture
                  EXPORTING parent = pic_container.
* Request an URL from the data provider by exporting the pic_data.
    CLEAR url.
    PERFORM load_pic_from_db CHANGING url.
* load picture
    CALL METHOD picture->load_picture_from_url
      EXPORTING
        url = url.
*    init = 'X'.
    CALL METHOD cl_gui_cfw=>flush
      EXCEPTIONS
        cntl_system_error = 1
        cntl_error        = 2.
    IF sy-subrc <> 0.
* error handling
    ENDIF.
endmodule.                 " exit  INPUT
*&---------------------------------------------------------------------*
*&      Form  LOAD_PIC_FROM_DB
*&---------------------------------------------------------------------*
*       text : loading logo
*----------------------------------------------------------------------*
FORM load_pic_from_db  CHANGING p_url.
  DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
  DATA html_table LIKE w3html OCCURS 1.
  DATA return_code LIKE  w3param-ret_code.
  DATA content_type LIKE  w3param-cont_type.
  DATA content_length LIKE  w3param-cont_len.
  DATA pic_data LIKE w3mime OCCURS 0.
  DATA pic_size TYPE i.
  REFRESH query_table.
  query_table-name = '_OBJECT_ID'.
  query_table-value = 'ENJOYSAP_LOGO'."name of logo
  APPEND query_table.
  CALL FUNCTION 'WWW_GET_MIME_OBJECT'
    TABLES
      query_string        = query_table
      html                = html_table
      mime                = pic_data
    CHANGING
      return_code         = return_code
      content_type        = content_type
      content_length      = content_length
    EXCEPTIONS
      object_not_found    = 1
      parameter_not_found = 2
      OTHERS              = 3.
  IF sy-subrc = 0.
    pic_size = content_length.
  ENDIF.
  CALL FUNCTION 'DP_CREATE_URL'
    EXPORTING
      type     = 'image'
      subtype  = cndp_sap_tab_unknown
      size     = pic_size
      lifetime = cndp_lifetime_transaction
    TABLES
      data     = pic_data
    CHANGING
      url      = url
    EXCEPTIONS
      OTHERS   = 1.
ENDFORM.                    " LOAD_PIC_FROM_DB