Hi Puneet,
If you need to display/Hide a view dynamically, You should use 'DO_CONFIG_DETERMINATION' method as rightly suggested by Jorge.
Create Two configuration with two different Object type( LV_OT1 and LV_OT2)
You can fetch the object type value programmatically and use them as condition statement to display the desired configuration.
If Condition 'A'
me->set_config_keys( iv_object_type = lv_OT1 iv_propagate_2_children = abap_true ).
else.
me->set_config_keys( iv_object_type = lv_OT2 iv_propagate_2_children = abap_true ).
endif.
Regards,
Atul