Monday, April 14, 2008

Picture Control

Steps:

  • Create a screen
  • Place a custom container for the picture on the screen. Name the container GO_PICTURE_CONTAINER.
* Type pool for using SAP icons 
TYPE-POOLS: icon. 
* Declarations
DATA:
  go_picture                 TYPE REF TO cl_gui_picture,
  go_picture_container  TYPE REF TO cl_gui_custom_container.
MODULE status_0100 OUTPUT.
  IF go_picture_container IS INITIAL.
*   Create obejcts for picture and container and
*   setup picture control
    CREATE OBJECT go_picture_container
      EXPORTING
        container_name = 'PICTURE_CONTAINER'.
    CREATE OBJECT go_picture
      EXPORTING
        parent = go_picture_container.
*   Set display mode (Stretching, original size etc.)
    CALL METHOD go_picture->set_display_mode
      EXPORTING
        DISPLAY_MODE = CL_GUI_PICTURE=>display_mode_fit_center
        EXCEPTIONS      = 1
*   Load picture from SAP Icons. To oad a picture from an URL use method load_picture_from_url
    CALL METHOD go_picture->load_picture_from_sap_icons
      EXPORTING
         icon             = icon_delete
         EXCEPTIONS error = 1.
  ENDIF.
ENDMODULE.     

No comments:

Blog Archive