Header Ads

Setting a default value on web UI


For a component named ICCMP_BTSHEAD , Need  to set a default value on UI for "Description"  , lets say 'Default ' .
So for that , We have created an enhancement set , enhanced the concerned view(BTSHeader) to get a Z 
'view  controller' class  . We identified the context node as btadminh .


First ->  

Then we redefined the  method  do_prepare_output in concerned z class  and wrote code as given below :

Data lr_entity type ref to  cl_crm_bol_entity .
CALL METHOD SUPER->DO_PREPARE_OUTPUT
  EXPORTING
    iv_first_time = ABAP_false    .
    lr_entity ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
     lr_entity->set_property( iv_attr_name = 'DESCRIPTION' iv_value = 'Default' ).

Second -> 

Redefine the method get_description inside the context node btadminh, assinging the value 'default'.
Code example 
    IF <nval> <> <oval>.
       current->set_property(
                      iv_attr_name = 'xxxx' "#EC NOTEXT
                      iv_value     = <nval> ).
    elseif <nval> is initial or <oval> is initial.
     current->set_property(
                      iv_attr_name = 'xxxx' "#EC NOTEXT
                      iv_value     = 'Default'  ).
 and in Get Description Method:
 IF dref IS NOT BOUND.
       value = 'BTOpportH/ZZPLANT not bound'."#EC NOTEXT
      value = 'Default'.
      RETURN.
   ENDIF.
 IF dref IS NOT BOUND.

      value = 'BTOpportH/ZZPLANT not bound'."#EC NOTEXT
      value = 'ARUP'.
       RETURN.
    ENDIF.


Powered by Blogger.