WEBDYNPRO FPM 框架

2024-01-22 10:36
文章标签 fpm 框架 webdynpro

本文主要是介绍WEBDYNPRO FPM 框架,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

框架搭建

1、FPM_OVP_COMPONENT

 1 METHOD change_toolbar_btn .2 * enabled     "ABAP_TRUE可用 ABAP_FALSE不可用3 * visibility  "01不可见 02可见4   DATA: ls_btn TYPE if_fpm_ovp=>ty_s_toolbar_button.5   CHECK wd_this->mo_cnr IS BOUND.6 7   TRY .8       CLEAR:ls_btn.9       wd_this->mo_cnr->get_toolbar_button(
10         EXPORTING
11           iv_toolbar_element_id = id
12         IMPORTING
13           es_toolbar_button     = ls_btn
14       ).
15       CHECK ls_btn IS NOT INITIAL.
16 
17 *      IF text IS SUPPLIED.
18       ls_btn-text = text.
19 *      ENDIF.
20       IF enabled IS SUPPLIED.
21         ls_btn-enabled = enabled.
22       ENDIF.
23       IF visibility IS SUPPLIED.
24         ls_btn-visibility = visibility.
25       ENDIF.
26 
27       wd_this->mo_cnr->change_toolbar_button(
28         iv_content_area   = \'PAGE_1\'
29         is_toolbar_button = ls_btn ).
30     CATCH cx_root INTO DATA(lo_err).
31       DATA(lv_txt) = lo_err->get_text( ).
32   ENDTRY.
33 
34 ENDMETHOD.
1 METHOD fire_view_action .
2 
3   DATA: lo_action TYPE REF TO cl_wdr_action.
4   lo_action ?= wd_this->z_curr_view->get_action( action_name ).
5   CHECK lo_action IS BOUND.
6   lo_action->fire( ).
7 
8 ENDMETHOD.
 1 METHOD init_toolbar .2 3   DATA: lt_elm     TYPE if_fpm_ovp=>ty_t_toolbar_element,4         lv_txt     TYPE fpm_text,5         lv_enable  TYPE fpm_enabled,6         lv_visible TYPE fpm_visibility.7 8   wd_this->mo_fpm = cl_fpm_factory=>get_instance( ).9   wd_this->mo_cnr ?= wd_this->mo_fpm->get_service( `CNR_OVP` ).
