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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 自定義SAP功能表
- 擴充套件WCF自定義行為(二)套件
- SAP自定義許可權物件物件
- Laravel 5.5 以下版本中自定義日誌行為Laravel
- SAP 電商雲 Spartacus UI 的自定義 hamburger 選單UI
- 自定義 SAP 採購訂單螢幕
- 使用 SAP CRM Application Enhancement Tool(AET) 建立擴充套件欄位APP套件
- 我自定義的攔截器為什麼會靠後執行?
- 為自定義的View新增長按事件View事件
- SAP CRM AET Application Reference型別擴充套件欄位的一個例子APP型別套件
- THINKPHP 3.23beta版本 自定義行為有問題。PHP
- 如何實現SAP GUI的自定義語法檢查(Syntax check)GUI
- 為WinEdt自定義XeLatex快捷鍵
- 為bootstrap新增更多自定義圖示boot
- 為Autodesk Viewer新增自定義工具條View
- 如何給 SAP Fiori Elements 應用新增自定義按鈕
- Calendar -『為移動端而生』的自定義日曆
- 為Autodesk Viewer新增自定義工具條的更好方法View
- 各種 SAP 產品的自定義 UI 建立和整合方法一覽UI
- 如何啟用SAP C4C自定義BO的Text Collection功能
- 自定義View:自定義屬性(自定義按鈕實現)View
- FIELDS TERMINATED BY WHITESPACE & FIELDS TERMINATED BY x'09'
- 自定義的PopupWindow
- SAP UI5 Web Component裡如何自定義CSS styleUIWebCSS
- 如何將自定義XML檢視注入SAP Fiori Elements應用XML
- SAP UI5 應用如何載入自定義 ThemeUI
- nginx自定義負載均衡及根據cpu執行自定義負載均衡Nginx負載
- Java之自定義執行緒的2種方式Java執行緒
- 自定義msi安裝包的執行過程
- SAP不同的產品是如何支援使用者建立自定義欄位的
- 為什麼不建議使用自定義Object作為HashMap的key?ObjectHashMap
- SAP UI5 OData 請求的自定義 HTTP header 設定方法UIHTTPHeader
- 如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來型別
- SAP CRM OData模型裡的addressable為true的含義模型
- MySQL自定義變數執行順序MySql變數
- 如何在 SAP Spartacus 產品明細頁面新增自定義 UIUI
- TextView 自動換行,每行排滿的自定義TextViewTextView
- 自定義xunit測試用例的執行順序