cancel
Showing results for 
Search instead for 
Did you mean: 

assign Bp grouping on condition while creating BP from different places

Former Member
0 Kudos

hello all,

Right now BP number is getting created using some Z 1group id which set to default.

i did this at below path.

BP Number ranges:

IMG:cross app components > sap business partner > bp > no ranges and groupings

I have craeted one more group with name Z2.

now my req is to use that Z1 group only incase if the BP creates from ECC, rest all cases it should use Z2 group id to create BP .

there is a tcode : BUPA_events, wherein i can create a Z FM to write code if not RFC calls use Z2.

but what and how to achieve is a Big doubt

I got the FM: BUPA_CREATE_FROM_DATA

and i found some BADIs in it.

Thanks

Seema

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

solved

Former Member
0 Kudos

DATA: qs TYPE REF TO cl_crm_bol_dquery_service.

DATA: result TYPE REF TO if_bol_entity_col.

DATA:lr_coco TYPE REF TO cl_bp_cont__bspwdcomponen_impl,

lv_size TYPE string,

lv_object TYPE string,

lv_object_plr TYPE string.

*For passing the value of text elements into another variables to avoid type incompatibility as part of SEARCH PAGE ENHANCEMENTS

lv_object = text-001.

lv_object_plr = text-002.

qs ?= me->typed_context->search->collection_wrapper->get_current( ).

            • Begin of my code *********************************

            • To get the accounts for the EMP responsible ******

*check if the search is on employee responsible

DATA: lr_query_params TYPE REF TO if_bol_bo_col,

lr_ent TYPE REF TO if_bol_bo_property_access.

DATA: lv_custom_logic TYPE abap_bool.

lr_query_params = qs->get_selection_params( ).

lr_ent = lr_query_params->get_first( ).

WHILE lr_ent IS BOUND.

DATA: ls_selection TYPE genilt_selection_parameter.

  • Get the attributes out

lr_ent->get_properties( IMPORTING es_attributes = ls_selection ).

IF ls_selection-attr_name = 'OWNER'.

IF ls_selection-low IS NOT INITIAL.

lv_custom_logic = abap_true.

EXIT.

ENDIF.

ENDIF.

  • Get all the entitys from the collection

lr_ent = lr_query_params->get_next( ).

ENDWHILE.

IF lv_custom_logic = abap_true.

DATA: lr_acc_qs TYPE REF TO cl_crm_bol_dquery_service.

CALL METHOD cl_crm_bol_dquery_service=>get_instance

EXPORTING

iv_query_name = 'BuilHeaderAdvancedSearch'

RECEIVING

rv_result = lr_acc_qs.

CALL METHOD lr_acc_qs->add_selection_param

EXPORTING

iv_attr_name = 'OWNER'

iv_sign = 'I'

iv_option = 'EQ'

iv_low = ls_selection-low.

ENDIF.

DATA: acc_result TYPE REF TO if_bol_entity_col.

DATA: acc_ent TYPE REF TO if_bol_bo_property_access.

DATA: lv_acc TYPE string.

acc_result = lr_acc_qs->get_query_result( ).

CHECK acc_result IS BOUND.

DATA: lr_con_qs TYPE REF TO cl_crm_bol_dquery_service.

CALL METHOD cl_crm_bol_dquery_service=>get_instance

EXPORTING

iv_query_name = 'BuilContactAdvancedSearch'

RECEIVING

rv_result = lr_con_qs.

acc_ent = acc_result->get_first( ).

WHILE acc_ent IS BOUND.

lv_acc = acc_ent->get_property_as_string( iv_attr_name = 'BP_NUMBER' ).

CALL METHOD lr_con_qs->INSERT_SELECTION_PARAM

EXPORTING

iv_index = sy-index

iv_attr_name = 'BP_NUMBER'

iv_sign = 'I'

iv_option = 'EQ'

iv_low = lv_acc.

acc_ent = acc_result->get_next( ).

ENDWHILE.

DATA: lr_cont_res TYPE REF TO if_bol_entity_col.

CHECK lr_con_qs IS BOUND.

lr_cont_res = lr_con_qs->get_query_result( ).

                              • End of my code *******************

  • result = qs->get_query_result( ).

  • me->typed_context->searchresult->collection_wrapper->set_collection( result ).

me->typed_context->searchresult->collection_wrapper->set_collection( lr_cont_res ).

lr_coco ?= comp_controller.

*Get the no of records found as part of SEARCH PAGE ENHANCEMENTS

lv_size = lr_coco->typed_context->contact->collection_wrapper->size( ).

*calling the generic method for getting the result list title as part of SEARCH PAGE ENHANCEMENTS

CALL METHOD cl_crm_uiu_gen_tools=>get_result_title

EXPORTING

iv_size = lv_size

iv_object = lv_object

iv_msg_id = 'CRM_BUPA_BOL'

iv_msg_no = '103'

iv_object_plr = lv_object_plr

RECEIVING

rv_result_title = gv_result_title.

DATA: lr_core TYPE REF TO cl_crm_bol_core,

lt_messages TYPE crmt_genil_message_tab,

global_message_cont TYPE REF TO cl_crm_genil_global_mess_cont.

lr_core = cl_crm_bol_core=>get_instance( ).

CALL METHOD lr_core->get_global_message_cont

RECEIVING

rv_result = global_message_cont.

CALL METHOD global_message_cont->if_genil_message_container~get_messages

EXPORTING

iv_message_type = 'A'

IMPORTING

et_messages = lt_messages.

*The redundant messages which are displayed both in message area and on top of result view are deleted from the message container as part of search usability enhancement

CALL METHOD global_message_cont->if_genil_message_container~delete_messages

EXPORTING

iv_msg_id = 'CRM_BUPA_BOL'

iv_msg_number = '103'.

CALL METHOD global_message_cont->if_genil_message_container~delete_messages

EXPORTING

iv_msg_id = 'CRM_BUPA_BOL'

iv_msg_number = '102'.

CALL METHOD global_message_cont->if_genil_message_container~delete_messages

EXPORTING

iv_msg_id = 'CRM_BUPA_BOL'

iv_msg_number = '101'.