webdynpro進階篇案例十二使用Tree靜態(tài)結(jié)構(gòu)_第1頁
webdynpro進階篇案例十二使用Tree靜態(tài)結(jié)構(gòu)_第2頁
webdynpro進階篇案例十二使用Tree靜態(tài)結(jié)構(gòu)_第3頁
webdynpro進階篇案例十二使用Tree靜態(tài)結(jié)構(gòu)_第4頁
webdynpro進階篇案例十二使用Tree靜態(tài)結(jié)構(gòu)_第5頁
已閱讀5頁,還剩22頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

中間以tree形式展開,不同的結(jié)點對應(yīng)不同的edit這次使用lead_selectioncontext(案例)edticontext中傳來傳去修改后(Apply),treenode總體架構(gòu)Main產(chǎn)生tree:XML,賦給 作用:從XML中tree的結(jié)構(gòu)數(shù)據(jù),并賦給第層:第層:第三層第四層即使注意,每一層的DISPLAY_TEXT是用來顯示在tree的每一節(jié)點DISPLAY_ICON是在method NITmethod NIT****GETdatamrapitypereftoif_mr_api.datatempcontenttypexstring.datatempxml_stringtypedatatemp_binarytype tbin mrapi=cl_mime_repository_api=>if_mr_api~get_api(). e_content=tempcontent).callfunctionexportingbuffer=tempcontentimportingoutput_length=temp_binarytablesbinary_tab callfunction'SCMS_BINARY_TO_STRING'exportinginput_length=temp_binaryimportingtext_buffer=tempxml_stringtablesbinary_tab datal_xmltype*CALLFUNCTION*** =datal_ixmltypereftodatal_streamfactorytypereftoif_ixml_stream_factory.datal_istreamtypereftoif_ixml_istream.data typerefto datal_parsertyperefto方法 該方法主要是從MIME中 一個XML文件。再調(diào)用initial_contextdatanodetypereftodataiteratortypereftoif_ixml_node_iterator.datanodemaptypereftoif_ixml_named_node_map.CreatingthemainiXMLfactoryl_ixml=cl_ixml=>create().Creatingastreaml_istream=l_streamfactory->create_istream_cstring(string=tempxml_stringCreating =l_ixml- (Createal_parser=l_ixml->create_parser(stream_factory= == ifl_parser->parse()neifl_parser->num_errors()nedata:parseerrortypereftoif_ixml_parse_error, typestring, type type typecount=l_parser->num_errors(write:count,'parseerrorshaveoccured:'.index=0.whileindex<parseerror=l_parser->get_error(index=index).i=parseerror->get_line().write:'line:',i=parseerror->get_column().write:'column:',i.str=parseerror->get_reason().write:str.index=index+1. typereftotypetypeifl_parser->is_dom_generating()eqnode?= checknotnodeisinitial.ifnodeisinitial.iterator=node->create_iterator(*getcurrentnode=iterator->get_next(whilenotnodeisnode->get_type(elementnode =node->get_name().nodemap=node->get_attributes().ifnotnodemapisinitial. attr=nodemap->GET_NAMED_ITEM('ObjectType').VALUE1=ATTR->GET_VALUE().ifVALUE1=initial_context(pa_impnode=node).node=iterator->get_next().PA_IMPNODE methodINITIAL_CONTEXT作用:從XML中tree的結(jié)構(gòu)數(shù)據(jù),并PA_IMPNODE methodINITIAL_CONTEXTlt_ccdtypeponentcontroller=>elements_ccd,lt_plttypeponentcontroller=>elements_plt,lt_portypeponentcontroller=>elements_por,lt_sortypeponentcontroller=>elements_sor.data:name1typestring,nodemaptypeREFTOif_ixml_named_node_map,nodetypeREFTOIF_IXML_NODE,lv_opctype =PA_IMPNODE->get_name().nodemap=PA_IMPNODE->get_attributes().lv_opc-filename=GET_NODE_VALUE(pa_id='FILENAME'pa_nodemap=nodemap).lv_opc-variant_id=GET_NODE_VALUE(pa_id='VARIANT_ID'pa_nodemap=nodemap).lv_opc-I_ERKRS_BZ=GET_NODE_VALUE(pa_id='I_ERKRS_BZ'pa_nodemapnodemapCONCATENATE'OperationConcern'lv_opc-i_erkrsintolv_opc-display_textSEPARATEDBYspace.lv_opc-DISPLAY_ICON=Node:move-correspondinglv_opctowd_this-For1stnood:hasthedata:context_nodetypeREFTOIF_WD_CONTEXT_NODE,context_elementtypeREFTOcontext_node=WD_CONTEXT->PATH_GET_NODE('OPC' SET_INITIAL_ELEMENTS=abap_true).COUNTTYPEI,INDEX_NUMTYPEI.NODELIST=PA_IMPNODE->GET_CHILDREN().COUNT=NODELIST->GET_LENGTH().INDEX_NUM=0.DOCOUNTTIMES.SUB_NODE=NODELIST->GET_ITEM(INDEX_NUM).INDEX_NUM=INDEX_NUM+1.name1=SUB_NODE->get_name(DATALV_COA nodemap=SUB_NODE->get_attributes(LV_COA-filename=GET_NODE_VALUE(pa_id='FILENAME'pa_nodemap=nodemap).LV_COA-variant_id=GET_NODE_VALUE(pa_id='VARIANT_ID'pa_nodemap=nodemap).LV_COA-I_KOKRS=GET_NODE_VALUE(pa_id='I_KOKRS'pa_nodemap=nodemap).LV_COA-I_BEZEI=GET_NODE_VALUE(pa_id='I_BEZEI'pa_nodemap=nodemap).LV_COA-I_CTYP=GET_NODE_VALUE(pa_id='I_CTYP'pa_nodemap=nodemap).LV_COA-I_CVACT=GET_NODE_VALUE(pa_id='I_CVACT'pa_nodemap=nodemap).LV_COA-I_CVPROF=GET_NODE_VALUE(pa_id='I_CVPROF'pa_nodemap=nodemapLV_COA-I_KOKFI=GET_NODE_VALUE(pa_id='I_KOKFI'pa_nodemap=nodemap).LV_COA-I_KTOPL=GET_NODE_VALUE(pa_id='I_KTOPL'pa_nodemap=nodemap).LV_COA-I_LMONA=GET_NODE_VALUE(pa_id='I_LMONA'pa_nodemap=nodemap).LV_COA-I_VNAME=GET_NODE_VALUE(pa_id='I_VNAME'pa_nodemap=nodemap).LV_COA-I_WAERS=GET_NODE_VALUE(pa_id='I_WAERS'pa_nodemap=nodemap).LV_COA-I_XWBUK=GET_NODE_VALUE(pa_id='I_XWBUK'pa_nodemap=nodemap).CONCATENATE'ControllingArea'LV_COA-I_KOKRSintoLV_COA-display_textSEPARATEDBYlv_COA-DISPLAY_ICON=**Node:move-correspondingLV_COAtowd_this-*****Thiscanbedata:context_node1typeREFTOIF_WD_CONTEXT_NODE,context_element1typeREFTOIF_WD_CONTEXT_ELEMENT.context_node1=context_element->GET_CHILD_NODE('COA' SET_INITIAL_ELEMENTS=abap_false).*****ThiscanbeDATA:NODELIST1TYPEREFTOIF_IXML_NODE_LIST,SUB_NODE1TYPEREFTOIF_IXML_NODE,COUNT1TYPEI,INDEX_NUM1TYPEI.NODELIST1=SUB_NODE->GET_CHILDREN(count1=nodelist1->get_length().INDEX_NUM1=0.docount1sub_node1=nodelist1->get_item(INDEX_NUM1).INDEX_NUM1=INDEX_NUM1+1.nodemap=SUB_NODE1->get_attributes(datalv_ccd LV_CCD-filename=GET_NODE_VALUE(pa_id='FILENAME'pa_nodemapnodemapLV_CCD-VARIANT_ID=GET_NODE_VALUE(pa_id='VARIANT_ID'pa_nodemap=========LV_CCD-I_DISTRICT=GET_NODE_VALUE(pa_id='I_DISTRICT'pa_nodemap=nodemap).LV_CCD-I_COUNTRY=GET_NODE_VALUE(pa_id='I_COUNTRY'pa_nodemap=nodemap).LV_CCD-I_HOUSE_NUM1=GET_NODE_VALUE(pa_id='I_HOUSE_NUM1'=nodemap=========LV_CCD-I_POST_CODE2=GET_NODE_VALUE(pa_id='I_POST_CODE2'=nodemapLV_CCD-I_POST_CODE1=GET_NODE_VALUE(pa_id='I_POST_CODE1'=nodemapLV_CCD-I_REGION=GET_NODE_VALUE(pa_id='I_REGION'pa_nodemap=nodemap).LV_CCD-I_STREET=GET_NODE_VALUE(pa_id='I_STREET'pa_nodemap=nodemap).LV_CCD-I_TAXJURCODE=GET_NODE_VALUE(pa_id='I_TAXJURCODE'=nodemapLV_CCD-I_WAERS=GET_NODE_VALUE(pa_id='I_WAERS'pa_nodemap=nodemap).LV_CCD-I_TIME_ZONE=GET_NODE_VALUE(pa_id='I_TIME_ZONE'=nodemapCONCATENATE'CompanyCode'LV_CCD-I_BUKRSintolv_ccd-display_textSEPARATEDBYspace.lv_ccd-DISPLAY_ICON=Node:appendLV_CCDto*****Thiscanbedata:context_node2typeREFTOIF_WD_CONTEXT_NODE,context_element2typeREFTOIF_WD_CONTEXT_ELEMENT.context_node2=context_element1->GET_CHILD_NODE('CCD' SET_INITIAL_ELEMENTS=abap_false).*****Thiscanbedata:context_node3typeREFTOIF_WD_CONTEXT_NODE,context_element3typeREFTOIF_WD_CONTEXT_ELEMENT.DATA:NODELIST2TYPEREFTOIF_IXML_NODE_LIST,SUB_NODE2TYPEREFTOIF_IXML_NODE,COUNT2TYPEI,INDEX_NUM2TYPEI.NODELIST2=sub_node1->GET_CHILDREN().INDEX_NUM=0.COUNT2=NODELIST2->GET_LENGTH(docount2sub_node2=nodelist2->get_item(INDEX_NUM).INDEX_NUM=INDEX_NUM+1.nodemap=SUB_NODE2->get_attributes().dataobjtypeTYPEstring.objtype=GET_NODE_VALUE(pa_id='ObjectType'pa_nodemap=nodemap).IFobjtype='PLT'.datalv_plt LV_PLT-filename=GET_NODE_VALUE(pa_id='FILENAME'pa_nodemapnodemapLV_PLT-VARIANT_ID=GET_NODE_VALUE(pa_id='VARIANT_ID'=nodemapLV_PLT-I_WERKS=GET_NODE_VALUE(pa_id='I_WERKS'pa_nodemapnodemapnodemapnodemapnodemap

LV_PLT-I_NAME1=GET_NODE_VALUE(pa_id='I_NAME1'pa_nodemapLV_PLT-I_NAME2=GET_NODE_VALUE(pa_id='I_NAME2'pa_nodemapLV_PLT-I_CITY=GET_NODE_VALUE(pa_id='I_CITY'pa_nodemapLV_PLT-I_DISTRICT=GET_NODE_VALUE(pa_id='I_DISTRICT'=nodemapLV_PLT-I_COUNTRY=GET_NODE_VALUE(pa_id='I_COUNTRY'pa_nodemapnodemapnodemap

LV_PLT-I_FABKL=GET_NODE_VALUE(pa_id='I_FABKL'pa_nodemapLV_PLT-I_HOUSE_NUM=GET_NODE_VALUE(pa_id=pa_nodemap=nodemapLV_PLT-I_LANGU=GET_NODE_VALUE(pa_id='I_LANGU'pa_nodemapnodemapLV_PLT-I_POST_CODE2=GET_NODE_VALUE(pa_id=pa_nodemap=nodemapLV_PLT-I_POST_CODE=GET_NODE_VALUE(pa_id=pa_nodemap=nodemapLV_PLT-I_PO_BOX=GET_NODE_VALUE(pa_id='I_PO_BOX'pa_nodemapnodemapnodemapnodemap

LV_PLT-I_REGION=GET_NODE_VALUE(pa_id='I_REGION'pa_nodemapLV_PLT-I_STREET=GET_NODE_VALUE(pa_id='I_STREET'pa_nodemapLV_PLT-I_TIME_ZONE=GET_NODE_VALUE(pa_id=pa_nodemap=nodemapLV_PLT-I_TAXJURCODE=GET_NODE_VALUE(pa_id=pa_nodemap=nodemap SEPARATEDBYSPACE.lv_PLT-DISPLAY_ICON=Node:appendLV_pltto*****Thiscanbecontext_node3=context_element2->GET_CHILD_NODE('PLT' SET_INITIAL_ELEMENTS=abap_false).*****Thiscanbenodemap

IFobjtype=datalv_sor LV_sor-filename=GET_NODE_VALUE(pa_id='FILENAME'pa_nodemapLV_sor-VARIANT_ID=GET_NODE_VALUE(pa_id='VARIANT_ID'=nodemaplv_sor-I_BOAVO=GET_NODE_VALUE(pa_id='I_BOAVO'pa_nodemapnodemapnodemapnodemap

lv_sor-I_CITY1=GET_NODE_VALUE(pa_id='I_CITY1'pa_nodemaplv_sor-I_COUNTRY=GET_NODE_VALUE(pa_id='I_COUNTRY'pa_nodemaplv_sor-I_HOUSE_NUM1=GET_NODE_VALUE(pa_id=pa_nodemap=nodemapnodemap

lv_sor-I_KUNNR=GET_NODE_VALUE(pa_id='I_KUNNR'pa_nodemaplv_sor-I_POST_CODE2=GET_NODE_VALUE(pa_id=pa_nodemap=nodemaplv_sor-I_POST_CODE=GET_NODE_VALUE(pa_id='I_POST_CODE'pa_nodemap=nodemap).lv_sor-I_PO_BOX=GET_NODE_VALUE(pa_id='I_PO_BOX'pa_nodemapnodemapnodemapnodemap

lv_sor-I_REGION=GET_NODE_VALUE(pa_id='I_REGION'pa_nodemaplv_sor-I_STREET=GET_NODE_VALUE(pa_id='I_STREET'pa_nodemaplv_sor-I_TAXJURCODE=GET_NODE_VALUE(pa_id=pa_nodemap=nodemaplv_sor-I_TIME_ZONE=GET_NODE_VALUE(pa_id='I_TIME_ZONE'pa_nodemap=nodemap).lv_sor-I_TXNAM_SDB=GET_NODE_VALUE(pa_id=pa_nodemap=nodemaplv_sor-I_VKOKL=GET_NODE_VALUE(pa_id='I_VKOKL'pa_nodemapnodemapnodemapnodemapnodemap

lv_sor-I_WAERS=GET_NODE_VALUE(pa_id='I_WAERS'pa_nodemaplv_sor-I_VKORG=GET_NODE_VALUE(pa_id='I_VKORG'pa_nodemaplv_sor-I_VTEXT=GET_NODE_VALUE(pa_id='I_VTEXT'pa_nodemapCONCATENATE'SalesOrg'lv_sor-I_VKORGINTOlv_sor-SEPARATEDBYlv_sor-DISPLAY_ICON=Node:appendLV_sorto*****Thiscanbecontext_node3=context_element2->GET_CHILD_NODE('SOR' SET_INITIAL_ELEMENTS=abap_false).*****Thiscanbenodemap

IFobjtype=datalv_por lv_por-filename=GET_NODE_VALUE(pa_id='FILENAME'pa_nodemaplv_por-VARIANT_IDlv_por-VARIANT_ID=GET_NODE_VALUE(pa_id='VARIANT_ID'=nodemaplv_por-I_EKORG=GET_NODE_VALUE(pa_id='I_EKORG'pa_nodemapnodemaplv_por-I_EKOTX=GET_NODE_VALUE(pa_id='I_EKOTX'pa_nodemapnodemapCONCATENATE'PurchaseOrg'lv_por-I_EKORGINTOlv_por-DISPLAY_TEXTSEPARATEDBYSPACE.lv_por-DISPLAY_ICON=Node:appendLV_porto*****Thiscanbecontext_node3=context_element2->GET_CHILD_NODE('POR' SET_INITIAL_ELEMENTS=abap_false).*****Thiscanbe**savewd_this->Gt_CCD=wd_this->Gt_plt=wd_this->Gt_por=wd_this->Gt_sor=methodGET_NODE_VALUEdatanodetypeREFTOnodemethodGET_NODE_VALUEdatanodetypeREFTOnode=PA_NODEMAP->GET_NAMED_ITEM(PA_IDifnodeisinitial.pa_value=''.PA_VALUE=node->get_value().界面:顯示與隱藏左或右部分methodmethodSHOW_LEFT_PANELDATAlo_nd_visibale_controlTYPEREFTODATAlo_el_visibale_controlTYPEREFTOwd_this->wdctx_LR_SHOWexportingname='VISIBLE_LEFT'importingvalue=lv_VISIBLE_LEFT).iflv_VISIBLE_LEFT=name='VISIBLE_LEFT'value='').name='VISIBLE_LEFT'value='X'對應(yīng)的contextTree:點擊不同的節(jié)點顯示不同的edit這是以COA為例CONTEXT_ELEMENTCONTEXT_ELEMENTmethodONACTIONPRESS_COA*getPath,thensetDATA:LO_ND_CONTEXTTYPEREFTOIF_WD_CONTEXT_NODE,PATHTYPESTRING.PATH=wdevent->GET_STRING('PATH'LO_ND_CONTEXT=WD_CONTEXT->PATH_GET_NODE(pathcontext_elementio_context_element*setEdit methodPATH_LEAD_SELECTIONlt_stringtypeTABLEOFstring,lo_stringtypestring.*getthestringofSPLITi_pathat'.'intoTABLEis_nodetypewdy_boolean,nodepathtypestring,nodetypeREFTOif_wd_context_node,indetypei.is_node=loopatlt_stringinto*formtheNode-IFnodepathisinitial.nodepath=CONCATENATEnodepathlo_stringintonodepathSEPARATEDBY'.'.*setleadselectionofeverynodeinthePathifis_node=abap_true.node=wd_context->path_get_node(nodepath).is_node=abap_false.CALLFUNCTION =inde.node->set_lead_selection_index(inde).is_node=abap_true.*savethenode-P_CONTROLLER->G_PATH=methodSHOW_EDIT_PANEL**First:showtheedit ponentcontroller=>wdctx_enable_view).getalldeclaredattributesStatic_Attributes=stru_attributessetpropertycasei_TYPE.when'COA'.**modifystru_attributes-ENABLE_COA='X'.when**modifystru_attributes-ENABLE_CCD='X'.when**modifystru_attributes-ENABLE_PLT='X'.when**modifystru_attributes-ENABLE_POR='X'.whenwhen**modifystru_attributes-ENABLE_SOR='X'.when**modifystru_attributes-ENABLE_EMPTY='X'.*bindnewelementtonode_attributes->bind_structure(new_item=stru_attributesSET_INITIAL_ELEMENTS=abap_true).同樣對應(yīng)的使用editpanel修改某一節(jié)點后,點擊apply顯示在treeled_selection實時的修改了某一field后,內(nèi)部的context已經(jīng)修改。但是,因為我們的tree顯示用的display_text和display_icon卻不能實時修改,必須得去觸發(fā)它。methodMODIFY_TREE.TYPEREFTOmethodMODIFY_TREE.TYPEREFTOTYPEREFTOlt_stringtypeTABLEOFstring,lo_stringtypestring.getthestringofSPLITwd_this->g_pathat'.'intoTABLEis_nodetypewdy_boolean,nodepathtypestring,lw_leveltypestring.is_node=loopatlt_stringinto*formtheNode-IFnodepathisinitial.nodepath=CONCATENATEnodepathlo_stringintonodepathSEPARATEDBY'.'.getifis_node=caculatethedeepthlw_level=lo_string.node_attributes=wd_context->path_get_node(nodepath).is_node=abap_false.is_node=abap_true.getdistinguishwhichlevelitiscaselw_level.whenStatic_Attributes=ls_opc**DowhenStatic_Attributes=ls_coamodifythe"Display_like"textCONCATENATE'ControllingArea'ls_coa-I_KOKRSintoLs_COA-display_textSEPARATEDBYspace.modifythe"Display_icon"textLs_COA-DISPLAY_ICON='ICON_OKAY'.BindwhenStatic_Attributes=ls_ccdmodifythe"Display_like"textCONCATENATE'CompanyCode'Ls_CCD-I_BUKRSintols_ccd-display_textSEPARATEDBYspace.modifythe"Display_icon"textLs_Ccd-DISPLAY_ICON='ICON_OKAY'.BindwhenStatic_Attributes=ls_pltmodifythe"Display_like"textCONCATENATE'Plant'LS_PLT-I_WERKSINTOLS_PLT-DISPLAY_TEXTSEPARATEDBYmodifythe"Display_icon"textLs_PLT-DISPLAY_ICON='ICON_OKAY'.BindwhenStatic_Attributes=ls_pormodifythe"Display_like"textCONCATENATE'PurchaseOrg'ls_por-I_EKORGINTOls_por-DISPLAY_TEXTSEPARATEDBYSPACE.modifythe"Display_icon"textLs_por-DISPLAY_ICON='ICON_OKAY'.BindBindwhenStatic_Attributes=ls_sormodifythe"Display_like"textCONCATENATE'SalesOrg'ls_sor-I_VKORGINTOls_sor-DISPLAY_TEXTSEPARATEDBYSPACE.modifythe"Display_icon"textBind作用:實現(xiàn)所有的節(jié)點全打methodEXPLAND_ALL

TYPEREFTOif_wd_context_node,TYPEREFTOif_wd_context_element,liketableofTYPEREFTOif_wd_context_element,liketableofelem_attributes,TYPEREFTOif_wd_context_element,liketableofelem_attributes.*1st:node_attributes=wd_context->get_child_node('OPC'***getta

溫馨提示

  • 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論