Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6329
  • 博文数量: 7
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 80
  • 用 户 组: 普通用户
  • 注册时间: 2011-12-21 19:15
文章分类

全部博文(7)

文章存档

2017年(7)

我的朋友

分类: 其他平台

2017-05-10 08:30:29

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.
阅读(468) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~