SAPABAPHR上传下载员工照片_第1页
SAPABAPHR上传下载员工照片_第2页
SAPABAPHR上传下载员工照片_第3页
SAPABAPHR上传下载员工照片_第4页
SAPABAPHR上传下载员工照片_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、上传下载员工照片(HR Photo)批量上传图片*&-*& Report ZCHJ_HR001*&*&-*&*&*&*REPORT Z_BARRY_HR_PHOTO_UPLOAD.TABLES :PA0001.DATA: SAPOBJID LIKE SAPB-SAPOBJID, SAPPFAD LIKE SAPB-SAPPFAD.DATA: GD_PATH TYPE STRING , FILETAB TYPE TABLE OF FILE_INFO WITH HEADER LINECOUNT TYPE I .DATA: FILENAME( 40) TYPE C ,FILEEXT( 10) TYP

2、E C ,LEN TYPE I .PARAMETERS: FILEPATH LIKE RLGRAP-FILENAME. 上传文件夹路径AT SELECTION- SCREEN ON VALUE-REQUEST FOR FILEPATH.CALL METHOD CL_GUI_FRONTEND_SERVICES=DIRECTORY_BROWSE EXPORTINGWINDOW_TITLE =File DirectoryINITIAL_FOLDER =C:CHANGINGSELECTED_FOLDER = GD_PATH.CALL METHOD CL_GUI_CFW=FLUSH.CONCATENAT

3、E GD_PATH INTO FILEPATH.精选START- OF-SELECTION.GD_PATH = FILEPATH .CALL METHOD CL_GUI_FRONTEND_SERVICES=DIRECTORY_LIST_FILESEXPORTINGDIRECTORY= GD_PATHFILTER=*jpgCHANGINGFILE_TABLE= FILETABCOUNT=COUNTEXCEPTIONS TOC o 1-5 h z CNTL_ERROR=1DIRECTORY_LIST_FILES_FAILED =2WRONG_PARAMETER =3ERROR_NO_GUI=4NO

4、T_SUPPORTED_BY_GUI =5OTHERS=6.判断图片编号是否等于8位LOOP AT FILETAB.SPLIT FILETAB-FILENAME AT : INTO FILENAME FILEEXT.LEN = STRLEN ( FILENAME ).IF LEN 8 .MESSAGE E000(OO) WITH 文件名长度必须等于 8位.ENDIF .ENDLOOP.LOOP AT FILETAB.判断员工编号是否存在SELECT SINGLE *FROM PA0001WHEREPERNR = FILETAB-FILENAME+ 0( 8).IF SY-SUBRC =0.判断

5、员工编号是否已过期 SELECT SINGLE *FROM PA0001WHEREPERNR = FILETAB-FILENAME+ 0( 8) AND BEGDA = SY-DATUM.IF SY-SUBRC =0.CONCATENATE GD_PATH FILETAB-FILENAME INTO SAPPFAD. CONCATENATE FILETAB-FILENAME+ 0( 8) 0002 INTO SAPOBJID. CALL FUNCTION ARCHIV_CREATE_FILE EXPORTINGAR_OBJECT =HRICOLFOTOOBJECT_ID = SAPOBJID精

6、选SAP_OBJECT =PRELDOC_TYPE=JPGPATH= SAPPFAD TOC o 1-5 h z EXCEPTIONS ERROR_CONECTIONTABLE=1ERROR_PARAMETER =2ERROR_ARCHIV=3ERROR_UPLOAD=4ERROR_KERNEL=5NO_ENTRY_POSSIBLE =6ERROR_COMUNICATIONTABLE =7OTHERS=8.IF SY-SUBRC 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3

7、 SY-MSGV4. ELSE. WRITE :/ Upload ,SAPPFAD, To pernr ,FILETAB-FILENAME+ 0( 8), Sccuess! . | ENDIF . ELSE. WRITE : / ERROR ,SAPPFAD,此员工编号,FILETAB-FILENAME+ 0(8),已过期!. ENDIF . ELSE. WRITE : / ERROR ,SAPPFAD,此员工编号,FILETAB-FILENAME+ 0(8),不存在!. ENDIF . ENDLOOP. 输入屏幕: 图生E传|上也怦灭路径I回输出屏幕:批量下载图片精选REPORT Z_BAR

8、RY_HR_PHOTO_DOWN.DATA: COMPS2 TYPE STANDARD TABLE OF SCMS_DOINF WITH HEADER LINE , COMP_NAMES TYPE STANDARD TABLE OF SCMS_DONAM WITH HEADER LINEPARAMETERS P_PERNR LIKE PA0001-PERNR.PERFORM PHOTO_DOWN USING P_PERNR A1800010199991231 D:abc.jpg*&-*& Form URL_GET*&-*FORM PHOTO_DOWN USING P_PERNR LIKEPER

9、NR-PERNRP_TCLASLIKEPSPAR-TCLASP_BEGDALIKEPRELP-BEGDAP_ENDDALIKEPRELP-ENDDAPATHTYPE C .DATA: L_CONNECT_INFO LIKE TOAV0, L_EXISTS(1) TYPE C .CALL FUNCTION HR_IMAGE_EXISTS EXPORTING P_PERNR= P_PERNRP_TCLAS= P_TCLASP_BEGDA= P_BEGDAP_ENDDA= P_ENDDAIMPORTINGP_EXISTS= L_EXISTSP_CONNECT_INFO = L_CONNECT_INF

