SAP ABAP DMS文档管理开发.doc

上传人:1595****071 文档编号:33862445 上传时间:2022-08-12 格式:DOC 页数:11 大小:78KB
返回 下载 相关 举报
SAP ABAP DMS文档管理开发.doc_第1页
第1页 / 共11页
SAP ABAP DMS文档管理开发.doc_第2页
第2页 / 共11页
点击查看更多>>
资源描述

《SAP ABAP DMS文档管理开发.doc》由会员分享,可在线阅读,更多相关《SAP ABAP DMS文档管理开发.doc(11页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、如有侵权,请联系网站删除,仅供学习与交流SAP ABAP DMS文档管理开发【精品文档】第 11 页SAP ABAP DMS文档开发1. 用到的BAPI:BAPI_DOCUMENT_CREATE2 ,ZBAPI_DOCUMENT_CHECKOUTVIEW2,BAPI_DOCUMENT_DELETE_DIRECT2. 其中ZBAPI_DOCUMENT_CHECKOUTVIEW2是从标准的BAPI_DOCUMENT_CHECKOUTVIEW2改写(标准的在导出文档时,会自定义一个文档名称);改动代码如下:a) 新增函数组ZMM_CVBAPIb) 将LCVBAPITOP的定义对象拷贝到LZMM_CV

2、BAPITOPc) 在LZMM_CVBAPITOP最后添加如下:INCLUDElcvbapif01.INCLUDElcvbapif02.INCLUDElcvbapif03.INCLUDElcvbapif04.INCLUDElcvbapif05.INCLUDElcvbapif06.INCLUDElcvbapif07.d) 拷贝函数BAPI_DOCUMENT_CHECKOUTVIEW2到新ZBAPI_DOCUMENT_CHECKOUTVIEW2,添加IMPORT参ORFILENAME,并修改代码。3. 以下为参考代码:*文档类型CONSTANTS:con_dokar(3)VALUEZQX.*存储类

3、别CONSTANTS:con_storage_cat(10)VALUEDMS_C1_ST.FORMfrm_creat_file.DATA:lv_rcTYPEi,lt_filetableTYPEfiletableWITHHEADERLINE.DATA:lv_filenameTYPEfilep,lv_pathTYPEfilep.DATA:lv_docnumberTYPEbapi_doc_aux-docnumber.DATA:ls_documentdataTYPEbapi_doc_draw2,ls_documentdataxTYPEbapi_doc_drawx2,bapi_doc_draw2x,lt

4、_objectlinksTYPETABLEOFbapi_doc_dradWITHHEADERLINE,lt_documentfilesTYPETABLEOFbapi_doc_files2WITHHEADERLINE,ls_returnTYPEbapiret2.DATA:t_tdwpTYPETABLEOFtdwpWITHHEADERLINE.DATA:nameTYPEdraw-filep,ext(64)TYPEc.CALLMETHODcl_gui_frontend_services=file_open_dialogEXPORTINGwindow_title=选择文件default_extensi

5、on=*CHANGINGfile_table=lt_filetablerc=lv_rcEXCEPTIONSfile_open_dialog_failed=1cntl_error=2error_no_gui=3not_supported_by_gui=4OTHERS=9.IFlt_filetableISINITIAL.EXIT.ENDIF.READTABLElt_filetableINDEX1.*解析路径文件PERFORMfrm_split_path_fileUSINGlt_filetable-filenameCHANGINGlv_filenamelv_path.name=lv_filename

6、.WHILEnameCA.SPLITnameAT.INTOextname.ENDWHILE.CONCATENATE.nameINTOname.TRANSLATEnameTOLOWERCASE.CALLFUNCTIONCV120_DOC_GET_APPLEXPORTINGpf_file=nameTABLESptx_tdwp=t_tdwp.IFt_tdwpISINITIAL.MESSAGEs001WITH不支持此类型文件.ENDIF.READTABLEt_tdwpINDEX1.ls_documentdata-documenttype=con_dokar.ls_documentdata-docume

