SAP AET fields的自定義行為
If the customer specific logic is too complex to be covered by the embedded formula in calculated field editor in AET, for example there are some ABAP coding involved, we can try custom behavior logic provided by AET:
(1) Create a new entry in table AXT_BEHAVIOR
(2) Your custom behavior could be implemented in class ZCL_AXT_CUSTOM_BEHAVIOR, which inherites from class CL_AXT_ABST_BEHAVIOR_HDLR.
Source code for ZCL_AXT_CUSTOM_BEHAVIOR:
class ZCL_AXT_CUSTOM_BEHAVIOR definition
public
inheriting from CL_AXT_ABST_BEHAVIOR_HDLR
final
create public
shared memory enabled .
public section.
methods IF_AXT_BEHAVIOR_HANDLER~GET_BEHAVIOR_TYPE
redefinition .
methods IF_AXT_BEHAVIOR_HANDLER~GET_COMPATIBLE_DATATYPES
redefinition .
methods IF_AXT_BEHAVIOR_HANDLER~IS_SUPPORTED
redefinition .
methods IF_AXT_DATATYPE_HANDLER~ADJUST_GET_P
redefinition .
methods IF_AXT_DATATYPE_HANDLER~ADJUST_SET
redefinition .
protected section.
PRIVATE SECTION.
*"* private components of class ZCL_AXT_CUSTOM_BEHAVIOR
*"* do not include other source files here!!!
ENDCLASS.
CLASS ZCL_AXT_CUSTOM_BEHAVIOR IMPLEMENTATION.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_AXT_CUSTOM_BEHAVIOR->IF_AXT_BEHAVIOR_HANDLER~GET_BEHAVIOR_TYPE
* +-------------------------------------------------------------------------------------------------+
* | [<-()] RV_BEHAVIOR_TYPE TYPE AXT_FIELD_BEHAVIOR_TYPE
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD IF_AXT_BEHAVIOR_HANDLER~GET_BEHAVIOR_TYPE.
rv_behavior_type = 'ZAXT_BEHAVIOR'.
ENDMETHOD. "IF_AXT_BEHAVIOR_HANDLER~GET_BEHAVIOR_TYPE
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_AXT_CUSTOM_BEHAVIOR->IF_AXT_BEHAVIOR_HANDLER~GET_COMPATIBLE_DATATYPES
* +-------------------------------------------------------------------------------------------------+
* | [<-()] RT_DATATYPES TYPE AXTT_FIELD_DATA_TYPE
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD IF_AXT_BEHAVIOR_HANDLER~GET_COMPATIBLE_DATATYPES.
APPEND 'CHAR' TO rt_datatypes.
APPEND 'STRING' TO rt_datatypes.
ENDMETHOD. "IF_AXT_BEHAVIOR_HANDLER~GET_COMPATIBLE_DATATYPES
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_AXT_CUSTOM_BEHAVIOR->IF_AXT_BEHAVIOR_HANDLER~IS_SUPPORTED
* +-------------------------------------------------------------------------------------------------+
* | [--->] IT_BO_PART TYPE AXTT_EXT_BO_PART(optional)
* | [--->] IT_SUPPORTED_UI_FRAMEWORKS TYPE AXTT_UI_FRAMEWORK(optional)
* | [--->] IV_EXTENSION_TYPE TYPE AXT_EXTENSION_TYPE
* | [--->] IV_BOL_REGISTERED TYPE AXT_BOOLEAN (default =ABAP_TRUE)
* | [--->] IV_RENDERING_TABLE_ONLY TYPE AXT_BOOLEAN (default =ABAP_FALSE)
* | [--->] IV_RENDERING_TABLE_POSSIBLE TYPE AXT_BOOLEAN (default =ABAP_TRUE)
* | [--->] IV_TRANSIENT_CALCULATE_SET TYPE AXT_BOOLEAN (default =ABAP_FALSE)
* | [--->] IV_MANUAL_DATA_ELEMENT_SET TYPE AXT_BOOLEAN (default =ABAP_FALSE)
* | [<-()] RV_SUPPORTED TYPE AXT_BOOLEAN
* +--------------------------------------------------------------------------------------</SIGNATURE>
method IF_AXT_BEHAVIOR_HANDLER~IS_SUPPORTED.
RV_SUPPORTED = abap_true.
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_AXT_CUSTOM_BEHAVIOR->IF_AXT_DATATYPE_HANDLER~ADJUST_GET_P
* +-------------------------------------------------------------------------------------------------+
* | [--->] IS_FIELD TYPE AXTS_RUNTIME_EXT_FIELD
* | [--->] IV_COMPONENT TYPE STRING
* | [--->] IO_CURRENT TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS(optional)
* | [--->] IV_PROPERTY TYPE STRING
* | [--->] IV_DISPLAY_MODE TYPE ABAP_BOOL
* | [--->] IV_ORIGINAL_VALUE TYPE STRING
* | [--->] IV_IS_TABLE TYPE ABAP_BOOL (default =ABAP_FALSE)
* | [--->] IV_IS_SEARCH TYPE ABAP_BOOL (default =ABAP_FALSE)
* | [<-()] RV_VALUE TYPE STRING
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD IF_AXT_DATATYPE_HANDLER~ADJUST_GET_P.
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
IF iv_is_table = abap_true OR iv_is_search = abap_true.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_input.
ELSE.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_textarea.
ENDIF.
WHEN if_bsp_wd_model_setter_getter=>fp_textarea_rows.
rv_value = 10.
WHEN OTHERS.
rv_value = super->if_axt_datatype_handler~adjust_get_p(
is_field = is_field
iv_component = iv_component
io_current = io_current
iv_property = iv_property
iv_display_mode = iv_display_mode
iv_original_value = iv_original_value ).
ENDCASE.
ENDMETHOD. "IF_AXT_DATATYPE_HANDLER~ADJUST_GET_P
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_AXT_CUSTOM_BEHAVIOR->IF_AXT_DATATYPE_HANDLER~ADJUST_SET
* +-------------------------------------------------------------------------------------------------+
* | [--->] IS_FIELD TYPE AXTS_RUNTIME_EXT_FIELD
* | [--->] IV_ATTRIBUTE_PATH TYPE STRING
* | [--->] IV_COMPONENT TYPE STRING
* | [--->] IO_CURRENT TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS
* | [--->] IV_UI_VALUE TYPE STRING
* | [--->] IT_FORM_FIELDS TYPE TIHTTPNVP(optional)
* | [<-->] CV_VALUE TYPE ANY
* +--------------------------------------------------------------------------------------</SIGNATURE>
method IF_AXT_DATATYPE_HANDLER~ADJUST_SET.
DATA: tsl TYPE timestampl,
lv_zone type TZONREF-TZONE value 'UTC',
lv_time TYPE string.
GET TIME STAMP FIELD tsl.
lv_time = | Edited by: { tsl TIMESTAMP = ISO
TIMEZONE = lv_zone }|.
CONCATENATE cv_value lv_time INTO cv_value SEPARATED BY cl_abap_char_utilities=>cr_lf.
endmethod.
ENDCLASS.
When you create extension field, choose "Not defined" as Field type, and choose the entry maintained in step1 as "Render/Validate As":
Click Enable Expert Mode and assign one data element to this extension field:
Generate the extension field and make it visible in WebUI. After I maintain some value for this field and click save:
the ADJUST_SET method of handler class is called and the timestamp is appended:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2673898/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Laravel 5.5 以下版本中自定義日誌行為Laravel
- 自定義 SAP 採購訂單螢幕
- 使用 SAP CRM Application Enhancement Tool(AET) 建立擴充套件欄位APP套件
- SAP 電商雲 Spartacus UI 的自定義 hamburger 選單UI
- SAP CRM AET Application Reference型別擴充套件欄位的一個例子APP型別套件
- THINKPHP 3.23beta版本 自定義行為有問題。PHP
- 我自定義的攔截器為什麼會靠後執行?
- 如何實現SAP GUI的自定義語法檢查(Syntax check)GUI
- SAP UI5 Web Component裡如何自定義CSS styleUIWebCSS
- SAP UI5 應用如何載入自定義 ThemeUI
- 如何給 SAP Fiori Elements 應用新增自定義按鈕
- 如何啟用SAP C4C自定義BO的Text Collection功能
- SAP UI5 OData 請求的自定義 HTTP header 設定方法UIHTTPHeader
- 各種 SAP 產品的自定義 UI 建立和整合方法一覽UI
- SAP CRM OData模型裡的addressable為true的含義模型
- 自定義的PopupWindow
- nginx自定義負載均衡及根據cpu執行自定義負載均衡Nginx負載
- Java之自定義執行緒的2種方式Java執行緒
- 如何在SAP Cloud for Customer自定義BO中建立訪問控制Cloud
- 如何將自定義XML檢視注入SAP Fiori Elements應用XML
- SAP不同的產品是如何支援使用者建立自定義欄位的
- SAP Commerce Cloud ( 電商雲 ) 路由路徑的自定義配置與開發Cloud路由
- AntD框架的upload元件上傳圖片時使用customRequest方法自定義上傳行為框架元件
- 為什麼不建議使用自定義Object作為HashMap的key?ObjectHashMap
- python實現自定義執行緒池Python執行緒
- 自定義xunit測試用例的執行順序
- TextView 自動換行,每行排滿的自定義TextViewTextView
- 如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來型別
- 高度自定義的STDPickerViewView
- 如何在 SAP Spartacus 產品明細頁面新增自定義 UIUI
- 如何自行給指定的SAP OData服務新增自定義日誌記錄功能
- 如何讓SAP C4C自定義BO實現附件上傳的功能
- 如何給SAP Cloud for Customer UI上的欄位新增自定義校驗邏輯CloudUI
- 使用自定義 HTTP Interceptor 記錄 SAP Spartacus 傳送的 OCC API 以及響應HTTPAPI
- android自定義view(自定義數字鍵盤)AndroidView
- netty自定義Decoder用於自定義協議Netty協議
- 自定義註解進行資料脫敏
- 【連載 05】自定義執行緒池(上)執行緒