《年人力资源知识上传个人照片到信息类型 页》由会员分享,可在线阅读,更多相关《年人力资源知识上传个人照片到信息类型 页(8页珍藏版)》请在金锄头文库上搜索。
1、HR上传个人照片到信息类型T-CODE SPRO选择EDIT DOCUMENT TYPES复制或者新建一个文档类别为JPG的复制或者创建PREL是T-CODE OAAD查看如果要在前台右边直接显示照片 则要用特定的文档对象(下图)下面这个程序 适合前台和后台操作REPORT ZYAOWEI_007.*PARAMETERS: P_UNXDIR LIKE RLGRAP-FILENAME DEFAULT /kaoqin/INPUT/00000040.jpg.PARAMETERS: P_UNXDIR LIKE RLGRAP-FILENAME DEFAULT /usr/sap/HRD/DVEBMGS00
2、/data/00000040.JPG.DATA : BEGIN OF INFILE_DATA OCCURS 0, IN_LINE(80) type c,END OF INFILE_DATA.DATA : begin of inrec,raw(1024) type x,end of inrec.DATA : begin of itab occurs 0,raw(1024) type x,end of itab.Data: WS_FILENAME TYPE STRING,WS_OBJID LIKE SAPB-SAPOBJID,WS_FILELENGTH TYPE I,WS_FLENGTH LIKE
3、 SAPB-LENGTH.*START-OF-SELECTION.open dataset P_UNXDIR for input in binary mode.do.* Read file one record at a time in binary mode.clear inrec.read dataset P_UNXDIR into inrec maximum length 1024 actual length ws_filelength.* Determine accumulated file length as each record read in.ws_flength = ws_f
4、length + ws_filelength.* Last record of file will cause sy-subrc to not be 0 and will be* less in length than record size.if ws_flength 0.move inrec to itab.append itab.endif.* end loop at end of file.if sy-subrc ne 0.exit. end of file must have been reachedendif.enddo.close dataset WS_FILENAME.* Ad
5、d picture file to content server for specific associate.CALL FUNCTION ARCHIV_CREATE_TABLEEXPORTING ar_object = HRICOLFOTOobject_id = 000000400002sap_object = PRELflength = WS_FLENGTHTABLES binarchivobject = ITAB.IF SY-SUBRC = 0.WRITE : / WS_OBJID+0(8), - picture loaded: , WS_FILENAME, - length: , WS
6、_FLENGTH.else. WRITE : / WS_OBJID+0(8), - Unable to load pic: , WS_FILENAME, - length: , WS_FLENGTH.ENDIF.clear INFILE_DATA-IN_LINE.下面这个程序 只适合前台SELECTION-SCREEN BEGIN OF BLOCK radio1 WITH FRAME TITLE text-001.PARAMETERS:P_FILE TYPE LOCALFILE.SELECTION-SCREEN END OF BLOCK radio1.END-OF-SELECTION.DATA
7、: archiv_id LIKE toav0-archiv_id, arc_doc_id LIKE toav0-arc_doc_id, ftype LIKE TOADV-DOC_TYPE.DATA:RETURN TYPE TOADT OCCURS 0 WITH HEADER LINE.CALL FUNCTION ARCHIV_CREATE_DIALOG_META EXPORTING* ARCHIV_ID = ar_object = HRICOLFOTO* DEL_DATE = * NOTE = object_id = 000000500002 sap_object = PREL* FILE =
8、 XueqiangSharedDocs3600000040.JPGFILE = 192.168.118.159tichenginput00000050.JPG* COMMIT_FLAG = IMPORTING ARCHIV = archiv_id ARCHIV_DOC_ID = arc_doc_id DOCUMENTCLASS = ftype TABLES OUTDOCTAB = RETURN* CHANGING* INFILETAB = EXCEPTIONS ERROR_ARCHIV = 1 ERROR_COMMUNICATIONTABLE = 2 ERROR_CONNECTIONTABLE = 3 ERROR_KERNEL = 4 ERROR_PARAMETER = 5 ERROR_SCANQUEUE = 6 CANCELED_BY_USER = 7 OTHERS = 8 .IF sy-subrc 0. MESSAGE FAILED TYPE I.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ELSE. MESSAGE FINISH TYPE I.ENDIF.