7、ntversion=00.ls_documentdata-documentpart=000.ls_documentdata-description=凭证描述.ls_documentdata-username=sy-uname.*ls_documentdata-ecnumber=123.READTABLEt_tdwpINDEX1.lt_documentfiles-documenttype=ZQX.lt_documentfiles-storagecategory=con_storage_cat.lt_documentfiles-wsapplication=t_tdwp-dappl.lt_docum

8、entfiles-docpath=lv_path.lt_documentfiles-docfile=lv_filename.lt_documentfiles-checkedin=X.APPENDlt_documentfiles.CALLFUNCTIONBAPI_DOCUMENT_CREATE2EXPORTINGdocumentdata=ls_documentdataIMPORTINGdocumentnumber=lv_docnumberreturn=ls_returnTABLESobjectlinks=lt_objectlinksdocumentfiles=lt_documentfiles.I

9、Fls_return-type=EORlv_docnumberISINITIAL.*MESSAGEe001WITH上传文件出错,请联系管理员.MESSAGEIDls_return-idTYPEls_return-typeNUMBERls_return-numberWITHls_return-message_v1ls_return-message_v2ls_return-message_v3ls_return-message_v4.ELSE.CALLFUNCTIONBAPI_TRANSACTION_COMMIT.MESSAGEs001WITH上传成功.ENDIF.wa_file-doc_id=l

10、v_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.APPENDwa_fileTOit_file.IFwa_xqjh_h-yk_plannoISNOTINITIAL.MODIFYztmm_xqjh_fileFROMwa_file.COMMITWORKANDWAIT.ENDIF.ENDFORM.FRM_UPLOAD_FIL

11、E*&-*&Formfrm_split_path_file*&-*text拆分路径和文档名*-*-p1text*p1text*directory_exist(directory=lv_file).IFlv_resultX.CALLMETHODcl_gui_frontend_services=directory_createEXPORTINGdirectory=lv_fileCHANGINGrc=lv_rcEXCEPTIONSdirectory_create_failed=1cntl_error=2error_no_gui=3directory_access_denied=4directory_

12、already_exists=5path_not_found=6unknown_error=7not_supported_by_gui=8wrong_parameter=9OTHERS=10.IFlv_rc0ORsy-subrc0.MESSAGEe001WITH文件路径拒绝访问.ENDIF.ENDIF.GETCURSORLINElv_line.READTABLEit_fileINTOwa_fileINDEXlv_line.CONCATENATElv_fileINTOlv_originalpath.lv_orfilename=wa_file-dname.CALLFUNCTIONZBAPI_DOC

13、UMENT_CHECKOUTVIEW2EXPORTINGdocumenttype=con_dokardocumentnumber=wa_file-doc_iddocumentpart=000documentversion=00documentfile=ls_documentfileoriginalpath=lv_originalpathorfilename=lv_orfilenameIMPORTINGreturn=ls_return.IFls_returnISNOTINITIAL.MESSAGEIDls_return-idTYPEls_return-typeNUMBERls_return-nu

14、mberWITHls_return-message_v1ls_return-message_v2ls_return-message_v3ls_return-message_v4.ENDIF.CONCATENATElv_originalpathlv_orfilenameINTOlv_path.CALLMETHODcl_gui_frontend_services=executeEXPORTINGdocument=lv_pathsynchronous=XEXCEPTIONScntl_error=1error_no_gui=2bad_parameter=3file_not_found=4path_no

15、t_found=5file_extension_unknown=6error_execute_failed=7synchronous_failed=8not_supported_by_gui=9OTHERS=10.IFsy-subrc0.*ImplementsuitableerrorhandlinghereMESSAGEs001WITH打开文档失败DISPLAYLIKEE.ENDIF.ENDFORM.FRM_READ_FILE*&-*&FormFRM_DOWN_FILE*&-*text*-*-p1text*file_save_dialogEXPORTINGwindow_title=选择位置*d

16、efault_extension=default_file_name=lv_filename*with_encoding=*file_filter=*initial_directory=*prompt_on_overwrite=XCHANGINGfilename=lv_filenamepath=lv_pathfullpath=lv_fullpathEXCEPTIONScntl_error=1error_no_gui=2not_supported_by_gui=3invalid_default_file_name=4OTHERS=5.IFsy-subrc0.EXIT.ENDIF.lv_resul

