cancel
Showing results for 
Search instead for 
Did you mean: 

Removing Default Zeros

Former Member
0 Kudos

Hi,

the UI-Element Table which I have created has in some fields default Zeros.

UI-Element Table is editable.

The current Contextname is ZHEAD. And there are 3 columns

affected e.g. MKG etc.

How can I remove those zeros.

Best regards

ertas ilhan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

dear experts,

I am getting the message:

element_context is unknown

Regards

ertas

arjun_thakur
Active Contributor
0 Kudos

Hi,

Just read the attribute with the help of code wizard and the use set_attribute_null methos instead of get_attribute method.

Regards

Arjun

Former Member
0 Kudos

There are four various context nodes in my case. How can I refer to a determined

node with your example.

The attribute is inside of the third node within context. How can relate exactly to this

deignated attribute.

Former Member
0 Kudos

Select the node in which you have the attribute for which you do not want default value as Zero.

Data: l_node type ref to if_wd_context_node.

l_node = wd_context->get_child_node( 'NODENAME' ). " Node in which you have the attribute which has to be made blank.

l_node->set_attribute_null( exporting name = 'Atrtibute Name' ).

Regards,

Radhika.

arjun_thakur
Active Contributor
0 Kudos

Hi,

Just press Ctrl + F7 and select the read node option. Select the name of attribute. Then press enter. In the code, get_attribute method will be there, remove that method and use set_attribute_null method by passing the attribute name.

Regards

Arjun

Answers (5)

Answers (5)

Former Member
0 Kudos

dear friends thank you very much for your helps.

Former Member
0 Kudos

hi,

->In your table , there must be some columns which are coming as zeros in the output.

->Note the context which is binded to that column.

Use Set_Attribute_null of if_wd_Context_node to set zeros to null.

Thanx.

Former Member
0 Kudos

Hi,

In the latest versions, you can find the formatting options for the context attribute where

you can display the zeroes as Blanks. Select this option for the context attributes. If still it is not set

then use the above ways as suggested by others.

Go to context attribute propertoes->

FORMATTING->

DISPLAY LEADING ZEROES choose option Zeros as Blanks.

Regards,

Lekha.

Former Member
0 Kudos

Zero appears because the data type that you are using has the default value Zero.

Check if you can change the data type to String, as the default value for string is space else use

set_attribute_null method.

Regards,

Radhika.

arjun_thakur
Active Contributor
0 Kudos

Hi,

You can use set_attribute_null( ) method to clear the input field.

Refer the code below:


DATA lo_el_context TYPE REF TO if_wd_context_element.
  DATA ls_context TYPE wd_this->element_context.
 
* get element via lead selection
  lo_el_context = wd_context->get_element( ).
 
** get single attribute
  lo_el_context->set_attribute_null(
    EXPORTING
      name =  `ABC` "ABC is the name of attribute that is binded to the input field.
 ).

You can use this code in wddoinit method to clear the input field in the table.

Or you can set the Display Leading Zero property of the attribute that is binded to the input field as Zeros as Blank.

I hope it helps.

Regards

Arjun

Edited by: Arjun Thakur on Apr 28, 2009 1:13 PM