6 Replies Latest reply: Feb 13, 2012 5:28 PM by Michael Neumann RSS

Hidding Field Dynamically

Darwin P
Currently Being Moderated

Hi Gurus,

 

                   I am working on EHP1 server. Requirement Given to me, is to hide Empty fields in Display mode. I have achieved it by writing code in  Get_A method of that particular attribute as,

data : lr_entity type REF TO cl_crm_bol_entity,
       lr_desc type string.
lr_entity ?= me->collection_wrapper->get_current( ).
IF LR_ENTITY IS BOUND.
lr_desc = lr_entity->get_property_as_string( iv_attr_name = 'DESCRIPTION' ).
ENDIF.

IF ZL_BT108H_L_DETAIL_IMPL=>GV_DISPLAY EQ ABAP_TRUE AND LR_DESC IS INITIAL.
  rs_sfw_data-switch_id = cl_crm_sfw_ehp1_switch_check=>co_crm_sls_srv_1.
  rs_sfw_data-reaction = cl_webcuif_switch=>co_reaction_display.
ENDIF.

                                          Get_A  method is being triggered only once when the view is displayed and If I click on edit, Get_A method is not being triggered and that particular attribute field is being hidden even in the editable mode. I am not getting how to solve this.

If anyone has ever used get_a method, please share your experience how did you use get_a method

  • Re: Hidding Field Dynamically
    Leon Limson
    Currently Being Moderated

    Hi Darwin,

     

    What is your exact requirement? Why do you want to hide the fields when empty?

     

    Regards,

    Leon

  • Re: Hidding Field Dynamically
    siva krishna
    Currently Being Moderated

    Hi Dravin ,

     

     

    Do_prepare_output will be triggerd at every time , so why don't you write your code in Do_prepare_output method.

     

     

    Regards

    Siva

    • Re: Hidding Field Dynamically
      Darwin P
      Currently Being Moderated

      Hi siva,

      Thanks for your response. If I need to hide one field, then I can do it in do_prepare_output. But I need to  test whether the field is empty or not for all the attributes present in lead details page and then hide them. So If I write code in Do_prepare_output for all the fields, It leads to complexity in code. So let me know if any other way to achieve it.

       

      Regards,

      Darwin.

  • Re: Hidding Field Dynamically
    Michael Neumann
    Currently Being Moderated

    Hi,

    would propose, that you use different view configurations for display and edit mode and set the configurations dynamically.

    Best Regards,

    Michael

    • Re: Hidding Field Dynamically
      Darwin P
      Currently Being Moderated

      Hello All,

      Thanks For Giving Your Valuable Suggestions.

      I did Coding in Detail.htm

        lr_entity type ref to if_bol_bo_property_access,
        lr_display = controller->view_group_context->is_view_in_display_mode( controller ).
        lv_xml = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).
        lr_entity ?= btadminh->collection_wrapper->get_current( ).
        IF lr_display eq 'X'.
        if lr_entity is bound.
        lr_entity->get_properties( IMPORTING ES_ATTRIBUTES = wa_admin ) .
        IF wa_admin-description is INITIAL and lr_display = 'X'.
        replace all occurrences of '//BTADMINH/STRUCT.DESCRIPTION' in lv_xml with ' '.
        ENDIF.
        ENDIF.
        

       

      Regards,

      Darwin