10、OEXCEPTIONSOTHERS =2.IF SY-SUBRC 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 .EXIT .ENDIF .CALL FUNCTION SCMS_DOC_READ_FILES EXPORTING STOR_CAT = SPACE CREP_ID= L_CONNECT_INFO-ARCHIV_IDDOC_ID= L_CONNECT_INFO-ARC_DOC_IDPATH= PATH精选FRONTEND =XTABLESCOMPS

11、= COMPS2COMP_NAMES = COMP_NAMESEXCEPTIONS TOC o 1-5 h z BAD_STORAGE_TYPE =1BAD_REQUEST=2UNAUTHORIZED=3NOT_FOUND =4CONFLICT =5INTERNAL_SERVER_ERROR =6ERROR_HTTP=7ERROR_SIGNATURE=8ERROR_CONFIG =9ERROR_HIERARCHY=10ERROR_DOWNLOAD=11ERROR_OPEN=12ERROR_PARAMETER=13ERROR=14OTHERS=15.IF SY-SUBRC 0.MESSAGE I

12、D SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 .ENDIF .ENDFORMphoto_downABAP-通过ARCHIV_CREATE_FILE 上传员工照片(代码摘抄OAOH)单个上传图片*Copyright 2004 C-Bons Wuhan*All Rights Reserved*-*Program Name : ZHRIPHOTO* TOC o 1-5 h z Project : SAP Implementation Project*Program Title:照片导入

13、*精选Created by : DEV01 *Created on : 2007/09/15 *Version : 1.0 *-入* -* Data Table List: *-* Refrence Table List: *-* Modification Log: * Date Programmer Correction Number * * REPORT ZHRIPHOTO NO STANDARD PAGE HEADING LINE - SIZE 255 MESSAGE- ID ZDEV .*I N T E R N A L T A B L E SDATA : BEGIN OF GT_PHO

14、TO OCCURS 0,PERNR( 8),END OF GT_PHOTO.DATA: G_PATH LIKE DRAW-FILEP,G_SAPOBJIDLIKE SAPB-SAPOBJID,G_FILENAMETYPE STRING,G_SAPPFAD LIKE SAPB-SAPPFAD.PARAMETERS: P_FILE LIKE RLGRAP-FILENAME OBLIGATORY. 文件路径精选Function Description: *照片导*& Initialization *INITIALIZATION .CONCATENATE sy-uname sy-datum+4(4)

15、INTO group.*START-OF-SELECTION*AT SELECTION- SCREEN ON VALUE-REQUEST FOR P_FILE. CALL FUNCTION WS_FILENAME_GETEXPORTING DEF_FILENAME =DEF_PATH =C:MASK=,Text Files,*.txt;*.prn,All Files,*.*.MODE=OTITLE =选取导入文件(100 )IMPORTINGFILENAME = P_FILEEXCEPTIONS TOC o 1-5 h z INV_WINSYS =1NO_BATCH =2SELECTION_C

16、ANCEL=3SELECTION_ERROR=4OTHERS =5.IF SY-SUBRC 0 AND SY-SUBRC 3.(007 ).MESSAGE E102(ZDEV) WITH Error Selecting File ENDIF .*START-OF-SELECTION*START- OF-SELECTION.G_PATH = P_FILE.CALL FUNCTION CV120_SPLIT_PATHEXPORTINGPF_PATH = G_PATHIMPORTINGPFX_PATH = G_PATH.精选G_FILENAME = P_FILE.CALL FUNCTION GUI_

17、UPLOADEXPORTINGFILENAME= G_FILENAMEFILETYPE= ASChas_field_separator = X TOC o 1-5 h z * dat_mode= XTABLES DATA_TAB= GT_PHOTOEXCEPTIONSFILE_OPEN_ERROR =1FILE_READ_ERROR =2NO_BATCH=3GUI_REFUSE_FILETRANSFER =4INVALID_TYPE =5NO_AUTHORITY =6UNKNOWN_ERROR =7BAD_DATA_FORMAT =8HEADER_NOT_ALLOWED =9SEPARATOR

18、_NOT_ALLOWED =10HEADER_TOO_LONG =11UNKNOWN_DP_ERROR =12ACCESS_DENIED =13DP_OUT_OF_MEMORY =14DISK_FULL =15DP_TIMEOUT =16OTHERS=17.IF SY-SUBRC 0.MESSAGE S306 .ENDIF .LOOP AT GT_PHOTO.CONCATENATE G_PATH GT_PHOTO-PERNR.JPG INTO G_SAPPFAD.CONCATENATE GT_PHOTO-PERNR 0002INTO G_SAPOBJID.CALL FUNCTION ARCHIV_CREATE_FILEEXPORTINGAR_OBJECT=HRICOLFOTOOBJECT_ID= G_SAPOBJIDSAP_OBJECT =PRELDOC_TYPE=JPGPATH= G_SAPPFADEXCEPTIONS精选 TOC o 1-5 h z ERROR_CONECTIONTABLE=1ERROR_PAR

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论