屏幕上显示 SE78 图片

以下实例在屏幕9100上显示SE78上传的图片

 

屏幕9100里面创建一个容器控件,逻辑流:

PROCESS BEFORE OUTPUT.
 MODULE STATUS_9100.
*
PROCESS AFTER INPUT.
 MODULE exit_prog.
 MODULE USER_COMMAND_9100.

 

 

主程序代码:

DATA: ok_code TYPE sy-ucomm.


START-OF-SELECTION.
  CALL SCREEN 9100.
*&---------------------------------------------------------------------*
*&      Module  EXIT_PROG  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE exit_prog INPUT.
  LEAVE PROGRAM.
ENDMODULE.                 " EXIT_PROG  INPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_9100 INPUT.

ENDMODULE.                 " USER_COMMAND_9100  INPUT
*&---------------------------------------------------------------------*
*&      Module  STATUS_9100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_9100 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
  TYPES: pict_line(256TYPE c.
  DATA: container TYPE REF TO cl_gui_custom_container,
        picture TYPE REF TO cl_gui_picture,
        pict_tab TYPE TABLE OF pict_line,
        url(255TYPE c.

  DATA: graphic_url(255TYPE c,
        l_graphic_xstr TYPE xstring,
        l_graphic_size TYPE i,
        l_graphic_off TYPE i,
        l_graphic_conv TYPE i.

  DATA: BEGIN OF graphic_table OCCURS 0,
          line(255TYPE x,
        END OF graphic_table.

  CALL METHOD cl_gui_cfw=>flush.

  CREATE OBJECT container
    EXPORTING
      container_name 'PICTURE_CONTAINER'.

  CREATE OBJECT picture
    EXPORTING
      parent container.

  CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
    EXPORTING
      p_object 'GRAPHICS'
      p_name   'PIC_TEST'
      p_id     'BMAP'
      p_btype  'BCOL'
    RECEIVING
      p_bmp    l_graphic_xstr.

  l_graphic_size XSTRLENl_graphic_xstr ).
  l_graphic_off 0.
  l_graphic_conv l_graphic_size.

  WHILE l_graphic_conv > 255.
    graphic_table-line l_graphic_xstr+l_graphic_off(255).
    APPEND graphic_table.
    l_graphic_off l_graphic_off + 255.
    l_graphic_conv l_graphic_conv 255.
  ENDWHILE.
  graphic_table-line l_graphic_xstr+l_graphic_off(l_graphic_conv).
  APPEND graphic_table.

  CALL FUNCTION 'DP_CREATE_URL'
    EXPORTING
      type                       'IMAGE'
      subtype                    'X-UNKNOWN'
     size                       l_graphic_size
*     DATE                       =
*     TIME                       =
*     DESCRIPTION                =
*     LIFETIME                   = 'T'
*     CACHEABLE                  =
*     SEND_DATA_AS_STRING        =
*     FIELDS_FROM_APP            =
    TABLES
      data                       graphic_table
*     FIELDS                     =
*     PROPERTIES                 =
*     COLUMNS_TO_STRETCH         =
    CHANGING
      url                        url.

  CALL METHOD picture->load_picture_from_url
    EXPORTING
      url url.

  CALL METHOD picture->set_display_mode
    EXPORTING
      display_mode picture->display_mode_fit_center.

ENDMODULE.                 " STATUS_9100  OUTPUT

 

 

你可能感兴趣的:(object,properties,command,url,input,output)