Skip to Content

Hello, attached an example to see the photo of employee by number of personnel in a DYNPRO.Variable “PERNR” is the number of personnel.

You have to create a container in the DYNPRO with the name of “PHOTO” and call the form.

CODE:

DATA: PERNR TYPE PERNR_D.

DATA: URI LIKE  TOAURIURI.

DATA: G_RESULT TYPE I.

DATA: H_PICTURE       TYPE REF TO CL_GUI_PICTURE.
DATA: H_PIC_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

FORM PHOTO.

CLEAR URI.

CALL FUNCTION ‘HRWPC_RFC_EP_READ_PHOTO_URI’
EXPORTING
PERNR =   PERNR
IMPORTING
   URI = URI
EXCEPTIONS
  NOTHING_FOUND = 1
  NO_AUTHORIZATION = 2
  INTERNAL_ERROR = 3.

IF SYSUBRC = 0.
      IF H_PIC_CONTAINER IS INITIAL.
       CREATE OBJECT H_PIC_CONTAINER
           EXPORTING CONTAINER_NAME ‘PHOTO’.
       CREATE OBJECT H_PICTURE EXPORTING PARENT = H_PIC_CONTAINER.
    ENDIF.

    CALL METHOD H_PICTURE->LOAD_PICTURE_FROM_URL
         EXPORTING URL    = URI
         IMPORTING RESULT = G_RESULT.

    CALL METHOD H_PICTURE->SET_DISPLAY_MODE
       EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER.
       CALL METHOD H_PICTURE->SET_DISPLAY_MODE
       EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER.
      CALL METHOD CL_GUI_CFW=>FLUSH.

ELSEIF H_PICTURE IS NOT INITIAL.
        CALL METHOD H_PICTURE->CLEAR_PICTURE.
ENDIF.

ENDFORM.

Regards.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply