Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Display PHOTO employee in a DYNPRO

$
0
0

Hello, attachedan example to seethe photo ofemployeeby number of personnel in a DYNPRO.Variable "PERNR" is the number of personnel.

You have tocreate a container in the DYNPRO with the name of "PHOTO" and call the form.


 

CODE:

DATA: PERNR TYPE PERNR_D.

DATA: URI LIKE  TOAURI-URI.

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 SY-SUBRC = 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.

 


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>