WEB UI 常用类 ;cl_thtmlb_util

wui->常用类
CL_CHTMLB_CONFIG_TAB_EXCEL_EXP 表格导出EXCEL实现类

CL_CHTMLB_XML_PROVIDER XML处理类

CL_CRM_DOCUMENTS KW Explorer in CRM

CL_HTTP_UTILITY HTTP Framework (iHTTP) HTTP Utilities

CL_THTMLB_UTIL
属性包括系统用到的图标ID,例如GC_ICON_CLOSE等

CL_CHTMLB_CONFIG_TAB_EXCEL_EXP
在WEB界面,将结果导出到EXCEL文件时调用的类

  1. CL_CRM_UIU_MKT_OBJ_MAPPER :Mapping BOR - UI Object Type
    静态方法:SHOW_BOR_OBJECT_IN_UI Show BOR object in UI

  2. CL_CRM_WEB_UTILITY :CRM Web Utilities
    静态方法: CREATE_URL 构建URL连接字符串

  3. CL_BSP_UTILITY :Business Server Pages (BSP) Utility Class

  4. CL_EXITHANDLER :BADI 出口跟踪

  5. CL_THTMLB_UTIL :Contain utility methods commonly used between tags
    给按钮加图标: ls_button-type = cl_thtmlb_util=>gc_icon_add.
    ls_button-text = ‘新建’.
    ls_button-on_click = ‘INSERT’.
    在html页面给按钮加图标
    <%
    lv_icon_url = CL_THTMLB_UTIL=>GET_ICON_URL( ‘edit.gif’ ).
    %>
    <thtmlb:button id=“CHANGE”
    onClick=“CHANGE”
    enabled=“<%= controller->to_detail %>”
    iconSrc = “<%= lv_icon_url %>”
    tooltip = “<%=OTR(crm_ic_appl/Change)%>” />

  6. cl_crm_erms_catego_as_default 读取事件分类

  7. CL_ACTION_EXECUTE 通过action可以拷贝单据 badi定义:EXEC_METHODCALL_PPF

  8. CL_CRM_IC_SERVICES IC Singleton to access services

  9. CL_BSP_RUNTIME Business Server Pages (BSP) Runtime

  10. 几个常用字符串处理类
    CL_ABAP_CHAR_UTILITIES CL_ABAP_STRING_UTILITIES
    属性HORIZONTAL_TAB TAB符号
    属性CR_LF 换行符号

  11. CL_ABAP_LIST_UTILITIES Utilities for ABAP Lists

  12. IF_ICCMP_GLOBAL_CONTROLLER_CON IC的全局对象接口。

13.CL_CRM_UIU_BT_NAVIGATE CRM UIU: FollowUp navigation 动态导航

  1. CL_CRM_UI_DATA_CONTEXT_SRV Data context access utility GDC - global data context
    读出当前确认的客户。在control类中执行方法读出,参考类CL_ICCMP_BT_INRHISTSEARCH_IMPL的方法SET_ACCOUNT(在组件ICCMP_BT_INR)
    DATA: lr_gdc TYPE REF TO if_crm_ui_data_context.
    DATA: lr_entity TYPE REF TO if_bol_bo_property_access.
    DATA: lv_bp_number TYPE string.
    DATA: lr_query TYPE REF TO if_bol_bo_property_access.
    lr_gdc = cl_crm_ui_data_context_srv=>get_instance( me ).
    lr_entity = lr_gdc->get_entity( name = if_iccmp_global_data_cont_con=>gdc_currentcustomer ).
    IF lr_entity IS NOT BOUND.
    RETURN.
    ENDIF.
    lv_bp_number = lr_entity->get_property_as_string( iv_attr_name = ‘BP_NUMBER’ )."#EC NOTEXT
    也可以用这个方法
    lr_gdc->get_data_attribute( EXPORTING
    iv_name = if_crm_ic_fw_global_data_cont=>mv_display_company
    IMPORTING
    e_value = lv_caller_display_company ).
    给全局对象中写入值
    lv_bdc = cl_crm_ui_data_context_srv=>get_instance( me ).

