一.环境及前提
SAP系统版本:SAP NetWeaver 750;
2.1 假设已有Web Dynpro UI如下
2.2 定义CSS
*Define CSS
DATA(lo_custom_style_manager) = wd_this->wd_get_api( )->get_application( )->get_custom_style_manager( ).
DATA lo_btn_style_properties TYPE if_wd_custom_style=>t_style_properties.
lo_btn_style_properties = VALUE #(
( name = 'fontSize' value = '30px' )
( name = 'fontWeight' value = 'bold' )
( name = 'fontColor' value = 'RED' )
).
DATA(lo_btn_custom_style) = lo_custom_style_manager->create_custom_style(
style_class_name = 'myCustomButton'
library_name = 'STANDARD'
element_type = 'BUTTON'
style_properties = lo_btn_style_properties ).
lo_custom_style_manager->add_custom_style( lo_btn_custom_style ).
DATA lo_inputfield_style_properties TYPE if_wd_custom_style=>t_style_properties.
lo_inputfield_style_properties = VALUE #(
( name = 'height' value = '64px' )
( name = 'fontColor' value = 'GREEN' )
).
DATA(lo_inputfield_custom_style) = lo_custom_style_manager->create_custom_style(
style_class_name = 'myCustomInputfield'
library_name = 'STANDARD'
element_type = 'INPUT_FIELD'
style_properties = lo_inputfield_style_properties ).
lo_custom_style_manager->add_custom_style( lo_inputfield_custom_style ).
2.3 分别对于UI控件Inputfield和Button指定CSS
Button
Inputfield
2.4 使用CCS以后的效果
除此之外,需要对Web Dynpro应用创建应用配置,针对应用配置关闭Personas。 单独运行Web
Dynpro应用,CSS不会生效。
加载中,请稍候......