I have a requirement to maintain a default value in a standard webdynpro screen. this is SRM 7.0 system, while creating shopping carts with service lines, we want the default value of the Unit to be 'EA'.
I have written this piece of code to achieve the same:
DATA: context_node TYPE REF TO if_wd_context_node,
lr_element TYPE REF TO if_wd_context_element,
lv_text TYPE char2.
context_node = wd_context->get_child_node( name = 'GENERAL_DATA' ).
*
lr_element = context_node->get_element( ).
context_node->get_attribute( EXPORTING name = 'UNIT'
IMPORTING value = lv_text ).
IF lv_text = space.
lv_text = 'EA'.
* Set single attribute
lr_element->set_attribute(
name = `UNIT`
value = 'EA ' ).
ENDIF.
As you can see, the field in which the default value of 'EA' is needed in the UNIT field.
The code is not throwing any error - but at the same time its not showing the default value also.
Can you please advice.