ALV Tree 学习总结.docx

上传人:b****1 文档编号:1586903 上传时间:2023-05-01 格式:DOCX 页数:26 大小:69.21KB
下载 相关 举报
ALV Tree 学习总结.docx_第1页
第1页 / 共26页
ALV Tree 学习总结.docx_第2页
第2页 / 共26页
ALV Tree 学习总结.docx_第3页
第3页 / 共26页
ALV Tree 学习总结.docx_第4页
第4页 / 共26页
ALV Tree 学习总结.docx_第5页
第5页 / 共26页
ALV Tree 学习总结.docx_第6页
第6页 / 共26页
ALV Tree 学习总结.docx_第7页
第7页 / 共26页
ALV Tree 学习总结.docx_第8页
第8页 / 共26页
ALV Tree 学习总结.docx_第9页
第9页 / 共26页
ALV Tree 学习总结.docx_第10页
第10页 / 共26页
ALV Tree 学习总结.docx_第11页
第11页 / 共26页
ALV Tree 学习总结.docx_第12页
第12页 / 共26页
ALV Tree 学习总结.docx_第13页
第13页 / 共26页
ALV Tree 学习总结.docx_第14页
第14页 / 共26页
ALV Tree 学习总结.docx_第15页
第15页 / 共26页
ALV Tree 学习总结.docx_第16页
第16页 / 共26页
ALV Tree 学习总结.docx_第17页
第17页 / 共26页
ALV Tree 学习总结.docx_第18页
第18页 / 共26页
ALV Tree 学习总结.docx_第19页
第19页 / 共26页
ALV Tree 学习总结.docx_第20页
第20页 / 共26页
亲,该文档总共26页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

ALV Tree 学习总结.docx

《ALV Tree 学习总结.docx》由会员分享,可在线阅读,更多相关《ALV Tree 学习总结.docx(26页珍藏版)》请在冰点文库上搜索。

ALV Tree 学习总结.docx

ALVTree学习总结

 ALVTree学习总结

1、系统中有很多标准的例子:

T_cood:

DWDM有个中控件的例子。

另外Package:

SLIS里面有ALV方面的所有例子,参考这些例子就能写出很好的程序。

以下是我做的一个程序:

功能是多个:

saleorder的documentflow。

基本思路:

1、查询结果中只显示Ordertypeandnumber,点击node才触发获取documentflow的功能。

这样对于提高性能非常重要。

2、callfunction'SD_DOCUMENT_FLOW_GET'可以获得某个order的相关文件。

源代码:

注意要在Screen中添加一个usercontrol:

'CSALES'

reportzysdf_04_04.

*$*$--------------------------------------------------------------------

*$*$ObjectName:

ZYSDF_04_04

*$*$Author:

CH210276

*$*$Date:

20081229

*$*$Copyright:

*$*$TransportNumber:

*$*$

*$*$LogicalDatabase:

*$*$SAPScriptname:

*$*$ApplicationArea:

SD

*$*$Description:

Salesdocumentflow

*$*$

*$*$Purpose:

displaysomesalesdocumentflow

*$*$--------------------------------------------------------------------

*$*$Correction#

*$*$ModifiedBy

*$*$Date

*$*$TransportNumber

*$*$--------------------------------------------------------------------

includezysdf_04_04_data.

includezysdf_04_04_pbo.

includezysdf_04_04_pai.

includezysdf_04_04_form.

"INCLUDEzysdf_04_04_class.

*$*$--------------------------------------------------------------------

*$*$TOPOFPAGEEvent

*$*$--------------------------------------------------------------------

top-of-page.

*SubroutineforTopofPageevent.

*performtop_of_page.

*$*$--------------------------------------------------------------------

*$*$ENDOFPAGEEvent

*$*$--------------------------------------------------------------------

end-of-page.

*SubroutineforEndofPageevent.

*performend_of_page.

*$*$--------------------------------------------------------------------

*$*$STARTOFSELECTIONEvent

*$*$--------------------------------------------------------------------

start-of-selection.

callscreen101.

*Populatethefinaloutputtablefordisplay

*$*$--------------------------------------------------------------------

*$*$ENDOFSELECTIONEvent

*$*$--------------------------------------------------------------------

end-of-selection.