10 
11   TRY.
12       wd_this->mo_cnr->get_toolbar_elements( IMPORTING et_toolbar_element = lt_elm ).
13     CATCH cx_root INTO DATA(lo_err).
14       DATA(lv_err_txt) = lo_err->get_text( ).
15   ENDTRY.
16 
17   LOOP AT lt_elm INTO DATA(ls_elm).
18     CLEAR:lv_txt.
19     CASE ls_elm-element_id.
20       WHEN \'FPM_SAVE_1\'.
21         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/SAVE\' ).
22         lv_enable = abap_true.
23         lv_visible = 2.
24 
25       WHEN \'FPM_CANCEL_1\'.
26         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/ZCX\' ).
27         lv_enable = abap_true.
28         lv_visible = 2.
29 
30       WHEN \'ZMDG_COMMIT\'.
31         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/COMMIT\' ).
32         lv_enable = abap_true.
33         lv_visible = 2.
34 
35       WHEN \'ZMDG_COMMITSP\'.
36         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/SP\' ).
37         lv_enable = abap_true.
38         lv_visible = 1.
39 
40       WHEN \'ZMDG_COMMITSPJJ\'.
41         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/SPJJ\' ).
42         lv_enable = abap_true.
43         lv_visible = 1.
44 
45       WHEN OTHERS.
46     ENDCASE.
47 
48     CHECK lv_txt IS NOT INITIAL.
49     change_toolbar_btn(
50       id         = ls_elm-element_id
51       text       = lv_txt
52       enabled    = lv_enable
53       visibility = lv_visible
54     ).
55   ENDLOOP.
56 
57 ENDMETHOD.
  1 METHOD modify_toolbar .2 3 *  get view context4   DATA lo_view_context TYPE REF TO if_wd_context_node.5   lo_view_context ?= wd_this->z_curr_view->get_context( )->root_node.6 7   DATA: lo_nd_read_only    TYPE REF TO if_wd_context_node,8         lo_nd_dispaly_only TYPE REF TO if_wd_context_node,9         lo_el_read_only    TYPE REF TO if_wd_context_element,10         lo_el_dispaly_only TYPE REF TO if_wd_context_element.11 12   DATA: lv_commitoa       TYPE wdy_boolean,13         lv_read_commit    TYPE wdy_boolean,14         lv_dispaly_commit TYPE wdy_boolean.15 16 *   get node17   lo_nd_read_only = lo_view_context->get_child_node( name = wd_this->wdctx_read_only ).18   lo_nd_dispaly_only = lo_view_context->get_child_node( name = wd_this->wdctx_dispaly_only ).19 20 *   get element21   lo_el_read_only = lo_nd_read_only->get_element( ).22   lo_el_dispaly_only = lo_nd_dispaly_only->get_element( ).23   CHECK lo_el_read_only IS NOT INITIAL.24   CHECK lo_el_dispaly_only IS NOT INITIAL.25 26 *   get single attribute27   lo_el_read_only->get_attribute(28     EXPORTING29       name  = `COMMITOA`30     IMPORTING31       value = lv_commitoa ).32   lo_el_read_only->get_attribute(33     EXPORTING34       name  = `COMMIT`35     IMPORTING36       value = lv_read_commit ).37   lo_el_dispaly_only->get_attribute(38     EXPORTING39       name  = `COMMIT`40     IMPORTING41       value = lv_dispaly_commit ).42 43 44 45 *  change toolbar buttons attr.46   DATA: lt_elm     TYPE if_fpm_ovp=>ty_t_toolbar_element,47         lv_txt     TYPE fpm_text,48         lv_enable  TYPE fpm_enabled,49         lv_visible TYPE fpm_visibility.50   TRY.51       wd_this->mo_cnr->get_toolbar_elements( IMPORTING et_toolbar_element = lt_elm ).52     CATCH cx_root INTO DATA(lo_err).53       DATA(lv_err_txt) = lo_err->get_text( ).54   ENDTRY.55 56   LOOP AT lt_elm INTO DATA(ls_elm).57     CASE ls_elm-element_id.58       WHEN \'FPM_SAVE_1\'.59         lv_enable = lv_commitoa.60         IF lv_read_commit = abap_true.61           lv_visible = 2. "Visible62         ELSE.63           lv_visible = 1. "Invisible64         ENDIF.65         IF lv_visible = 1.66           lv_enable = abap_false.67         ENDIF.68         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/SAVE\' ).69 70       WHEN \'FPM_CANCEL_1\'.71         lv_enable = abap_true.72         IF lv_read_commit = abap_true.73           lv_visible = 2. "Visible74         ELSE.75           lv_visible = 1. "Invisible76         ENDIF.77         IF lv_visible = 1.78           lv_enable = abap_false.79         ENDIF.80         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/ZCX\' ).81 82       WHEN \'ZMDG_COMMIT\'.83         lv_enable = lv_commitoa.84         IF lv_read_commit = abap_true.85           lv_visible = 2. "Visible86         ELSE.87           lv_visible = 1. "Invisible88         ENDIF.89         IF lv_visible = 1.90           lv_enable = abap_false.91         ENDIF.92         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/COMMIT\' ).93 94       WHEN \'ZMDG_COMMITSP\'.95         lv_enable = abap_true.96         IF lv_dispaly_commit = abap_true.97           lv_visible = 2. "Visible98         ELSE.99           lv_visible = 1. "Invisible
