20170225-ALV tree 显示
1.写程序,
2.话屏幕9000,CALL SCREEN 9000.(双击屏幕进去画个容器就ok,+OK_CODE,+去掉注释)
3.处理好ALV 的PBO 初始化,处理用户事件PAO,user command ,定义的按钮都要有用途;
|
||||||||||||||||
*&---------------------------------------------------------------------*
*& Report YDEMO_005
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* REPORT Z_BARRY_ALV_TREE1_BOM MESSAGE-ID OO.
TABLES: STPOX.
INCLUDE <ICON>.
CLASS: CL_GUI_COLUMN_TREE DEFINITION LOAD,
CL_GUI_CFW DEFINITION LOAD .
DATA: TREE1 TYPE REF TO CL_GUI_ALV_TREE ,
MR_TOOLBAR TYPE REF TO CL_GUI_TOOLBAR .
DATA: GS_STPOX TYPE STPOX,
GT_STPOX TYPE STPOX OCCURS ,
GT_FIELDCATALOG TYPE LVC_T_FCAT,
GT_ITEM_LAYOUT TYPE LVC_T_LACI,
GS_ITEM_LAYOUT TYPE LVC_S_LACI,
OKCODE LIKE SY-UCOMM .
TYPES: BEGIN OF GS_F.
INCLUDE STRUCTURE STPOX.
TYPES: NODE_KEY TYPE LVC_NKEY,
END OF GS_F.
DATA: GS_XSTPOX TYPE GS_F ,
GT_XSTPOX TYPE GS_F OCCURS . DATA: L_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER. DATA: WA_TOPMAT TYPE CSTMAT,
WA_DSTST TYPE CSDATA-XFELD.
DATA: IT_MATCAT TYPE STANDARD TABLE OF CSCMAT. PARAMETERS:P_MATNR LIKE MAST-MATNR OBLIGATORY,
P_WERKS LIKE MAST-WERKS OBLIGATORY,
P_STLAL LIKE MAST-STLAL OBLIGATORY DEFAULT '', "可选的 BOM
P_CAPID LIKE RC29L-CAPID OBLIGATORY DEFAULT 'PP01'."BOM应用程序 *PARAMETERS: p_matnr LIKE mara-matnr, "DEFAULT 'YW25K',
* p_werks LIKE ekpo-werks. "DEFAULT '1010' . START-OF-SELECTION.
PERFORM GETDATA.
CALL SCREEN . *&---------------------------------------------------------------------*
*& Form getdata
*&---------------------------------------------------------------------*
FORM GETDATA. *&bom explosion
* CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
** EXPORTING
** FTREL = ' '
** ALEKZ = ' '
** ALTVO = ' '
** AUFSW = ' '
** AUMGB = ' '
** AUMNG =
** AUSKZ = ' '
** AMIND = ' '
** BAGRP = ' '
** BEIKZ = ' '
** BESSL = ' '
** BGIXO = ' '
** BREMS = ' '
** CAPID = 'STD1'
** CHLST = ' '
** COSPR = ' '
** CUOBJ =
** CUOVS =
** CUOLS = ' '
** DATUV =
** DELNL = ' '
** DRLDT = ' '
** EHNDL = ' '
** EMENG =
** ERSKZ = ' '
** ERSSL = ' '
** FBSTP = ' '
** KNFBA = ' '
** KSBVO = ' '
** MBWLS = ' '
** MKTLS = 'X'
** MDMPS = ' '
** MEHRS = ' '
** MKMAT = ' '
** MMAPS = ' '
** SALWW = ' '
** SPLWW = ' '
** MMORY = ' '
** MTNRV = ' '
** NLINK = ' '
** POSTP = ' '
** RNDKZ = ' '
** RVREL = ' '
** SANFR = ' '
** SANIN = ' '
** SANKA = ' '
** SANKO = ' '
** SANVS = ' '
** SCHGT = ' '
** STKKZ = ' '
** STLAL = ' '
** STLAN = ' '
** STPST =
** SVWVO = 'X'
** WERKS = ' '
** NORVL = ' '
** MDNOT = ' '
** PANOT = ' '
** QVERW = ' '
** VERID = ' '
** VRSVO = 'X'
** IMPORTING
** TOPMAT =
** DSTST =
* TABLES
* STB =
** MATCAT =
** EXCEPTIONS
** ALT_NOT_FOUND =
** CALL_INVALID =
** MATERIAL_NOT_FOUND =
** MISSING_AUTHORIZATION =
** NO_BOM_FOUND =
** NO_PLANT_DATA =
** NO_SUITABLE_BOM_FOUND =
** CONVERSION_ERROR =
** OTHERS = CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
CAPID = P_CAPID "'CAD1'
DATUV = SY-DATUM
EMENG = '' "基本用量
MTNRV = P_MATNR
WERKS = P_WERKS MKTLS = 'X' "p_key
MEHRS = 'X' "p_mehrs
STLAL = P_STLAL "可选BOM
STLAN = '' "BOM 用途
* emeng =
IMPORTING
TOPMAT = WA_TOPMAT
DSTST = WA_DSTST
TABLES
STB = GT_STPOX
MATCAT = IT_MATCAT
EXCEPTIONS
ALT_NOT_FOUND =
CALL_INVALID =
MATERIAL_NOT_FOUND =
MISSING_AUTHORIZATION =
NO_BOM_FOUND =
NO_PLANT_DATA =
NO_SUITABLE_BOM_FOUND =
CONVERSION_ERROR =
OTHERS = .
* CASE sy-subrc .
* WHEN .
* MESSAGE e899(fi) WITH 'alt_not_found'.
* WHEN .
* MESSAGE e899(fi) WITH 'call_invalid '.
* WHEN .
* MESSAGE e899(fi) WITH 'material_not_found'.
* WHEN .
* MESSAGE e899(fi) WITH 'missing_authorization'.
* WHEN .
* MESSAGE e899(fi) WITH 'no_bom_found'.
* WHEN .
* MESSAGE e899(fi) WITH 'no_plant_data'.
* WHEN .
* MESSAGE e899(fi) WITH 'no_suitable_bom_found'.
* WHEN .
* MESSAGE e899(fi) WITH 'conversion_error'.
* WHEN .
* MESSAGE e899(fi) WITH 'OTHERS Error'.
* ENDCASE.
LOOP AT GT_STPOX INTO GS_STPOX.
MOVE-CORRESPONDING GS_STPOX TO GS_XSTPOX .
APPEND GS_XSTPOX TO GT_XSTPOX.
ENDLOOP.
ENDFORM. "getdata
*----------------------------------------------------------------------*
* MODULE status_9000 OUTPUT
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'TITLE'.
IF TREE1 IS INITIAL.
PERFORM INIT_TREE.
ENDIF.
CALL METHOD CL_GUI_CFW=>FLUSH.
ENDMODULE. " PBO_9000 OUTPUT
*----------------------------------------------------------------------*
* MODULE user_command_9000 INPUT
*----------------------------------------------------------------------*
MODULE USER_COMMAND_9000 INPUT.
CASE OKCODE.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
CALL METHOD TREE1->FREE.
LEAVE PROGRAM .
WHEN OTHERS.
CALL METHOD CL_GUI_CFW=>DISPATCH.
ENDCASE.
CLEAR OKCODE.
CALL METHOD CL_GUI_CFW=>FLUSH.
ENDMODULE. " okcode INPUT
*&---------------------------------------------------------------------*
*& Form init_tree
*&---------------------------------------------------------------------*
FORM INIT_TREE .
PERFORM BUILD_FIELDCATALOG.
* IF sy-batch IS INITIAL.
* CREATE OBJECT l_custom_container
* EXPORTING
* container_name = 'TREE1'
* EXCEPTIONS
* cntl_error =
* cntl_system_error =
* create_error =
* lifetime_error =
* lifetime_dynpro_dynpro_link = .
* IF sy-subrc <> .
* MESSAGE e000 WITH '创建容器:TREE1 错误'.
* ENDIF.
* ENDIF.
CREATE OBJECT TREE1
EXPORTING
* parent = l_custom_container
PARENT = CL_GUI_CONTAINER=>SCREEN0
NODE_SELECTION_MODE = CL_GUI_COLUMN_TREE=>NODE_SEL_MODE_SINGLE
ITEM_SELECTION = 'X'
NO_HTML_HEADER = 'X'
NO_TOOLBAR = ' '
EXCEPTIONS
CNTL_ERROR =
CNTL_SYSTEM_ERROR =
CREATE_ERROR =
LIFETIME_ERROR =
ILLEGAL_NODE_SELECTION_MODE =
FAILED =
ILLEGAL_COLUMN_NAME = .
IF SY-SUBRC <> .
MESSAGE E000 WITH '创建TREE错误'.
ENDIF.
DATA L_HIERARCHY_HEADER TYPE TREEV_HHDR.
PERFORM BUILD_HIERARCHY_HEADER CHANGING L_HIERARCHY_HEADER.
DATA: LS_VARIANT TYPE DISVARIANT.
LS_VARIANT-REPORT = SY-REPID.
CALL METHOD TREE1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_HIERARCHY_HEADER = L_HIERARCHY_HEADER
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_SAVE = 'A'
IS_VARIANT = LS_VARIANT
CHANGING
IT_OUTTAB = GT_STPOX "table must be emty !!
IT_FIELDCATALOG = GT_FIELDCATALOG.
DATA: L1 TYPE LVC_NKEY ,L2 TYPE LVC_NKEY ,L3 TYPE LVC_NKEY ,L4 TYPE LVC_NKEY ,
L5 TYPE LVC_NKEY ,L6 TYPE LVC_NKEY ,L7 TYPE LVC_NKEY ,L8 TYPE LVC_NKEY ,
L_KEY TYPE LVC_NKEY,
L_LAST_KEY TYPE LVC_NKEY ,
ADDED .
LOOP AT GT_XSTPOX INTO GS_XSTPOX .
MOVE-CORRESPONDING GS_XSTPOX TO GS_STPOX.
CASE GS_STPOX-STUFE .
WHEN ''.
L_KEY = ''.
WHEN ''.
L_KEY = L1.
WHEN ''.
L_KEY = L2.
WHEN ''.
L_KEY = L3.
WHEN ''.
L_KEY = L4.
WHEN ''.
L_KEY = L5.
ENDCASE.
PERFORM ADD_COMPLETE_LINE USING GS_STPOX L_KEY
CHANGING L_LAST_KEY.
GS_XSTPOX-NODE_KEY = L_LAST_KEY.
CASE GS_STPOX-STUFE .
WHEN ''.
L1 = L_LAST_KEY.
WHEN ''.
L2 = L_LAST_KEY.
WHEN ''.
L3 = L_LAST_KEY.
WHEN ''.
L4 = L_LAST_KEY.
WHEN ''.
L5 = L_LAST_KEY.
WHEN ''.
L6 = L_LAST_KEY.
ENDCASE.
MODIFY GT_XSTPOX FROM GS_XSTPOX .
ENDLOOP.
CALL METHOD TREE1->UPDATE_CALCULATIONS.
CALL METHOD TREE1->FRONTEND_UPDATE.
ENDFORM. " init_tree
*&---------------------------------------------------------------------*
*& Form build_fieldcatalog
*&---------------------------------------------------------------------*
FORM BUILD_FIELDCATALOG.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'STPOX'
CHANGING
CT_FIELDCAT = GT_FIELDCATALOG.
DATA: LS_FIELDCATALOG TYPE LVC_S_FCAT.
LOOP AT GT_FIELDCATALOG INTO LS_FIELDCATALOG.
* CASE ls_fieldcatalog-fieldname.
* WHEN 'CARRID' OR 'CONNID' OR 'FLDATE'.
* ls_fieldcatalog-no_out = 'X'.
* ls_fieldcatalog-key = ''.
* WHEN 'PRICE' OR 'SEATSOCC' OR 'SEATSMAX' OR 'PAYMENTSUM'.
** ls_fieldcatalog-do_sum = 'X'.
* WHEN 'PLANETYPE'.
* ls_fieldcatalog-edit = 'X'.
* ls_fieldcatalog-style = cl_gui_alv_grid=>mc_style_enabled .
* ENDCASE.
MODIFY GT_FIELDCATALOG FROM LS_FIELDCATALOG.
ENDLOOP.
ENDFORM. " build_fieldcatalog
*&---------------------------------------------------------------------*
*& Form build_hierarchy_header
*&---------------------------------------------------------------------*
FORM BUILD_HIERARCHY_HEADER CHANGING
P_HIERARCHY_HEADER TYPE TREEV_HHDR.
*
P_HIERARCHY_HEADER-HEADING = 'BOM层次'.
P_HIERARCHY_HEADER-TOOLTIP = 'ToolTip'.
P_HIERARCHY_HEADER-WIDTH = .
P_HIERARCHY_HEADER-WIDTH_PIX = ''.
*
ENDFORM. " build_hierarchy_header
*&---------------------------------------------------------------------*
*& Form add_complete_line
*&---------------------------------------------------------------------*
FORM ADD_COMPLETE_LINE USING PS_STPOX TYPE STPOX
P_RELAT_KEY TYPE LVC_NKEY
CHANGING P_NODE_KEY TYPE LVC_NKEY.
DATA: L_NODE_TEXT TYPE LVC_VALUE.
* set item-layout
DATA: LT_ITEM_LAYOUT TYPE LVC_T_LAYI,
LS_ITEM_LAYOUT TYPE LVC_S_LAYI.
DATA: STUFE_NUM() TYPE N.
LS_ITEM_LAYOUT-FIELDNAME = TREE1->C_HIERARCHY_COLUMN_NAME.
LS_ITEM_LAYOUT-CLASS = CL_GUI_COLUMN_TREE=>ITEM_CLASS_TEXT.
* ls_item_layout-editable = 'X'.
* ls_item_layout-chosen = 'X'. " 设置为选中状态
APPEND LS_ITEM_LAYOUT TO LT_ITEM_LAYOUT.
* l_node_text = ps_stpox-ojtxp.
STUFE_NUM = PS_STPOX-STUFE.
CONCATENATE STUFE_NUM ',' PS_STPOX-OJTXP INTO L_NODE_TEXT.
CALL METHOD TREE1->ADD_NODE
EXPORTING
I_RELAT_NODE_KEY = P_RELAT_KEY
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
IS_OUTTAB_LINE = PS_STPOX
I_NODE_TEXT = L_NODE_TEXT
IT_ITEM_LAYOUT = LT_ITEM_LAYOUT
IMPORTING
E_NEW_NODE_KEY = P_NODE_KEY.
ENDFORM. " add_complete_line
20170225-ALV tree 显示的更多相关文章
- OO方式下,ALV TREE和ALV GRID的不同之处
作为大部分报表程序的基础,ALV GRID差不多是每个ABAP开发者必须了解和掌握的内容,因此网上也不乏相关资料,而ALV TREE的应用相对较少,中文资料也就比较少见了.实际上,ALV TREE和A ...
- ALV TREE 实例
ALV TREE 实例 REPORT ZRPT_PS_PS021TREE . TABLES: PROJ, "项目定义数据 PRPS, "WBS元素数据 ZCJ30, "A ...
- ALV Tree demo(WBS元素分层显示)[引用别人的]
原文地址:http://www.xuebuyuan.com/1666753.html 按层次显示WBS编码及描述,附加节点双击展开事件和Item双击跳转CJ03功能. 因为本人懒,本例代码都是从标准的 ...
- ALV TREE中双击触发PAI事件的方法
用事件类实现双击事件,实例化后使用set handler注册到ALV对象.斜体部分为事件方法的具体实现. 代码如下 CLASS lcl_tree_event_receiver DEFINITION. ...
- ALV tree DUMP 问题处理-20180328
Category ABAP Programming Error Runtime Errors MESSAGE_TYPE_X ABAP Program SAPLOLEA Application Comp ...
- ALV tree标准DEMO
BCALV_TREE_01 ALV 树控制:构建层次树 BCALV_TREE_02 ALV 树控制:事件处理 BCALV_TREE_03 ALV 树控制:使用自己的上下文菜单 BCALV_TREE_0 ...
- 文件目录tree显示,python
#/usr/bin/python import os def travelTree(currentPath, count=0): if not os.path.exists(currentPath): ...
- SAP翔子_ABAP_DEMO篇索引
序号 描述 SAP翔子_ABAP_DEMO篇1 ABAP DEMO篇1 单层反查BOM SAP翔子_ABAP_DEMO篇2 ABAP DEMO篇2 删除工艺路线 SAP翔子_ABAP_DEMO篇3 A ...
- ABAP分享六 alv显示的几种方式的简单示例
方法1,也是大家常见的方法通过函数 REUSE_ALV_GRID_DISPLAY TYPES: BEGIN OF ty_spfli, "定义结构 carrid like s ...
随机推荐
- BZOJ 3282 Tree ——Link-Cut Tree
[题目分析] 明显的LCT维护连通性的题目. access的操作是比较巧妙的,可以把结点到根变成偏爱路径,而且保证了该点是链上深度最深的点. 而且需边的思想也很巧妙,保证了复杂度. 但是只能用于修改路 ...
- 如何用Eclipse将普通的JavaWeb项目转为Maven项目
最新自己的第一个项目差不多稳定运行之后 想着将项目转为Maven项目.于是参考网上成功的将自己的普通的项目转为了maven项目,现在记录一下: 0.普通的java项目的结构如下: 1.接下来开始进行正 ...
- shell按日期自动切割nginx日志脚本
shell按日期自动切割nginx日志脚本 参考:自学it网 http://www.zixue.it/. #nginx日志切割脚本 #author:ce #!/bin/bash #设置日志文件存放目录 ...
- HDU 1358字符串循环节问题 ,next数组
求字符串循环节,要求每前i个字符串前缀是否循环,有的话打印出来. 我对j=next[i]数组(未优化,从0开始,第一个为-1,)理解:字符s[i]的前面的字符串,最长的相同的前缀和后缀 的长度,因此, ...
- Codeforces 837D Round Subset(背包)
题目链接 Round Subset 题意 在n个数中选择k个数,求这k个数乘积末尾0个数的最大值. 首先我们预处理出每个数5的因子个数c[i]和2的因子个数d[i] 然后就可以背包了. 设f[i] ...
- slf4j 搭配 log4j2 处理日志
目录 关于 log4j 关于 slf4j 案例使用 关于 log4j Log4j + Slf4j 的使用组合最为常见,但是我们知道 Log4j 目前已经停止更新了.Apache推出了新的 Log4j2 ...
- Unix操作系统LD_PRELOAD简介
http://blog.csdn.net/ieearth/article/details/49952047 Unix操作系统的动态链接库的知识中,这个功能主要就是用来有选择性的载入Unix操作系统不同 ...
- 使用crontab定时执行脚本时别忘了输出重定向>
原文:https://blog.csdn.net/solmyr_biti/article/details/50683279 -------------------------------------- ...
- 【试水CAS-4.0.3】第06节_CAS服务端配置HTTPS
完整版见https://jadyer.github.io/2012/05/30/tomcat-https/ /** * @see CAS服务端配置HTTPS * @see -------------- ...
- Andriod 从源码的角度详解View,ViewGroup的Touch事件的分发机制
转自:xiaanming的博客(http://blog.csdn.net/xiaanming/article/details/21696315) 今天这篇文章主要分析的是Android的事件分发机制, ...