显示SAP CRM Product hierarchy的一个小工具

简介: 显示SAP CRM Product hierarchy的一个小工具

Recently I start to study SD and I found the product hierarchy in transaction code V/76 could not be viewed in tree style and it is not so convenient to check:



image.pngSo I wrote a simple report to retrieve hierarchy data from table T179 and display the data in a tree as below:image.pngThe source code of report is listed below:REPORT zdisplay_hierarchy.

REPORT zdisplay_hierarchy.

DATA: g_alv_tree TYPE REF TO cl_gui_alv_tree,

 gt_data TYPE STANDARD TABLE OF zcl_alv_tool=>ty_displayed_node,

 ok_code LIKE sy-ucomm,

 save_ok LIKE sy-ucomm,

 ls_data LIKE LINE OF gt_data.

END-OF-SELECTION.

 DATA(lo_tool) = NEW zcl_alv_tool( ).

 DATA(lt_fieldcat) = lo_tool->get_fieldcat_by_data( ls_data ).

 PERFORM change_label.

 CALL SCREEN 100.

MODULE pbo OUTPUT.

 SET PF-STATUS 'MAIN100'.

 SET TITLEBAR 'MAINTITLE'.

 IF g_alv_tree IS INITIAL.

 PERFORM init_tree.

 CALL METHOD cl_gui_cfw=>flush

 EXCEPTIONS

 cntl_system_error = 1

 cntl_error = 2.

 ASSERT sy-subrc = 0.

 ENDIF.

ENDMODULE. " PBO OUTPUT

MODULE pai INPUT.

 save_ok = ok_code.

 CLEAR ok_code.

 CASE save_ok.

 WHEN 'EXIT' OR 'BACK' OR 'CANC'.

 PERFORM exit_program.

 WHEN OTHERS.

 CALL METHOD cl_gui_cfw=>dispatch.

 ENDCASE.

 CALL METHOD cl_gui_cfw=>flush.

ENDMODULE. " PAI INPUT

FORM change_label.

 READ TABLE lt_fieldcat ASSIGNING FIELD-SYMBOL(<id>) INDEX 1.

 <id>-seltext = <id>-reptext = <id>-scrtext_m = <id>-scrtext_s = <id>-scrtext_l = 'Hierarchy ID'.

 <id>-outputlen = 20.

 READ TABLE lt_fieldcat ASSIGNING FIELD-SYMBOL(<text>) INDEX 2.

 <text>-seltext = <text>-reptext = <text>-scrtext_m = <text>-scrtext_l = 'Description'.

 <text>-scrtext_s = 'Text'.

 <text>-outputlen = 40.

ENDFORM.

FORM init_tree.

 g_alv_tree = lo_tool->get_tree( ).

 DATA l_hierarchy_header TYPE treev_hhdr.

 PERFORM build_hierarchy_header CHANGING l_hierarchy_header.

 CALL METHOD g_alv_tree->set_table_for_first_display

 EXPORTING

 is_hierarchy_header = l_hierarchy_header

 CHANGING

 it_fieldcatalog = lt_fieldcat

 it_outtab = gt_data.

 PERFORM create_tree.

 g_alv_tree->frontend_update( ).

 lo_tool->expand( ).

ENDFORM.

FORM create_tree.

 DATA(lt_data) = lo_tool->get_hierarchy_data( ).

 lo_tool->draw_tree( lt_data ).

ENDFORM. " init_tree

FORM build_hierarchy_header CHANGING p_hierarchy_header TYPE treev_hhdr.

 p_hierarchy_header-heading = 'Material hierarchy'.

 p_hierarchy_header-width = 30.

 p_hierarchy_header-width_pix = ' '.

ENDFORM. " build_hierarchy_header

FORM exit_program.

 LEAVE PROGRAM.

ENDFORM. " exit_programIn order to use the report, all you need is to just create a new screen :

image.pngAnd drag a custom container to screen with name “CCONTAINER1”:image.png

相关文章
|
5月前
|
人工智能 搜索推荐 Serverless
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
|
5月前
|
存储
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
|
5月前
|
UED
什么是 SAP Commerce Cloud SmartEdit Product Carousel Component Editor
什么是 SAP Commerce Cloud SmartEdit Product Carousel Component Editor
|
5月前
|
监控 测试技术
SAP 电商云修改 Product Catalog Staged 版本数据后,同步到 online 版本的 UI 操作
SAP 电商云修改 Product Catalog Staged 版本数据后,同步到 online 版本的 UI 操作
|
5月前
|
存储 监控 数据库
SAP 电商云 product catalog 从 staged 到 online 两个版本之间的同步
SAP 电商云 product catalog 从 staged 到 online 两个版本之间的同步
|
5月前
|
监控 安全 数据管理
SAP 电商云 Product catalog 的 staged 和 online 两种版本的设计理念
SAP 电商云 Product catalog 的 staged 和 online 两种版本的设计理念
|
5月前
|
Web App开发 开发者 存储
介绍一个 webp 格式转 png 格式的软件:XNConvert
介绍一个 webp 格式转 png 格式的软件:XNConvert
介绍一个 webp 格式转 png 格式的软件:XNConvert
|
5月前
|
BI 网络安全
如何使用 ABAPGit 在 SAP ABAP 系统安装 abap2xlsx 工具试读版
如何使用 ABAPGit 在 SAP ABAP 系统安装 abap2xlsx 工具试读版
|
5月前
|
存储 数据采集 监控
如何在 SAP S4HANA 中使用 Data Volume Management 工具来确定哪些数据需要归档
如何在 SAP S4HANA 中使用 Data Volume Management 工具来确定哪些数据需要归档
|
5月前
|
数据库
SAP CRM产品主数据无法根据产品描述字段进行搜索的原因
SAP CRM产品主数据无法根据产品描述字段进行搜索的原因
下一篇
无影云桌面