您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 公司方案 > SAP.HR.ABAP.调用Visio.生成组织架构图
提供树表报和Visio展示两种方式。基于标准程序RHSTRU00改造。*&-----------------------------------------------------------------*&ReportZHR_REP_01*&------------------------------------------------------------------*&ProgramName:ZHR_REP_01*&Description:XX组织结构图*&Author:*&Date:*&Tcode:*&Note:BasedonstandardreportRHSTRU00.CallsMSVisioobject.*&------------------------------------------------------------------REPORTZHR_REP_01.TYPE-POOLS:icon.TABLES:objec,t77eo,gdstr,gdset,pdstr.TYPES:BEGINOFt_node,idLIKEstruc-seqnr,parentLIKEstruc-seqnr,tree_idTYPElvc_nkey,text(25),text4(40),short(14),otype(2),realoTYPErealo,istat(1),begda(10),endda(10),vistat(1),vbegda(10),vendda(10),prozt(8),objidLIKEobjec-objid,ENDOFt_node.TYPES:BEGINOFtype_trec,keyTYPElvc_nkey,idLIKEstruc-seqnr,ENDOFtype_trec.TYPES:BEGINOFparent_stack_line,levelTYPEstruc-level,idLIKEstruc-seqnr,ENDOFparent_stack_line.*----------------------------------------------------------------------**errorhandling(forinternalerrors)*----------------------------------------------------------------------**typeforABAPcallstackTYPES:BEGINOFt_s_abap_callstack,mainprogramLIKEsy-repid,includeLIKEsy-repid,lineTYPEi,eventtypeLIKEabdbg-leventtype,eventLIKEabdbg-levent,flag_system,ENDOFt_s_abap_callstack.*variableforABAPcallstackDATA:g_callstackTYPESTANDARDTABLEOFt_s_abap_callstack,g_callstack_waTYPEt_s_abap_callstack.*macroshouldneverbecalled;-)DEFINEinternal_error.&1actionthatleadtoerror*getcallstackcall'ABAP_CALLSTACK'id'DEPTH'field99id'CALLSTACK'fieldg_callstack.*getcurrentform/eventreadtableg_callstackintog_callstack_waindex1.messagei001(aq_ad_hoc)withg_callstack_wa-event&1.action.END-OF-DEFINITION.DATA:it_nodeTYPESTANDARDTABLEOFt_node,it_tabTYPESTANDARDTABLEOFt_node,wa_nodeTYPEt_node.DATA:BEGINOFwaobjec,stextLIKEobjec-stext,shortLIKEobjec-short,realoLIKEobjec-realo,plvarLIKEobjec-plvar,otypeLIKEobjec-otype,objidLIKEobjec-objid,begdaLIKEobjec-begda,enddaLIKEobjec-endda,istatLIKEobjec-istat,seqnrLIKEstruc-seqnr,ENDOFwaobjec.DATA:ok_codeLIKEsy-ucomm,save_okLIKEsy-ucomm.CLASScl_gui_objectDEFINITIONLOAD.DATA:control_containerTYPEREFTOcl_gui_custom_container,alv_tree_controlTYPEREFTOcl_gui_alv_tree,alv_html_headerTYPEREFTOcl_gui_html_viewer,fieldcatalogTYPESTANDARDTABLEOFlvc_s_fcat,hierarchy_headerTYPEtreev_hhdr.DATA:lt_list_commentaryTYPEslis_t_listheader,gs_variantTYPEdisvariant.DATA:s_nodeTYPElvc_nkey.DATA:otypeTYPEotype.DATA:answer(1).DATA:it_toolbar_excludingTYPEui_functions.DATA:excl_tabTYPETABLEOFsy-ucomm.DATA:it_recursionsTYPESTANDARDTABLEOFtype_trec,exist_recTYPEflag_x.DATA:repidLIKEsy-repid,sel_tableTYPETABLEOFrsparams.DATA:g_optimize_flagTYPEflagVALUE'',note768405g_optimize_buttonTYPEsmp_dyntxt.#ECNEEDED*parenthandlingDATA:g_parent_stackTYPESTANDARDTABLEOFparent_stack_line,g_parent_stack_waTYPEparent_stack_line.DATA:lv_stringTYPEstring.DATA:gx_acc_mode_onTYPEabap_bool.TYPES:BEGINOFt_data,idTYPEstruc-seqnr,parentTYPEstruc-seqnr,onameTYPEhrp1000-short,snameTYPEhrp1000-short,pnameTYPEhrp1000-short,orgidTYPEhrp1000-objid,posidTYPEhrp1000-objid,peridTYPEhrp1000-objid,knameTYPEhrp1000-short,kccidTYPEhrp1000-objid,graphTYPEi,imagefileTYPEchar40,ENDOFt_data.DATA:gt_dataTYPESTANDARDTABLEOFt_data.DATA:wa_dataTYPEt_data.DATA:g_visio_pathTYPEstring,g_visio_paraTYPEstring.*OLE对象DATA:g_aplicacionTYPEole2_object.AplicacionVisioDATA:g_documentosTYPEole2_object.ColecciondeDocumentosVisioDATA:g_documentoTYPEole2_object.DocumentoVisioDATA:g_addonTYPEole2_object.AddonDATA:g_addonsTYPEole2_object.AddonsDATA:g_sistemaTYPEole2_object.AddonsDATA:g_template_pathTYPEstring.DATA:g_template_fileTYPEstring.DATA:g_data_fileTYPEstring.DATA:g_workdirTYPEstring.DATA:g_parametro_macroTYPEstring,g_orgwizTYPEstringVALUE'OrgCWIZ'.*----------------------------------------------------------------------**SELECTIONSCREEN**----------------------------------------------------------------------*SELECTION-SCREENBEGINOFBLOCKblock1WITHFRAMETITLEtext-001.*technicaldepthPARAMETERS:tdepthLIKEgdstr-tdepth.SELECTION-SCREENSKIP.*recursioncheckPARAMETERS:recursRADIOBUTTONGROUPg2LIKEpppch-recursDEFAULT'X'.PARAMETERS:visioRADIOBUTTONGROUPg2TYPEflag_x.SELECTION-SCREENENDOFBLOCKblock1.*PARAMETERS:ORG_PATHTYPESTRINGDEFAULT'C:\ProgramFiles\MicrosoftOffice\Office12\ORGWIZ.EXE'.*----------------------------------------------------------------------**INITIALIZATION**----------------------------------------------------------------------*INITIALIZATION.*Structuredevaluation$pch$-acces=$structured$.pchtimed='D'.*initializevariablesCLEAR:waobjec,it_node[].repid=sy-repid.*----------------------------------------------------------------------**START-OF-SELECTION**----------------------------------------------------------------------*START-OF-SELECTION.*performreportforallobjects?IFpchobjid[]ISINITIALANDpchsobid[]ISINITIAL.CALLFUNCTION'POPUP_TO_CONFIRM'EXPORTINGtitlebar='消息'(027)text_question='查询所有部门?'(015)display_cancel_button=''IMPORTINGanswer=answerEXCEPTIONStext_not_found=1OTHERS=2.IFsy-subrc0.internal_error'FUNCTIONPOPUP_TO_CONFIRM'.#ECNOTEXTENDIF.*backtosel
本文标题:SAP.HR.ABAP.调用Visio.生成组织架构图
链接地址:https://www.777doc.com/doc-4954116 .html