*&---------------------------------------------------------------------*

*&IncludeZYSDF_04_04_DATA

*&---------------------------------------------------------------------*

*-------------------------------------------------------------------

*Essentialsteps(Searchfor'§')

*~~~~~~~~~~~~~~~

*1.Usualstepswhenusingcontroltechnology.

*1a.Definereferencevariables.

*1b.CreateALVTreeControlandcorrespondingcontainer.

*

*2.CreateHierarchy-header

*3.CreateemptyTreeControl

*4.Createhierarchy(nodesandleaves)

*4a.Selectdata

*4b.Sortoutputtableaccordingtoyourconceivedhierarchy

*4c.Adddatatotree

*

*5.Senddatatofrontend.

*6.Calldispatchtoprocesstoolbarfunctions

*

*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

classcl_gui_cfwdefinitionload.

data:

g_custom_containertypereftocl_gui_custom_container,"custom_container

gt_fieldcatalogtypelvc_t_fcat,"alvtreeheaderfield

g_treetypereftocl_gui_alv_tree,"objectofalvtree

ok_codetypesy-ucomm."forscreen101

*StructureforselectfromtableVBAK

types:

beginofty_vbak,

vbelntypevbak-vbeln,"SalesDocument

vbtyptypevbak-vbtyp,"SDdocumentcategory

ddtexttypedd07t-ddtext,"ShortTextforFixedValues

endofty_vbak.

*internaltable

datai_vbaktypestandardtableofty_vbakinitialsize0.

*workarea

datawa_vbaktypety_vbak.

*internaltable

datai_outdatatypestandardtableofzvbfainitialsize0.

*workarea

datawa_outdatatypezvbfa.

*$*$Variables

*VariabledeclarationforSelect-Option:

S_vbeln

datag_vbelntypevbak-vbeln.

*VariabledeclarationforSelect-Option:

S_VKORG

datag_vkorgtypevbak-vkorg.

*VariabledeclarationforSelect-Option:

S_VTWEG

datag_vtwegtypevbak-vtweg.

*VariabledeclarationforSelect-Option:

S_SPART

datag_sparttypevbak-spart.

*VariabledeclarationforSelect-Option:

S_VKGRP

datag_vkgrptypevbak-vkgrp.

*VariabledeclarationforSelect-Option:

S_VKBUR

datag_vkburtypevbak-vkbur.

*$*$--------------------------------------------------------------------

*$*$Selectioncriteria

*$*$--------------------------------------------------------------------

selection-screenbeginofblockawithframetitletext-001.

select-optionss_vbelnforg_vbeln."forSelect-Option:

order

select-optionss_vkorgforg_vkorg."forSelect-Option:

orgnization

select-optionss_vtwegforg_vtweg."forSelect-Option:

DistributionChannel

select-optionss_spartforg_spart."forSelect-Option:

Division

select-optionss_vkgrpforg_vkgrp."forSelect-Option:

SalesGroup

select-optionss_vkburforg_vkbur."forSelect-Option:

SalesOffice

selection-screenendofblocka.

*$*$--------------------------------------------------------------------

*$*$INITIALIZATIONEvent

*$*$--------------------------------------------------------------------

initialization.

*$*$--------------------------------------------------------------------

*$*$ATSELECTIONSCREENONEvent

*$*$--------------------------------------------------------------------

*$*$ValidateSalesOrder

atselection-screenons_vbeln.

performsub_validate_vbeln.

*$*$ValidateSalesOrganization

atselection-screenons_vkorg.

performsub_validate_vkorg.

*$*$ValidateDistributionChannel

atselection-screenons_vtweg.

performsub_validate_vtweg.

*$*$ValidateDivision

atselection-screenons_spart.

performsub_validate_spart.

*$*$ValidateSalesGroup

atselection-screenons_vkgrp.

performsub_validate_vkgrp.

*$*$ValidateSalesOffice

atselection-screenons_vkbur.

performsub_validate_vkbur.

*&---------------------------------------------------------------------*

*&IncludeZYSDF_04_04_PBO

*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*

*&ModuleSTATUS_0101OUTPUT

*&---------------------------------------------------------------------*

*text

*----------------------------------------------------------------------*

modulestatus_0101output.

setpf-status'STATUS01'.

