版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
1、SAP ABAP DMS文檔開發(fā)1 .用至U的 BAPI: BAPI DOCUMENT CREATE2 ZBAPI_DOCUMENT_CHECKOUTVIEW2 BAPI_DOCUMENT_DELETE_DIRECT2 .其中 ZBAPI_DOCUMENT_CHECKOUTVIEWR標準的BAPI_DOCUMENT_CHECKOUTVIEW2寫(標準的在導出文檔時,會自定義一個文檔名稱);改動代碼如下:a)新增函數(shù)組ZMM CVBAPIb)將LCVBAPITOP勺定義對象拷貝至U LZMM_CVBAPITOPc)在 LZMM_CVBAPITOPft后添力口如下:INCLUDEvbapif01.
2、INCLUDECvbapif02.INCLUDEcvbapif03.INCLUDECvbapif04.INCLUDECvbapif05.INCLUDECvbapif06.INCLUDEcvbapif07.d)拷 貝 函 數(shù)BAPI DOCUMENT CHECKOUTVIEW2 至 U新ZBAPI DOCUMENT CHECKOUTVIEW添力口 IMPORT參 ORFILENAME 并修改 代碼。算1豐k藏金 止在更墳 表 就卜圜回I到副副券數(shù)鈉柴吸關(guān)聯(lián)臭型3告與司選傳”,捏文本長Kctir5arnpElike eapi忙ujt-dDDeurre nt Type alf Header oaim
3、ertDUC 叱 tiln口:L.JIH bAFlJJijr_lU£-D.d Docume nt Humibef of li evader DocuiTEnt KKUFKMTWRTLIEE EPLL - Dfftunrent 用qF Heafler DowrentKCtffiEUTra RGIuKLI KE BsPI_DO2_aUI-D.bEurrwri亡卜憧1國0of Header DOajmeiiiLDCL叱liimiLELJJ£B bAF二UCjLLtB-0 CkiQinal SiGETSTR此TLHE!LIKE F - PI_D-.C_1U?:-F.TOscu
4、9; en". Hl- dre , (Se,erd Vd nt! P :.i .O /CETOCKFOtHBTT2LIFE*rM Md£IE.桿的 3UKllikNALPATJiLIKK EiPL JJtC 1U£-K.171 PI Pitii Whara Yau Want to £h«:klflSPACE空檔占伴r:n?AHSLIKESPACEh" hane M Frormnd S 5GETLU ALitL1KLE fiiPL_JCC_4UX-F.Xd CtieLk cut heider doojmeritDOCBOIOOCEMII
5、EB良 LIEB E*PI_D0C_DB腳工kJ Chinge ngi巾至D:CEjjM7ALIDFlluILIKE BAPI_BOC_DKA¥2.kl VjU-FromOm1珥DXamVLSluaLEVEL L1JIG EiPL_BCC_DK2.d RewbKKq H汪FF_EfTTP_DBSrLUB RFCTeS-EPCDBSTSPACEQ Logical DWDnaDofl t5iMcnid h HinctJon £_ PF_FTP_iESTLITE R?CTJEE-RPTDESTSPACEM La梨dlafltsna&M (s恥 dted n Func師 j
6、 .lt_ttnp_oriBdnals TO It_orifiinals.filerMk? orfilnnito.CLEAR: ItJoriBinals dttx?.MOVT oriainalpath TO lt.QrieiTials jidtTmaB?、append It.ariginals.lf_?rror =:一EXT1F.IF lf_err&r = h X?.EXIT.EM3IFhENDIXJOPELSELODf5 AT lt_tmp_crifinals.UD¥E 1 t_tinj_air i e inal s TQ Lt_or lEinals-lt_ariginal
7、s- or fl Ltnani*.CLF%F : iT-orifinalE dttra.UQVE originalpath ID lt_original£-pathnai».ATPEXC Lt orixiaJs.EDLOQF;甘 nTiTF3 .以下為參考代碼:*文檔類型CONSTANTCon_dokar(3)VALUEZQX.*存儲類別CONSTANT:Con_storage_cat(10)VALUEDMS_C1_ST'FORMfrm creat file .DATAlv_rcTYPEjlt filetable TYPEletable WITHHEADERLINE
8、DATAlv filename TYPElep, lv_pathTYPElep.DATAlv docnumberTYPE)api doc aux-docnumber.DATAls documentdata TYPE»api doc draw2,ls documentdataxTYPE)api doc drawx2,"bapi doc draw2x, lt_objectlinks TYPETABLE(bapi_doc_drad WITHHEADERLINE lt documentfiles TYPETABLE(bgpi doc files2 WITHHEADERLINE ls
9、 returnTYPE)apiret2.DATAt_tdwp TYPETABLEOWp WITHHEADERLINE DATAnameTYPEdraw-filep, ext(64)TYPEcCALLMETHOBl gui frontend services=>file open dialog EXPORTING window title ='選擇文件' default extension ='*'CHANGING file_table =lt_filetable rc=lv rcEXCEPTIONSfile open dialog failed =1 cn
10、tl error =2 error_no_gui =3not supported by gui =4 OTHERS9.舊t filetable口 ISINITIALEXITENDIFREADTABLl旦filetable INDEXI.*解析路徑文件|PERFORMTm split path file USINGt filetable -filename CHANGINGV_filenamelv_path .name=lv filename.WHILEnameCA.'.SPLITiameAT.' INTOextname.ENDWHILECONCATENATEnameINTCna
11、me.TRANSLATEameTOLOWERCASECALLFUNCTIOICV120 DOC GET APPL' EXPORTING pf file=nameTABLESptx_tdwp =t_tdwp.IFt_tdwp口 ISINITIALMESSAGE001WITH'不支持此類型文件ENDIFREADTABLtEtdwp INDEXI.ls documentdata -documenttype =con dokar. ls_documentdata -documentversion ='00'.ls documentdata -documentpart =
12、'000'. ls_documentdata -description ='憑證描述'.ls documentdata -username=sy-uname.*ls_documentdata-ecnumber='123'.READTABLt_tdwp INDEX1.lt documentfiles -documenttype ='ZQX'.lt documentfiles -storagecategory=con storage_cat. lt documentfiles -wsapplication =t tdwp -dappl
13、.lt documentfiles -docpath =lv path. lt_documentfiles -docfile=lv_filename.lt documentfiles -checkedin='X' APPENDt_documentfiles .CALLFUNCTIOIBAPI DOCUMENT CREATE2' EXPORTINGdocumentdata =ls documentdataIMPORTINGdocumentnumber =lv docnumberreturn =ls returnTABLESobjectlinks =lt objectlin
14、ks documentfiles =lt_documentfiles .return-messag舊s return -type='E'ORv docnumberISINITIAL *MESSAGEe001WITHt傳文件出錯,請聯(lián)系管理員. MESSAGEIls return -idTYPEs return -typeNUMBERls return -number WITHls_return -message_v1ls_return-message_v2ls_return-message_v3ls. e_v4.ELSECALLFUNCTIOIBAPI_TRANSACTION_
15、COMMIT' MESSAGE001WITH'上傳成功'.ENDIF wa file-doc id=lv docnumber. wa_file-dname=lv_filename . wa_file -yk_planno =wa_xqjh_h -yk_planno. wa_file-dtype =name.wa_file-credat=sy-datum.wa file -ctime =sy-uzeit.wa_file-cname=sy-uname.APPENEWa_fileTOit_file.IFwa xqjh h-yk plannoISNOTINITIALMODIFY
16、:tmm xqjh file FROMwa file.COMMITWORKANDWAITENDIFENDFORM"FRM UPLOAD FILE*&*&Formfrm split path file*&*text拆分路徑和文檔名 *->p1text*<-p2text *FORMfrm_split_path_file USINGuv_fullname CHANGINGv_filenamecv_pathname . DATAlt match TYPEnatch result tab, ls matchLIKELINEOlF match.FINDALLO
17、CCURRENCESOINuv_fullnameINCHARACTERODERESULTSlt_matchIFNOTt match ISINITIAL LOOPAT match INTOls_match. ENDLOOPADD1TOs match-offset.cv_pathname=uv_fullname (ls_match-offset). cv filename=uv fullname+ls match -offset. ENDIF ENDFORM. *&*&FormFRM_READ_FILE *&*text *->p1text *<-p2text *
18、FORMfrm read file . DATAlv fileTYPEtringVALUEC:XQJH1: DATAlv pathTYPEtring. DATAlv resultTYP曰bap bool. DATAlv_rcTYPEi DATAlv lineTYPEi DATAlv_originalpath TYPE)api_doc_aux-filename, lv_orfilename TYPE»api_doc_aux-filename. DATAls documentfile TYPE)api doc files2, ls_returnTYPE)apiret2.lv_result
19、=cl_gui_frontend_services =>directory_exist (directory =lv_file).舊v_result<>'X'.CALLMETHOtCl_gui_frontend_services=>directory_createEXPORTINGdirectory =lv fileCHANGINGrc=lv rcEXCEPTIONSdirectory_create_failed =1cntl error =2error_no_gui =3directory access denied=4directory alread
20、y exists =5path not found =6unknown error =7not supported by gui =8wrong_parameter =9OTHERS10.舊v_rc<>0ORsy_subrc<>0.MESSAGE001WITH'文件路徑拒絕訪問'.ENDIFENDIFGETCURSORLINEJine.READTABLi旦file INTOwa_file INDEXv_line.CONCATENATE file '' INTOlv originalpath .lv_orfilename =wa_file-
21、dname.CALLFUNCTIOIZBAPI DOCUMENT CHECKOUTVIEW2'EXPORTINGdocumenttype =con_dokardocumentnumber =wa file-doc iddocumentpart ='000'documentversion ='00'documentfile =ls documentfileoriginalpath =lv originalpathorfilename =lv orfilenameIMPORTINGreturn =ls_return.舊s return ISNOTINITIA
22、LMESSAGEIls return -idTYPEs return -typeNUMBERls return -numberWITHls_return -message_v1ls_return-message_v2ls_return-message_v3ls_return-messag e_v4.ENDIFCONCATENATE originalpathlv orfilename INTOlv pathCALLMETHODCl_gui_frontend_services=>execute EXPORTING document =lv_path synchronous='X
23、9; EXCEPTIONS cntl_error =1 error no gui =2 bad parameter=3 file_not_found =4 path not found =5 file extension unknown =6 error execute failed =7 synchronous failed =8 not_supported_by_gui =9 OTHERS10.IFsy-subrc<>0.*Implementsuitableerrorhandlinghere MESSAGE001WITH'打開文檔失敗DISPLAYIKEE'.
24、ENDIFENDFORM"FRM READ FILE*&*&FormFRM DOWN FILE*&*text*->p1text*<-p2text*FORMfrm_down_file .DATAlv filename TYPfstring.DATAlv_pathTYPEtring.DATAlv path c(100)TYPEcDATAlv fullpath TYPEtring.DATAlv_resultTYP曰bap_bool.DATAlv rcTYPEiDATAlv_lineTYPEiDATAlv_originalpath TYPE)api_doc
25、_aux-filename, lv orfilename TYPE»api doc aux-filename.DATAls_documentfile TYPE)api_doc_files2 ls_returnTYPE)apiret2.GETCURSORLINEJine.READTABLi旦file INTOwa_file INDEXv_line.lv_filename =wa_file-dname.CALLMETHODl_gui_frontend_services=>file_save_dialog EXPORTING window title ='選擇位置'
26、*default_extension= default file name =lv filename *with encoding= *file filter= *initial directory= *prompt_on_overwrite='X' CHANGING filename =lv filename path=lv_path fullpath =lv fullpath EXCEPTIONS cntl error =1 error_no_gui =2 not_supported_by_gui =3 invalid default file name =4 OTHERS
27、5.IFsy-subrc<>0. EXITENDIF lv result=cl gui_frontend_services =>directory_exist (directory =lv_path).舊v_result<>'X'.MESSAGE001WITH'文件路徑不存在'.ENDIF lv_originalpath =lv_path.lv_orfilename =lv_filename.CALLFUNCTIOIZBAPI DOCUMENT CHECKOUTVIEW2'EXPORTINGdocumenttype =con
28、_dokardocumentnumber =wa file-doc iddocumentpart ='000'documentversion ='00'documentfile =ls documentfile originalpath =lv_originalpath orfilename =lv orfilename IMPORTINGreturn =ls_return.舊s return ISNOTINITIALMESSAGEIlS_return -idTYPEs_return -typeNUMBERls_return -numberWITHls retu
29、rn -message v1ls return-message v2ls retum-message v3ls return-messag e_v4.ELSEMESSAGE001WITH'下載成功'.ENDIFENDFORM"FRM DOWN FILE*&*&FormFRM DELETE FILE*&*text*->p1text*<-p2text*FORMfrm_delete_file .DATAlv lineTYP日ls_returnTYPE)apiret2.CALLFUNCTIOIPOPUP TO CONFIRM' EX
30、PORTINGtitlebar ='消息提示'text question ='是否刪除文檔'text_button_1 ='是'text button 2 ='否'default_button ='1' display cancel button ='' start column =25 start_row =6*popup type='ICON MESSAGE ERROR'IMPORTING answer=lv_answer EXCEPTIONS text not found =1
31、 OTHERS2.舊vanswer<>'1'.MESSAGE001WITH'用戶取消操作'DISPLAYIKEE'.EXIT ENDIFGETCURSORLINEJine.READTABLit_file INTOwa_file INDEXv_line.CALLFUNCTIO'BAPI DOCUMENT ENQUEUE' EXPORTINGdocumenttype =con dokar documentnumber =wa file-doc id documentpart ='000' documentversi
32、on ='00' IMPORTING return =ls_return.舊s return ISNOTINITIALMESSAGEIls_return -idTYPEs_return -typeNUMBERls_return -numberWITHls return -message v1ls return-message v2ls retum-message v3ls return-messag e v4.ENDIFCALLFUNCTIOIBAPI DOCUMENT DELETE DIRECT' EXPORTING documenttype =con dokar documentnumber =
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度城市綜合體門頭租賃管理服務協(xié)議
- 二零二五年度C型鋼智能化生產(chǎn)系統(tǒng)建設合同3篇
- 2025年度租豬場養(yǎng)豬與市場推廣合作合同
- 2025版事業(yè)單位聘用合同正規(guī)范本(含績效管理)3篇
- 2025年度股東退股協(xié)議書:XX物流公司股東股權(quán)剝離與退股合同
- 二零二五年度菜鳥驛站社區(qū)便利店合作招商合同范本
- 二零二五年度AC311A直升機購銷及維修配件全球配送協(xié)議3篇
- 二零二五年度融創(chuàng)物業(yè)清潔服務合同
- 泰州市2025年度二手房購買合同樣本2篇
- 二零二五年度光伏發(fā)電設備安裝與運營服務承包合同范本3篇
- 二年級數(shù)學上冊100道口算題大全 (每日一套共26套)
- 物流無人機垂直起降場選址與建設規(guī)范
- 肺炎臨床路徑
- 外科手術(shù)鋪巾順序
- 創(chuàng)新者的窘境讀書課件
- 如何克服高中生的社交恐懼癥
- 聚焦任務的學習設計作業(yè)改革新視角
- 移動商務內(nèi)容運營(吳洪貴)任務三 APP的品牌建立與價值提供
- 電子競技范文10篇
- 食堂服務質(zhì)量控制方案與保障措施
- VI設計輔助圖形設計(2022版)
評論
0/150
提交評論