lr_clipboard = cl_crm_ui_bol_clipboard_srv=>get_instance( ).
bp_entity = typed_context->customers->collection_wrapper->get_current( ).
lv_bdc->set_entity( name = cl_crm_ic_bp_constants=>gc_gdc_currentcustomer
value = bp_entity ).

  1. cl_crm_ui_bol_clipboard_srv Clipboard service class 剪贴板服务类 ;

1,读取节点信息
方法一:
data:
lv_index type int4,
lr_entity type ref to cl_crm_bol_entity。
call method cl_thtmlb_util=>get_event_info
exporting
iv_event = htmlb_event_ex
importing
ev_index = lv_index.

check lv_index is not initial.

  • Get the current entity
    lr_entity ?= me->typed_context->ztcrm_qual_items->collection_wrapper->find( iv_index = lv_index ).

方法二:
data: lv_event type string,
lv_index type string,
lv_row_index type i,
lr_col type ref to cl_crm_bol_entity,
split htmlb_event_ex->event_defined at ‘.’ into lv_event lv_index.

  • convert row index
    lv_row_index = lv_index.
  • set row index on collection
    me->typed_context->paymentcards->get_bo_by_index( lv_row_index ).
    lr_col ?= me->typed_context->paymentcards->collection_wrapper->get_current( ).

方法三:
data lr_entry type ref to if_bol_bo_property_access.
lr_entry = collection_wrapper->get_iterator( )->get_by_index( iv_index ).

方法四:
获取当前节点:lr_entry = collection_wrapper->if_bol_bo_col~get_current( ).

2,获取当前的组件控制器
data: lr_component type ref to zl_bt126s_a_bspwdcompone0_impl.
lr_component ?= me->comp_controller.
自定义组件
data lr_cuco type ref to zl_zrp_sale_zrpcustcomp01_impl .
lr_cuco ?= me->get_custom_controller( ‘ZRP_SALESORDER/ZRPCUSTCOMP01’ ).
lr_cuco->typed_context->result->set_collection( collection = lr_result ).

视图所在的组件
DATA lr_controller TYPE REF TO zl_bt111h_o_bspwdcomponen_impl .
lr_controller ?= me->comp_controller.

获取视图所在的窗口
data: lr_window type ref to cl_bsp_wd_window.
lr_window = me->view_manager->get_window_controller( ).
lr_window->call_outbound_plug( ‘TOOA’ ).

3,获取客户控制器
data: lr_component type ref to zl_bt126s_a_bspwdcompone0_impl.
lr_component ?= me->comp_controller.

4,列表节点中的OCA按钮设置:节点类(如 ZL_GS_CM_DOCLIST_CN01) 的GET_OCA_T_TABLE 方法

5,获取选中的一行
lr_result ?= me->typed_context->test->collection_wrapper->get_marked( ).

6,将节点设置为文本区域,并设置行数
METHOD get_p_zzfld00008z.

CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_textarea.

WHEN if_bsp_wd_model_setter_getter=>fp_textarea_rows.
  rv_value = 20.


WHEN if_bsp_wd_model_setter_getter=>fp_tooltip.
  rv_value = ''.

ENDCASE.

ENDMETHOD.

7,添加消息
DATA lr_bol_core TYPE REF TO cl_crm_bol_core.
DATA lr_message_container_manager TYPE REF TO cl_crm_genil_mess_cont_manager.
DATA lr_message_container TYPE REF TO cl_crm_genil_global_mess_cont.

  • get BOL core
    lr_bol_core = cl_crm_bol_core=>get_instance( ).

  • get current message container manager
    lr_message_container_manager = lr_bol_core->get_message_cont_manager( ).

  • get message container
    lr_message_container = lr_message_container_manager->get_global_message_cont( ).

