on 01-30-2015 10:16 AM
Hi experts,
I have a requirement to default the ROLE field(drop down) based on account type like
Contact should be created with default role "Contact"
Prospectus should be created with Default BP Role “ Prospect” in Individual account
Competitor should be created with competitor role "Competitor"
Corporate should be created with role as "corporate"
Please help me with this objects with possible solutions
Thanks in advance.
Hi Shiva,
Please go through the SDN before posting
you will find many discusions .
http://scn.sap.com/thread/1843468
check below code in method do_config_determination. We made Account category default.
But according to your requirement , you need to check the account type and make the required role default.
CALL METHOD super->do_config_determination
* EXPORTING
* iv_first_time = ABAP_FALSE
.
DATA: lr_search TYPE REF TO cl_bsp_wd_value_node,
lr_shuffler_ent TYPE REF TO if_bol_bo_property_access,
lr_cuco_shuffler TYPE REF TO cl_bp_head__cucoshuffler,
lr_shuffler TYPE REF TO cl_bsp_wd_value_node.
IF iv_first_time = abap_true.
TRY.
lr_cuco_shuffler ?= me->get_custom_controller( 'BP_HEAD_SEARCH/CuCoShuffler' ).
CATCH cx_root.
ENDTRY.
IF lr_cuco_shuffler IS BOUND.
lr_shuffler ?= lr_cuco_shuffler->typed_context->search->collection_wrapper->get_current( ).
IF lr_shuffler IS BOUND.
lr_shuffler->set_property_as_string( iv_attr_name = 'CATEGORY'
iv_value = '2' ).
ENDIF.
ENDIF.
ENDIF.
* call super
super->do_config_determination( iv_first_time = iv_first_time ).
Thanks,
rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ram,
Thank you for the response and tried with that thread http://scn.sap.com/thread/1843468
but it's not working and in my object i need to default in different account types as i mentioned.
As per as your solution I went through the component and custom controllers and i found that no
custom controller carrying that context node.
So will you please help me further approach.
Thanks.
Hello Shiva,
You can enhance the event EH_ONSAVE of the component BP_HEAD, View BP_HEAD/BPHEADOverview.
You can maintain a z table with the account type and the default role, and then, validate the account type and use this piece of code (this is an example for the role "Prospect":
DATA:
lr_header TYPE REF TO if_bol_bo_property_access,
lr_entity TYPE REF TO cl_crm_bol_entity,
lr_boprol TYPE REF TO if_bol_entity_col,
lr_core_tmp TYPE REF TO cl_crm_bol_core.
lr_header ?= me->ztyped_context->builheader->collection_wrapper->get_current( ).
IF lr_header IS BOUND.
lr_entity ?= lr_header.
lr_boprol ?= lr_entity->get_related_entities( iv_relation_name = 'BuilRolesRel').
IF lr_boprol IS BOUND.
CALL METHOD cl_crm_uiu_bp_tools=>add_role
EXPORTING
ir_header = lr_entity
iv_rolecategory = 'BUP002'..
lr_core_tmp = cl_crm_bol_core=>get_instance( ).
lr_core_tmp->modify( ).
ENDIF.
ENDIF.
And finally invoke the super eh_onsave.
call method super->eh_onsave
exporting
htmlb_event = htmlb_event
htmlb_event_ex = htmlb_event_ex
importing
ev_success = ev_success.
Best regards,
Renzo.
Hello Renzo Yacarini ,
Thank you very much for providing required solution with exact details.
it's working fine. once again thank you very much.
User | Count |
---|---|
5 | |
1 | |
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.