17、t=cl_gui_frontend_services=directory_exist(directory=lv_path).IFlv_resultX.MESSAGEe001WITH文件路径不存在.ENDIF.lv_originalpath=lv_path.lv_orfilename=lv_filename.CALLFUNCTIONZBAPI_DOCUMENT_CHECKOUTVIEW2EXPORTINGdocumenttype=con_dokardocumentnumber=wa_file-doc_iddocumentpart=000documentversion=00documentfile

18、=ls_documentfileoriginalpath=lv_originalpathorfilename=lv_orfilenameIMPORTINGreturn=ls_return.IFls_returnISNOTINITIAL.MESSAGEIDls_return-idTYPEls_return-typeNUMBERls_return-numberWITHls_return-message_v1ls_return-message_v2ls_return-message_v3ls_return-message_v4.ELSE.MESSAGEs001WITH下载成功.ENDIF.ENDFO

19、RM.FRM_DOWN_FILE*&-*&FormFRM_DELETE_FILE*&-*text*-*-p1text*-p2text*-*FORMfrm_delete_file.DATA:lv_lineTYPEi,ls_returnTYPEbapiret2.CALLFUNCTIONPOPUP_TO_CONFIRMEXPORTINGtitlebar=消息提示text_question=是否删除文档text_button_1=是text_button_2=否default_button=1display_cancel_button=start_column=25start_row=6*popup_

20、type=ICON_MESSAGE_ERRORIMPORTINGanswer=lv_answerEXCEPTIONStext_not_found=1OTHERS=2.IFlv_answer1.MESSAGEs001WITH用户取消操作DISPLAYLIKEE.EXIT.ENDIF.GETCURSORLINElv_line.READTABLEit_fileINTOwa_fileINDEXlv_line.CALLFUNCTIONBAPI_DOCUMENT_ENQUEUEEXPORTINGdocumenttype=con_dokardocumentnumber=wa_file-doc_iddocum

21、entpart=000documentversion=00IMPORTINGreturn=ls_return.IFls_returnISNOTINITIAL.MESSAGEIDls_return-idTYPEls_return-typeNUMBERls_return-numberWITHls_return-message_v1ls_return-message_v2ls_return-message_v3ls_return-message_v4.ENDIF.CALLFUNCTIONBAPI_DOCUMENT_DELETE_DIRECTEXPORTINGdocumenttype=con_doka

22、rdocumentnumber=wa_file-doc_iddocumentpart=000documentversion=00IMPORTINGreturn=ls_return.CALLFUNCTIONBAPI_DOCUMENT_DEQUEUEEXPORTINGdocumenttype=con_dokardocumentnumber=wa_file-doc_iddocumentpart=000documentversion=00.IFls_return-typeE.CALLFUNCTIONBAPI_TRANSACTION_COMMIT.DELETEit_fileINDEXlv_line.DE

23、LETEFROMztmm_xqjh_fileWHEREdoc_id=wa_file-doc_id.MESSAGEs001WITH删除成功.ELSE.MESSAGEIDls_return-idTYPEls_return-typeNUMBERls_return-numberWITHls_return-message_v1ls_return-message_v2ls_return-message_v3ls_return-message_v4.ENDIF.ENDFORM.FRM_DELETE_FILE*&-*&FormFRM_DOUBLE_CLICK*&-*text*-*-p1text*-p2text

24、*-*FORMfrm_double_click.DATA:filedTYPEchar20.GETCURSORFIELDfiled.IFfiled=IT_FILE-DOC_ID.GETCURSORLINEline.READTABLEit_fileINDEXline.SETPARAMETERIDCV1FIELDit_file-doc_id.SETPARAMETERIDCV2FIELDcon_dokar.SETPARAMETERIDCV3FIELD00.SETPARAMETERIDCV4FIELD000.CALLTRANSACTIONCV03NANDSKIPFIRSTSCREEN.ENDIF.ENDFORM.FRM_DOUBLE_CLICK

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 小学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