Sample code for DO_CONFIG_DETERMINATION method
This example is to set the visibility of a screen field based on another field ...
METHOD do_config_determination.
DATA: lr_btadminh TYPE REF TO if_bol_bo_property_access,
lr_entity TYPE REF TO cl_crm_bol_entity,
lv_process_type TYPE string,
lv_rejection TYPE string.
TRY .
lr_btadminh ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
lr_entity ?= lr_btadminh.
TRY.
lv_process_type = lr_entity->get_property_as_string( iv_attr_name = 'Attribute name ' ).
lv_rejection = lr_entity->get_property_as_string( iv_attr_name = 'Attribute name ' ).
CATCH cx_crm_cic_parameter_error.
ENDTRY.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
ENDTRY.
* IF lv_rejection IS NOT INITIAL AND gv_get_rsnddlb = abap_true.
IF gv_get_rsnddlb = abap_true.
* Get the layout to show Rejection Reason DDLB
me->configuration_descr->set_role_key( iv_role_key = '<DEFAULT>' ).
CALL METHOD me->set_config_keys
EXPORTING
iv_object_type = ' Your obj type'
iv_object_sub_type = 'Your obj subtype'
iv_propagate_2_children = 'X'.
else.
* Status is not 'Rejected & Mailed back, so
* Get the normal layout without DDLB
me->configuration_descr->set_role_key( iv_role_key = ' Role key' ).
CALL METHOD me->set_config_keys
EXPORTING
iv_object_type = '<DEFAULT>'
iv_object_sub_type = '<DEFAULT>'
iv_propagate_2_children = 'X'.
ENDIF.
ENDMETHOD.
METHOD do_config_determination.
DATA: lr_btadminh TYPE REF TO if_bol_bo_property_access,
lr_entity TYPE REF TO cl_crm_bol_entity,
lv_process_type TYPE string,
lv_rejection TYPE string.
TRY .
lr_btadminh ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
lr_entity ?= lr_btadminh.
TRY.
lv_process_type = lr_entity->get_property_as_string( iv_attr_name = 'Attribute name ' ).
lv_rejection = lr_entity->get_property_as_string( iv_attr_name = 'Attribute name ' ).
CATCH cx_crm_cic_parameter_error.
ENDTRY.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
ENDTRY.
* IF lv_rejection IS NOT INITIAL AND gv_get_rsnddlb = abap_true.
IF gv_get_rsnddlb = abap_true.
* Get the layout to show Rejection Reason DDLB
me->configuration_descr->set_role_key( iv_role_key = '<DEFAULT>' ).
CALL METHOD me->set_config_keys
EXPORTING
iv_object_type = ' Your obj type'
iv_object_sub_type = 'Your obj subtype'
iv_propagate_2_children = 'X'.
else.
* Status is not 'Rejected & Mailed back, so
* Get the normal layout without DDLB
me->configuration_descr->set_role_key( iv_role_key = ' Role key' ).
CALL METHOD me->set_config_keys
EXPORTING
iv_object_type = '<DEFAULT>'
iv_object_sub_type = '<DEFAULT>'
iv_propagate_2_children = 'X'.
ENDIF.
ENDMETHOD.
Post a Comment