*SETTITLEBAR'xxx'.

ifg_treeisinitial.

performsub_init_tree.

endif.

callmethodcl_gui_cfw=>flush.

endmodule."STATUS_0101OUTPUT

*&---------------------------------------------------------------------*

*&IncludeZYSDF_04_04_PAI

*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*

*&ModuleUSER_COMMAND_0101INPUT

*&---------------------------------------------------------------------*

*text

*----------------------------------------------------------------------*

moduleuser_command_0101input.

caseok_code.

when'EXIT'or'BACK'or'CANC'.

performsub_exit.

whenothers.

callmethodcl_gui_cfw=>dispatch.

endcase.

clearok_code.

callmethodcl_gui_cfw=>flush.

endmodule."USER_COMMAND_0101INPUT

*&---------------------------------------------------------------------*

*&IncludeZYSDF_04_04_FORM

*&---------------------------------------------------------------------*

classlcl_tree_event_receiverdefinition.

publicsection.

methodshandle_expand_no_children

foreventexpand_nc

ofcl_gui_alv_tree

importingnode_keysender.

endclass."lcl_tree_event_receiverDEFINITION

*----------------------------------------------------------------------*

*CLASSlcl_tree_event_receiverIMPLEMENTATION

*----------------------------------------------------------------------*

*

*----------------------------------------------------------------------*

classlcl_tree_event_receiverimplementation.

**********************************************************************

*METHOD:

handle_expand_no_children

*Created:

30.12.200816:

33:

33

*

*whenuserclicktheheadernode,thismethodwillbeperform.

**********************************************************************

methodhandle_expand_no_children.

types:

beginoflty_node,

nodetypei,"SalesDocument

hvbelntypevbak-vbeln,"SDdocumentcategory

endoflty_node.

datalw_nodetypelty_node.

datali_nodetypestandardtableoflty_nodeinitialsize0.

datal_docflowtypetdt_docflow.

datalw_docflowtypetds_docflow.

data:

lt_childrentypelvc_t_nkey.

data:

lw_outdatatypezvbfa.

data:

"l_docnumtypevbak-vbeln,

l_docnuvtypevbak-vbeln,

"l_docnum1typevbak-vbeln,

l_docnuv1typevbak-vbeln,

l_key0typelvc_nkey,

l_key1typelvc_nkey,

l_key2typelvc_nkey,

l_node_texttypelvc_value,

l_leveltypei.

*getdataoftheselecteditem

readtablei_outdataintowa_outdataindexnode_key.

*gettheorderducomentflow

callfunction'SD_DOCUMENT_FLOW_GET'

exporting

iv_docnum=wa_outdata-vbelv

*IV_ITEMNUM=

"IV_ALL_ITEMS='X'

importing

et_docflow=l_docflow

.

l_key0=node_key.

l_key1=node_key.

l_level=1.

*addchild'sitem

loopatl_docflowintolw_docflow.

concatenatelw_docflow-descriptionlw_docflow-vbeln

intol_node_text.

lw_outdata-vbelv=lw_docflow-vbelv.

lw_outdata-posnv=lw_docflow-posnv.

lw_outdata-vbeln=lw_docflow-vbeln.

lw_outdata-posnn=lw_docflow-posnn.

lw_outdata-matnr=lw_docflow-matnr.

lw_outdata-rfmng=lw_docflow-rfmng.

lw_outdata-meins=lw_docflow-meins.

lw_outdata-rfwrt=lw_docflow-rfwrt.

lw_outdata-waers=lw_docflow-erdat.

lw_outdata-erdat=lw_docflow-erdat.

clearlw_node.

loopatli_nodeintolw_nodewherehvbelneqlw_docflow-docnuv.

endloop.

iflw_nodeisinitial.

lw_node-node=l_key1.

l_key0=l_key1.

lw_node-hvbeln=lw_docflow-docnuv.

appendlw_nodetoli_node.

else.

l_key0=lw_node-node.

endif.

callmethodg_tree->add_node

exporting

i_relat_node_key=l_key0

i_relationship=cl_gui_column_tree=>relat_last_child

i_node_text=l_node_text

is_outtab_line=lw_outdata"is_node_layout=ls_node_layout

importing

e_new_node_key=l_key1.

endloop.

*expendthech

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2