on 2023 Sep 07 5:57 AM
Hi Experts,
I created a Z*enh for BP_ADDR using BSP_WD_CMPWB.
This is to default country & region value fields with 'US' during new BP creation in CRM Web UI for the first time.
I enhanced the STDAddress view.
I see a Z* Impl class & Context node classes also created.
I think i need to use Getter & Setter methods for STRUCT.COUNTRY & STRUCT.CITY to default the values.
Can any one suggest me how to do it?
Request clarification before answering.
Ok., I got this completed by generating the Setter & getter method page attributes and setting the returning value = 'X'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok., I got this completed by generating the Setter & getter method page attributes and setting the returning value = 'X'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ricky,
This is not the best way to achieve your requirement.
You should rather use the Badi CRM_BP_UIU_DEFAULTS and implement method GET_DEFAULT_VALUES as follows:
METHOD if_uiu_bp_defaults~get_default_values.
DATA:
lr_current TYPE REF TO if_bol_bo_property_access,
lr_typed_context TYPE REF TO cl_bsp_wd_context,
lr_node TYPE REF TO cl_bsp_wd_context_node,
lr_coll_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper.
FIELD-SYMBOLS:
<ls_typed_context> TYPE any,
<ls_context_node> TYPE any.
ASSIGN cr_me->('TYPED_CONTEXT') TO <ls_typed_context>.
IF sy-subrc = 0.
lr_typed_context ?= <ls_typed_context>.
IF lr_typed_context IS BOUND.
ASSIGN lr_typed_context->('STANDARDADDRESS') TO <ls_context_node>.
IF sy-subrc = 0.
TRY.
lr_node ?= <ls_context_node>.
CATCH cx_sy_move_cast_error. "EC_NOHANDLER
ENDTRY.
IF lr_node IS BOUND.
lr_coll_wrapper ?= lr_node->collection_wrapper.
IF lr_coll_wrapper IS BOUND.
TRY.
lr_current ?= lr_coll_wrapper->get_current( ).
CHECK lr_current IS BOUND.
DATA : lv_country TYPE string.
lv_country = lr_current->get_property_as_string( iv_attr_name = 'COUNTRY' ).
IF lv_country is INITIAL.
lr_current->set_property( iv_attr_name = 'COUNTRY' iv_value = 'US' ).
ENDIF.
CATCH cx_sy_move_cast_error.
ENDTRY.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
Kind Regards,
Fabian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.