获取照片信息

MODULE DISPLAY_PICTURE OUTPUT.
  DATA: REPID LIKE SY-REPID.
  DATA:L_RESULT TYPE I.
  REPID = SY-REPID.

  IF PICTURE IS INITIAL.                                    "TC_0100
    CREATE OBJECT WCL_CONTAINER_PHOTO
      EXPORTING
        CONTAINER_NAME = 'TC_0300'.
*Object To Create the Custom Container
    CREATE OBJECT PICTURE
      EXPORTING
        PARENT = WCL_CONTAINER_PHOTO.
    CHECK SY-SUBRC = 0.
*Method To Set Position of Image
*    CALL METHOD PICTURE->SET_POSITION
*      EXPORTING
*        HEIGHT = 47
*        LEFT   = 610
*        TOP    = 25
*        WIDTH  = 70.
  ELSE.
*Function Module To Reset Image
    CALL FUNCTION 'HR_IMAGE_RESET'
      EXPORTING
        HANDLE         = HANDLE
      EXCEPTIONS
        INVALID_HANDLE = 1
        OTHERS         = 2.
    IF SY-SUBRC <> 0.
    ENDIF.
  ENDIF.

  CLEAR:P_CONNECT_INFO,P_CONNECT_INFO[],URL.
*FUNCTION MODULE TO CHECK EXISTANCE OF IMAGE
  CALL FUNCTION 'HR_IMAGE_EXISTS'
    EXPORTING
      P_PERNR        = <PERNR_PHOTO>
    IMPORTING
      P_CONNECT_INFO = P_CONNECT_INFO
    EXCEPTIONS
      OTHERS         = 2.
  P_DOCUMENT_TYPE = P_CONNECT_INFO-RESERVE.
*Function Module To Get the URL of Image
  CALL FUNCTION 'SCMS_DOC_URL_READ'
    EXPORTING
      STOR_CAT    = SPACE
      CREP_ID     = P_CONNECT_INFO-ARCHIV_ID
      DOC_ID      = P_CONNECT_INFO-ARC_DOC_ID
      COMP_ID     = 'DATA'
      DP_URL_ONLY = 'X'
    IMPORTING
      URL         = URL
    EXCEPTIONS
      OTHERS      = 10.
  IF SY-SUBRC <> 0.
  ENDIF.
*Method To Set Display Mode Fit to Container
  CALL METHOD PICTURE->SET_DISPLAY_MODE
    EXPORTING
      DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT.
*Method To load Image from URL
  CALL METHOD PICTURE->LOAD_PICTURE_FROM_URL_ASYNC
    EXPORTING
      URL = URL.

ENDMODULE.

 

posted @ 2019-03-19 22:58  蜡哲图  阅读(311)  评论(0编辑  收藏  举报
目录内容