*********打印开发类(se91)中的消息
CALL METHOD lr_message_container->add_message
EXPORTING
iv_msg_type = ‘E’
iv_msg_id = ‘ZCRM’
iv_msg_number = ‘003’
iv_show_only_once = abap_true.

8,报消息
data lr_msg_srv type ref to cl_bsp_wd_message_service.

lr_msg_srv = me->view_manager->get_message_service( ).
if 1 = 2.
message s282(zmn_crm) with ls_btadminh-object_id ls_status-txt30.
endif.
lv_msg_v1 = ls_btadminh-object_id.
lv_msg_v2 = ls_status-txt30.
lr_msg_srv->add_message( iv_msg_type = ‘E’
iv_msg_id = ‘ZMN_CRM’
iv_msg_number = ‘282’
iv_msg_v1 = lv_msg_v1
iv_msg_v2 = lv_msg_v2 ).

9,下拉框实现
METHOD get_p_xrf.

CASE iv_property. "直接绑定类型picklist
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_picklist.
ENDCASE.

ENDMETHOD.

在本节点下的实现类中定义
GR_DDLB_XRF Instance Attribute Private Type Ref To CL_CRM_UIU_DDLB

method GET_V_XRF.

DATA:    lt_ddlb           TYPE bsp_wd_dropdown_table,
       ls_ddlb           TYPE bsp_wd_dropdown_line.

DATA: lt_domain_entries TYPE STANDARD TABLE OF dd07v,
ls_domain_entries TYPE dd07v.

IF gr_ddlb_xrf IS NOT BOUND. "定义引用本节下的attribute
CREATE OBJECT gr_ddlb_xrf
EXPORTING
iv_source_type = ‘T’.

CALL FUNCTION 'DD_DOMVALUES_GET'
  EXPORTING
    domname   = 'XFELD' "域的绑定
    langu     = sy-langu
    text      = 'X'
  TABLES
    dd07v_tab = lt_domain_entries.
IF sy-subrc <> 0.


ENDIF.
LOOP AT lt_domain_entries INTO ls_domain_entries.
  •  CHECK ls_domain_entries-domvalue_l = 'Z001' OR ls_domain_entries-domvalue_l = 'Z002'.
    ls_ddlb-key   = ls_domain_entries-domvalue_l.
    ls_ddlb-value = ls_domain_entries-ddtext.
    APPEND ls_ddlb TO lt_ddlb.
    

    ENDLOOP.

    INSERT INITIAL LINE INTO lt_ddlb INDEX 1.

    gr_ddlb_xrf->set_selection_table( it_selection_table = lt_ddlb ).

    ENDIF.

    rv_valuehelp_descriptor = gr_ddlb_xrf.

endmethod.

10,内表转换成 collection
IT_TABLE TYPE TABLE
value( RR_COLLECTION ) TYPE REF TO IF_BOL_BO_COL

method get_collection.
data: lr_data type ref to data,
lr_node type ref to cl_bsp_wd_value_node.

field-symbols: type any,
type any.

create object rr_collection type cl_crm_bol_bo_col.

loop at it_table assigning .
create data lr_data like line of it_table.
assign lr_data->* to .

= .


create object lr_node
  exporting
    iv_data_ref = lr_data.


rr_collection->add( lr_node ).

endloop.
endmethod.

11,collection转换成内表
IR_COLLECTION TYPE REF TO IF_BOL_BO_COL
value( ET_TABLE ) TYPE TABLE

method get_table.
data:
lr_iterator type ref to if_bol_bo_col_iterator,
lr_entry type ref to if_bol_bo_property_access,
lr_data type ref to data.

field-symbols: type any.

check ir_collection is bound.

lr_iterator = ir_collection->get_iterator( ).

check lr_iterator is bound.

create data lr_data like line of et_table.
assign lr_data->* to .

lr_entry = lr_iterator->get_first( ).
while lr_entry is bound.
lr_entry->get_properties( importing es_attributes = ).
append to et_table.
lr_entry = lr_iterator->get_next( ).
endwhile.
endmethod.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值