2010년 12월 27일 월요일

Massive upload of employee photos in HR

You have to use a BDC program for mass upload or upload individually through OAAD.

Use the FM ARCHIV_CREATE_DIALOG_META for upload of Photo, Since the recording of OAAD will pop-up a dialog window.

chk this source code.

*Table for filling screen
DATA: BEGIN OF t_record OCCURS 0,
pernr(12) TYPE c, "Employee Number
path(255) TYPE c, "photo path
END OF t_record.

LOOP AT t_record.

* Since the employee photo is always stored in 0002 infotype, we need to
* concatenate the employee id with preceeding zeros and pad "0002" in
* right into the pernr field which will be passed to object_id

* Any unwanted leading zeros deleted

SHIFT t_record-pernr LEFT DELETING LEADING '0'.

* Any leading space is removed

CONDENSE t_record-pernr.

* 0002 is concatenated to the emp id

CONCATENATE t_record-pernr '0002' INTO t_record-pernr.

* Push the contents of pernr into pernr_zero since its a NUMC type field
* and hence zeros will be padded automatically by the system

w_pernr_zero = t_record-pernr.

* Now pernr will be having zero padding

CLEAR w_pernr_pass.
w_pernr_pass = w_pernr_zero.

* from "ARCHIV_CREATE_DIALOG_META"


CALL FUNCTION 'ARCHIV_CREATE_DIALOG_META'
EXPORTING
archiv_id = 'A1'
ar_object = 'HRICOLFOTO'
object_id = w_pernr_pass
sap_object = 'PREL'
file = t_record-path.
IF sy-subrc 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDLOOP.

Hope this helps you.

=======================================
Santhosh Kumar R

https://forums.sme.sap.com/thread.jspa?threadID=666964&tstart=-7&messageID=5963940



=======================================
ARCHIV_CREATE_FILE