100         ENDIF.
101         IF lv_visible = 1.
102           lv_enable = abap_false.
103         ENDIF.
104         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/SP\' ).
105 
106       WHEN \'ZMDG_COMMITSPJJ\'.
107         lv_enable = abap_true.
108         IF lv_dispaly_commit = abap_true.
109           lv_visible = 2. "Visible
110         ELSE.
111           lv_visible = 1. "Invisible
112         ENDIF.
113         IF lv_visible = 1.
114           lv_enable = abap_false.
115         ENDIF.
116         lv_txt = cl_wd_utilities=>get_otr_text_by_alias( alias = \'ZMDG01/SPJJ\' ).
117 
118       WHEN OTHERS.
119     ENDCASE.
120 
121     change_toolbar_btn(
122       id         = ls_elm-element_id
123       text       = lv_txt
124       enabled    = lv_enable
125       visibility = lv_visible
126     ).
127 
128   ENDLOOP.
129 
130 ENDMETHOD.
 1 METHOD needs_confirmation .2 3   CASE io_event->mv_event_id.4     WHEN \'FPM_CLOSE\'.5       DATA(lo_win_mngr) = wd_this->wd_get_api( )->get_window_manager( ).6       DATA: lt_text TYPE string_table.7       lt_text = VALUE #( ( `未保存的数据将会丢失,是否继续?` ) ).8       CALL METHOD lo_win_mngr->create_popup_to_confirm9         EXPORTING
10           text         = lt_text
11           button_kind  = 5    "Yes,No,Cancel
12           message_type = if_wd_message_manager=>co_type_warning
13 *         close_button = ABAP_TRUE
14 *         window_title =
15 *         window_left_position =
16 *         window_top_position  =
17 *         window_position      =
18 *         window_width =
19 *         window_height        =
20 *         default_button       =
21         RECEIVING
22           result       = DATA(lo_popup_window).
23 *      IF lO_POPUP_WINDOW NE 1.
24 *        wd_this->wd_get_api( )->cancel_navigation( ).
25 *      ENDIF.
26 
27     WHEN OTHERS.
28   ENDCASE.
29 
30 ENDMETHOD.
 1 METHOD popup_confirm .2 3   DATA(lo_win_mngr) = wd_this->wd_get_api( )->get_window_manager( ).4   DATA: lt_text TYPE string_table.5   lt_text = VALUE #( ( `未保存的数据将会丢失,是否继续?` ) ).6   CALL METHOD lo_win_mngr->create_popup_to_confirm7     EXPORTING8       text         = lt_text9       button_kind  = 4    "Yes,No
10       message_type = if_wd_message_manager=>co_type_warning
11       close_button = abap_false
12 *     window_title =
13 *     window_left_position =
14 *     window_top_position  =
15 *     window_position      =
16 *     window_width =
17 *     window_height        =
18 *     default_button       =
19     RECEIVING
20       result       = DATA(lo_popup_window).
21 
22   lo_popup_window->subscribe_to_button_event(
23     button      = if_wd_window=>co_button_yes
24 *   BUTTON_TEXT = \'\'
25 *   TOOLTIP     =
26     action_name = \'ZYES\'
27     action_view = wd_this->z_curr_view
28   ).
29 
30   lo_popup_window->subscribe_to_button_event(
31     button      = if_wd_window=>co_button_no
32 *   BUTTON_TEXT = \'\'
33 *   TOOLTIP     =
34     action_name = \'ZNO\'
35     action_view = wd_this->z_curr_view
36   ).
37 
38   lo_popup_window->open( ).
39 
40 
41 
42 
43 ENDMETHOD.
 1 METHOD process_event .2 3   CASE io_event->mv_event_id.4     WHEN \'FPM_SAVE\'.5       fire_view_action( \'SAVE_DATA\' ).6 7     WHEN \'FPM_CANCEL\'.8 *      fire_view_action( \'ZCX\' ).9       wd_this->zf_close = abap_true.
10       wd_this->mo_fpm->raise_event_by_id( \'FPM_CLOSE\' ).
11 
12     WHEN \'FPM_CLOSE\'.
13       popup_confirm( ).
14 
15     WHEN \'ZMDG_COMMIT\'.
16       fire_view_action( \'COMMITOA\' ).
17 
18     WHEN \'ZMDG_COMMITSP\'.
19       fire_view_action( \'COMMIT_APPROVE\' ).
20 
21     WHEN \'ZMDG_COMMITSPJJ\'.
22       fire_view_action( \'COMMIT_SPJJ\' ).
23 
24     WHEN OTHERS.
25   ENDCASE.
26 
27   modify_toolbar( ).
28 
29 ENDMETHOD.
 1 METHOD report_msg .2 3 *   get message manager4   DATA lo_api_controller     TYPE REF TO if_wd_controller.5   DATA lo_message_manager    TYPE REF TO if_wd_message_manager.6 7   lo_api_controller ?= wd_This->Wd_Get_Api( ).8 9   CALL METHOD lo_api_controller->get_message_manager
10     RECEIVING
11       message_manager = lo_message_manager.
12 
13 *   report message
14   CALL METHOD lo_message_manager->report_message
15     EXPORTING
16       message_text = text
17       message_type = type.
18 
19 ENDMETHOD.
1 METHOD wddobeforenavigation .
2 
3   IF wd_this->z_inited = abap_true.
4     DATA(lo_navi_to) = wd_this->mo_fpm->get_navigate_to( ).
5     popup_confirm( ).
6   ENDIF.
7 
8 ENDMETHOD.
  1 METHOD wddoinit .2 3   DATA lo_nd_header_data TYPE REF TO if_wd_context_node.4   DATA lo_nd_header_data_info TYPE REF TO if_wd_context_node_info.5   DATA ls_header_data TYPE wd_this->element_header_data.6 7   DATA lt_value_set TYPE wdr_context_attr_value_list.8   DATA ls_value_set TYPE wdr_context_attr_value.9   lo_nd_header_data = wd_context->get_child_node( name = wd_this->wdctx_header_data ).10   lo_nd_header_data_info = lo_nd_header_data->get_node_info( ).11 * define list of raddiobuttons by changing type infos of attribute bound to property selectedKey12 13   SELECT * INTO TABLE @DATA(lt_tvtwt) FROM tvtwt WHERE spras = @sy-langu AND vtweg >= \'10\' AND vtweg <= \'50\'.14   LOOP AT lt_tvtwt INTO DATA(ls_tvtwt).15     ls_value_set-text  = ls_tvtwt-vtext.16     ls_value_set-value = ls_tvtwt-vtweg.17     APPEND ls_value_set TO lt_value_set.18   ENDLOOP.19   lo_nd_header_data_info->set_attribute_value_set( name = \'VTWEG\' value_set = lt_value_set ).20 21   REFRESH lt_value_set.22   SELECT * INTO TABLE @DATA(lt_t077x) FROM t077x WHERE spras = @sy-langu AND ( ktokd = \'Z001\' OR ktokd = \'Z002\') .23   LOOP AT lt_t077x INTO DATA(ls_t077x).24     ls_value_set-text  = ls_t077x-txt30.25     ls_value_set-value = ls_t077x-ktokd.26     APPEND ls_value_set TO lt_value_set.27   ENDLOOP.28   lo_nd_header_data_info->set_attribute_value_set( name = \'KTOKD\' value_set = lt_value_set ).29   REFRESH lt_value_set.30 31   SELECT * INTO TABLE @DATA(lt_T005T) FROM t005t WHERE spras = @sy-langu  .32   LOOP AT lt_T005T INTO DATA(ls_T005T).33     ls_value_set-text  = ls_T005T-landx.34     ls_value_set-value = ls_T005T-land1.35     APPEND ls_value_set TO lt_value_set.36   ENDLOOP.37   lo_nd_header_data_info->set_attribute_value_set( name = \'LAND1\' value_set = lt_value_set ).38   REFRESH lt_value_set.39 40   DATA: i_input  TYPE dd07v,o_output TYPE dd07v.41   i_input-domname = \'ZDCJLXS\'.42 43   i_input-domvalue_l = \'A1\'.44   CALL FUNCTION \'ZMDG_GET_DD07V\'45     EXPORTING46       i_input  = i_input47     IMPORTING48       o_output = o_output.49   ls_value_set-text  = o_output-ddtext ."\'新增客户代码\'.50   ls_value_set-value = \'A1\'.51   APPEND ls_value_set TO lt_value_set.52   i_input-domvalue_l = \'A2\'.53   CALL FUNCTION \'ZMDG_GET_DD07V\'54     EXPORTING55       i_input  = i_input56     IMPORTING57       o_output = o_output.58   ls_value_set-text  = o_output-ddtext ."\'客户抬头变更\'.59   ls_value_set-value = \'A2\'.60   APPEND ls_value_set TO lt_value_set.61   i_input-domvalue_l = \'A3\'.62   CALL FUNCTION \'ZMDG_GET_DD07V\'63     EXPORTING64       i_input  = i_input65     IMPORTING66       o_output = o_output.67   ls_value_set-text  = o_output-ddtext ."\'送达方变售达方\'.68   ls_value_set-value = \'A3\'.69   APPEND ls_value_set TO lt_value_set.70   i_input-domvalue_l = \'A4\'.71   CALL FUNCTION \'ZMDG_GET_DD07V\'72     EXPORTING73       i_input  = i_input74     IMPORTING75       o_output = o_output.76   ls_value_set-text  = o_output-ddtext ."\'与关联企业共用编码\'.77   ls_value_set-value = \'A4\'.78   APPEND ls_value_set TO lt_value_set.79 80   lo_nd_header_data_info->set_attribute_value_set( name = \'ZCJLX\' value_set = lt_value_set ).81   REFRESH lt_value_set.82 83   DATA lo_el_header_data TYPE REF TO if_wd_context_element.84 85 * navigate from <CONTEXT> to <HEADER_DATA> via lead selection86   lo_nd_header_data = wd_context->get_child_node( name = wd_this->wdctx_header_data ).87 88 * get element via lead selection89   lo_el_header_data = lo_nd_header_data->get_element( ).90 91   SELECT SINGLE bname name_text zssbm zssgs zcqb92    INTO (ls_header_data-bname,ls_header_data-bnametext,ls_header_data-zssbm,ls_header_data-zssgs,ls_header_data-zcqb)93    FROM v_username94   INNER JOIN ztoasapuser ON ztoasapuser~zsapuname = v_username~bname95   WHERE bname = sy-uname .96 97 *   set all declared attributes98   lo_el_header_data->set_static_attributes(99      static_attributes = ls_header_data ).
100 
101 
102 
103   init_toolbar( ).
104 
105 ENDMETHOD.

PFCG配置

这篇关于WEBDYNPRO FPM 框架的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/632714

相关文章

MyBatis框架实现一个简单的数据查询操作

《MyBatis框架实现一个简单的数据查询操作》本文介绍了MyBatis框架下进行数据查询操作的详细步骤,括创建实体类、编写SQL标签、配置Mapper、开启驼峰命名映射以及执行SQL语句等,感兴趣的... 基于在前面几章我们已经学习了对MyBATis进行环境配置,并利用SqlSessionFactory核

cross-plateform 跨平台应用程序-03-如果只选择一个框架,应该选择哪一个?

跨平台系列 cross-plateform 跨平台应用程序-01-概览 cross-plateform 跨平台应用程序-02-有哪些主流技术栈? cross-plateform 跨平台应用程序-03-如果只选择一个框架,应该选择哪一个? cross-plateform 跨平台应用程序-04-React Native 介绍 cross-plateform 跨平台应用程序-05-Flutte

Spring框架5 - 容器的扩展功能 (ApplicationContext)

private static ApplicationContext applicationContext;static {applicationContext = new ClassPathXmlApplicationContext("bean.xml");} BeanFactory的功能扩展类ApplicationContext进行深度的分析。ApplicationConext与 BeanF

数据治理框架-ISO数据治理标准

引言 "数据治理"并不是一个新的概念,国内外有很多组织专注于数据治理理论和实践的研究。目前国际上,主要的数据治理框架有ISO数据治理标准、GDI数据治理框架、DAMA数据治理管理框架等。 ISO数据治理标准 改标准阐述了数据治理的标准、基本原则和数据治理模型,是一套完整的数据治理方法论。 ISO/IEC 38505标准的数据治理方法论的核心内容如下: 数据治理的目标:促进组织高效、合理地

ZooKeeper 中的 Curator 框架解析

Apache ZooKeeper 是一个为分布式应用提供一致性服务的软件。它提供了诸如配置管理、分布式同步、组服务等功能。在使用 ZooKeeper 时,Curator 是一个非常流行的客户端库,它简化了 ZooKeeper 的使用,提供了高级的抽象和丰富的工具。本文将详细介绍 Curator 框架,包括它的设计哲学、核心组件以及如何使用 Curator 来简化 ZooKeeper 的操作。 1

【Kubernetes】K8s 的安全框架和用户认证

K8s 的安全框架和用户认证 1.Kubernetes 的安全框架1.1 认证:Authentication1.2 鉴权:Authorization1.3 准入控制:Admission Control 2.Kubernetes 的用户认证2.1 Kubernetes 的用户认证方式2.2 配置 Kubernetes 集群使用密码认证 Kubernetes 作为一个分布式的虚拟

Spring Framework系统框架

序号表示的是学习顺序 IoC(控制反转)/DI(依赖注入): ioc:思想上是控制反转,spring提供了一个容器,称为IOC容器,用它来充当IOC思想中的外部。 我的理解就是spring把这些对象集中管理,放在容器中,这个容器就叫Ioc这些对象统称为Bean 用对象的时候不用new,直接外部提供(bean) 当外部的对象有关系的时候,IOC给它俩绑好(DI) DI和IO

Sentinel 高可用流量管理框架

Sentinel 是面向分布式服务架构的高可用流量防护组件,主要以流量为切入点,从限流、流量整形、熔断降级、系统负载保护、热点防护等多个维度来帮助开发者保障微服务的稳定性。 Sentinel 具有以下特性: 丰富的应用场景:Sentinel 承接了阿里巴巴近 10 年的双十一大促流量的核心场景,例如秒杀(即突发流量控制在系统容量可以承受的范围)、消息削峰填谷、集群流量控制、实时熔断下游不可用应

利用Django框架快速构建Web应用:从零到上线

随着互联网的发展,Web应用的需求日益增长,而Django作为一个高级的Python Web框架,以其强大的功能和灵活的架构,成为了众多开发者的选择。本文将指导你如何从零开始使用Django框架构建一个简单的Web应用,并将其部署到线上,让世界看到你的作品。 Django简介 Django是由Adrian Holovaty和Simon Willison于2005年开发的一个开源框架,旨在简

Yii框架relations的使用

通过在 relations() 中声明这些相关对象,我们就可以利用强大的 Relational ActiveRecord (RAR) 功能来访问资讯的相关对象,例如它的作者和评论。不需要自己写复杂的 SQL JOIN 语句。 前提条件 在组织数据库时,需要使用主键与外键约束才能使用ActiveReocrd的关系操作; 场景 申明关系 两张表之间的关系无非三种:一对多;一对一;多对多; 在