cancel
Showing results for 
Search instead for 
Did you mean: 

Show the standard error and show the Input field in red

Former Member
0 Kudos

My web dynpro has a input field. This input field is mapped with a context attribute which type is I.

I want that this field doesn't show the default value 0.

If I change the attribute context to String I lose the standard message "The Entered Value Can Only Contain Numerical Characters" and the input field is not in red with this error.

1.- If I use a context attribute type I, How can I show an empty default value ?

2.- If I use a context attribute type string, How can I use the standard error "The Entered Value Can Only Contain Numerical Characters" and show the Input field in red?

How do I solve this?

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi to all,

My problem continues. I have created a new Web Dynpro to test the code.

My Web Dynpro contains only one node (NODO_INPUTF) with one attribute (INPUT_FIELD). I only have coded the method (WDDOMODIFIVIEW) with this code:

DATA: node_input_field TYPE REF TO if_wd_context_node,

node_info TYPE REF TO if_wd_context_node_info,

ls_properties TYPE wdy_attribute_format_prop.

IF first_time EQ abap_true.

node_input_field = wd_context->get_child_node( name = wd_this->wdctx_nodo_inputf ).

node_info = node_input_field->get_node_info( ).

ls_properties-null_as_blank = '-'.

node_info->set_attribute_format_props( EXPORTING name = 'INPUT_FIELD'

format_properties = ls_properties ).

ENDIF.

ENDMETHOD.

In the input field appears the value 0.

Can anybody help me?

Former Member
0 Kudos

Hi Anja.

I guess this does not work because 0 is a valid integer value. When you initialize an integer it is set to 0.

null_as_blank only works with types like ebeln etc.

Cheers,

Saascha

Former Member
0 Kudos

Ok, Saascha.

Thanks a lot.

Former Member
0 Kudos

My problem has not been solved yet.

I have used attribute type I.

My code is:

DATA: node TYPE REF TO if_wd_context_node.

DATA: node_info TYPE REF TO if_wd_context_node_info,

ls_properties TYPE wdy_attribute_format_prop.

IF first_time EQ abap_true.

node = wd_context->get_child_node( name = 'MY_NODE' ).

ls_properties-null_as_blank = '-'.

node_info = node_jubilacion->get_node_info( ).

node_info->set_attribute_format_props( EXPORTING name = 'TLFNO'

format_properties = ls_properties ).

endif.

In the input field of 'TLFNO' appears the value 0.

Former Member
0 Kudos

Hi Anja.

you have to use ls_att_format-null_as_blank = 'X'.

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

Former Member
0 Kudos

I think the problem must be resolved but my problem continues.

Former Member
0 Kudos

hi,

you can do this by implementing in your wdmodifyview

data: node_info type ref to if_dw_context_node_into,

ls_properties type wdy_attribute_format_prop.

if first_time eq abap_true.

***navigate to your node

ls_properties-null_as_blank = '-'.

node_info = node->get_node_info( ).

node_info->set_attribute_format_props( exporting name = name of the attribute

format_properties = ls_properties ).

endif.

this way you can keep the i and the messaging

grtz,

Koen

Message was edited by:

Koen Labie