*&---------------------------------------------------------------------*
*& Report ZHR_EMPLOYEE_IMAGE_DISPLAY
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zhr_employee_image_display.
"To display employee photo from PA30 to module pool custom container
***Variable Declaration
DATA : handle TYPE i,
p_exists TYPE c,
p_connect_info LIKE toav0,
gv_initialize TYPE flag,
p_pernr TYPE pa0001-pernr.
START-OF-SELECTION.
"Screen with custom Container
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'ENTER' OR ' '.
IF p_pernr IS NOT INITIAL.
"Variable Clear
CLEAR: p_exists, p_connect_info.", handle.
"Below funtion module to check if the photo exists for the employee
CALL FUNCTION 'HR_IMAGE_EXISTS'
EXPORTING
p_pernr = p_pernr
p_tclas = 'A'
p_begda = '19100101'
p_endda = '99991231'
IMPORTING
p_exists = p_exists
p_connect_info = p_connect_info
EXCEPTIONS
error_connectiontable = 1
OTHERS = 2.
IF sy-subrc <> 0.
gv_initialize = abap_false.
"Below function module to display the blank in the screen if no photo exists for the employee
CALL FUNCTION 'HR_IMAGE_SHOW'
EXPORTING
p_pernr = p_pernr
p_tclas = 'A'
handle = handle
EXCEPTIONS
invalid_handle = 1
no_document = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
"Below function module to reset the image in the screen
CALL FUNCTION 'HR_IMAGE_RESET'
EXPORTING
handle = handle
EXCEPTIONS
invalid_handle = 1
OTHERS = 2.
ENDIF.
ELSE.
IF gv_initialize = abap_false.
"Below function module to initialize the custom container to displaye the photo for the employee
CALL FUNCTION 'HR_IMAGE_INIT'
EXPORTING
p_pernr = p_pernr
p_tclas = 'A'
container = 'IMAGE'
IMPORTING
handle = handle
EXCEPTIONS
no_document = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc IS INITIAL.
gv_initialize = abap_true.
"Below function module to display the photo in the screen if photo exists for the employee
CALL FUNCTION 'HR_IMAGE_SHOW'
EXPORTING
p_pernr = p_pernr
p_tclas = 'A'
handle = handle
EXCEPTIONS
invalid_handle = 1
no_document = 2
internal_error = 3
OTHERS = 4.
ENDIF.
ELSE.
CALL FUNCTION 'HR_IMAGE_SHOW'
EXPORTING
p_pernr = p_pernr
p_tclas = 'A'
handle = handle
EXCEPTIONS
invalid_handle = 1
no_document = 2
internal_error = 3
OTHERS = 4.
ENDIF. " SY-SUBRC IS INITIAL.
ENDIF.
ENDIF.
ENDCASE.
ENDMODULE.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |