On uploading a photo identity
firstly thanks for replying to my previous thread. Now i have another scenario where i need to upload employee photo identity in my module pool programming!. Can anyone help me out with the code and step by step by procedure.
Valter Oliveira replied
If you want to do that you can follow this steps:
1 - upload those 20 employee photos in MIME repository (nothing to do with HR), giving a proper name like PHOTO_"number of employee".
2 - Since it's not an HR functionallity, you cannot use those HR FM's that I proposed before. Now you have to do like this:
Create a custom container in screen painter (called container)
DATA: container TYPE REF TO cl_gui_custom_container, logo TYPE REF TO cl_gui_picture. DATA: url(255) TYPE c. DATA: query_table LIKE w3query OCCURS 1 WITH HEADER LINE, html_table LIKE w3html OCCURS 1, return_code LIKE w3param-ret_code, content_type LIKE w3param-cont_type, content_length LIKE w3param-cont_len, pic_data LIKE w3mime OCCURS 0, pic_size TYPE i.
Befor calling screen,
CLEAR: container, logo, url.
In PBO of the screen
* Do only once CHECK url IS INITIAL. * Inicialize container object IF container IS INITIAL. CREATE OBJECT container EXPORTING container_name = 'CONTAINER' EXCEPTIONS OTHERS = 1. IF sy-subrc NE 0. EXIT. ENDIF. ENDIF. * Inicialize logo object, referencing to container object IF logo IS INITIAL. CREATE OBJECT logo EXPORTING parent = container EXCEPTIONS OTHERS = 1. IF sy-subrc NE 0. EXIT. ENDIF. ENDIF. REFRESH query_table. query_table-name = '_OBJECT_ID'. query_table-value = 'PHOTO_00000012'. "Name of the uploaded image APPEND query_table. * GET MIME CALL FUNCTION 'WWW_GET_MIME_OBJECT' TABLES query_string = query_table html = html_table mime = pic_data CHANGING return_code = return_code content_type = content_type content_length = content_length EXCEPTIONS object_not_found = 1 parameter_not_found = 2 OTHERS = 3. IF sy-subrc = 0. pic_size = content_length. ENDIF. * DISPLAY data CALL FUNCTION 'DP_CREATE_URL' EXPORTING type = 'image' subtype = cndp_sap_tab_unknown size = pic_size lifetime = cndp_lifetime_transaction TABLES data = pic_data CHANGING url = url EXCEPTIONS OTHERS = 1. CALL METHOD logo->load_picture_from_url EXPORTING url = url EXCEPTIONS OTHERS = 1.
And that's it !!!