In recent assignment, I was working on a project where ECC is used in below layer of CRM and LORD (Lean Order) is active.
I had couple of requirements for which I have faced challenges and did not get much help in Internet.
In this document I would share the solution with community member so that there can be some help in future.
Requirement 1: Navigating to Sales Order from other source like BP Factsheet
After clicking on sales order document (which is available as hyper link), it should navigate to sales order.
Here challenge was ERP component was not available in component set and when navigating to sales order, it was not possible to pass data.
The solution would be load the ERP component in current instance and execute query to get the sales order instance which would be passed as collection.
Step 1: Onclick of Sales Order
METHOD eh_onsalesorder_clicked.
DATA:
lv_index TYPE i,
lv_object_guid TYPE crmt_object_guid,
lv_vbeln TYPE vbeln_va,
lv_lowparams TYPE string,
lr_bol_core TYPE REF TO cl_crm_bol_core,
lr_calls_context TYPE REF TO zl_crmcmp_c_clmcalllistd0_cn00,
lr_call_entity TYPE REF TO cl_crm_bol_entity,
lr_erporder_entity TYPE REF TO if_bol_bo_property_access, "cl_crm_bol_entity,
lr_collection TYPE REF TO cl_crm_bol_bo_col, "if_bol_bo_col,
lr_dquery_erpqorder TYPE REF TO cl_crm_bol_dquery_service,
lr_query_result TYPE REF TO if_bol_entity_col,
lt_qparams TYPE crmt_name_value_pair_tab,
ls_qparams TYPE crmt_name_value_pair.
* Get index of selected line
cl_thtmlb_util=>get_event_info(
EXPORTING
iv_event = htmlb_event_ex
IMPORTING
ev_index = lv_index ).
* Get the sales order
lr_calls_context ?= me->ztyped_context->calls.
* Just to focus on current entity
lr_call_entity ?= me->ztyped_context->calls->collection_wrapper->find( iv_index = lv_index ).
IF lr_calls_context IS BOUND.
lv_vbeln = lr_calls_context->get_yw_vbeln( attribute_path = '' ).
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_vbeln
IMPORTING
output = lv_vbeln.
lv_lowparams = lv_vbeln.
ENDIF.
* Get BOL core instance
lr_bol_core = cl_crm_bol_core=>get_instance( ).
lr_bol_core->load_component_set( 'ERP' ).
* Get query instance
CALL METHOD cl_crm_bol_dquery_service=>get_instance
EXPORTING
iv_query_name = 'ERPQOrder'
RECEIVING
rv_result = lr_dquery_erpqorder.
IF lr_dquery_erpqorder IS BOUND.
CALL METHOD lr_dquery_erpqorder->add_selection_param
EXPORTING
iv_attr_name = 'VBELN' "#EC NOTEXT
iv_sign = 'I'
iv_option = 'EQ'
iv_low = lv_lowparams.
lr_query_result = lr_dquery_erpqorder->get_query_result( ).
* Get Order entity to which we will navigate
lr_call_entity ?= lr_query_result->get_first( ).
IF lr_call_entity IS BOUND.
lr_erporder_entity = lr_call_entity->get_related_entity( 'ERPADVSOrder' ).
ENDIF.
ENDIF.
* If there is an result entity then only navigate
IF lr_erporder_entity IS BOUND.
CREATE OBJECT lr_collection.
CALL METHOD lr_collection->if_bol_bo_col~add
EXPORTING
iv_entity = lr_erporder_entity.
* Call outbound plug
me->op_singleselect( iv_data_collection = lr_collection ).
ENDIF.
ENDMETHOD.
Step 2:Outbound Plug of view
METHOD op_singleselect.
DATA: lr_window TYPE REF TO cl_bsp_wd_window.
lr_window = me->view_manager->get_window_controller( ).
* To window outbound plu
ldr_window->call_outbound_plug( iv_outbound_plug = 'SINGLESELECT'
iv_data_collection = iv_data_collection ).
ENDMETHOD.
Step 3:Outbound Plug of window
METHOD op_singleselect.
* Here CALLTOERPORD is a navigation link from source document to ERP_H
me->view_manager->navigate( EXPORTING source_rep_view = rep_view
outbound_plug = 'CALLTOERPORD'
data_collection = iv_data_collection ).
ENDMETHOD.
Step 3:Inbound plug of ERP_H
METHOD ip_editfromsource.
DATA:
lr_entity TYPE REF TO cl_crm_bol_entity,
lr_ctx_node TYPE REF TO cl_bsp_wd_context_node.
IF me->check_lord_load_error( ) EQ abap_true.
op_default_back( ).
ENDIF.
me->set_view_group_context( iv_parent_context = me->view_group_context
iv_first_time = abap_true ).
lr_ctx_node = get_coco_context_node( iv_cnode_name = 'ERPORDER' ).
CHECK ldr_ctx_node IS BOUND.
lr_ctx_node->set_collection( iv_collection ).
lr_entity ?= lr_ctx_node->collection_wrapper->get_current( ).
* Open in EDIT mode
IF lr_entity->is_locked( ) NE abap_true.
lr_entity->lock( ).
ENDIF.
IF lr_entity->is_locked( ) = abap_true.
me->view_group_context->set_all_editable( ).
ENDIF.
ENDMETHOD.
End of Requirement 1
Requirement 2: interaction in LORD interface
Frequently we face requirement to add a field in sales order header & item in ECC and interaction is required between CRM -> ECC.
In CRM:
if a field is added in sales order header same field with same name should be added in ERPADMINH (you can use AET)
if a field is added in sales order item same field with same name should be added in ERPADMINI (you can use AET)
In ECC:
Same field should be added in :
1. If it for header then TDS_HEAD_COMV, TDS_HEAD_COMC (if it is going to be changeable), TDS_HEAD_COMR (if it is going to be read-only)
2. If it for header then TDS_ITEM_COMV, TDS_ITEM_COMC (if it is going to be changeable), TDS_ITEM_COMR (if it is going to be read-only)
LORD_MAPPING table should be updated for HEADER / ITEM along with correct table field name from VBAK / VBAP.
BADI: BADI_LORD_DO_PAI ( Adding in supply list ) and BADI_LORD_GET_INPUT_MODE ( used for screen field attribute ) should be implemented which are available under ENH_SPOT_LORD enhancement spot.
Please see below coding:
METHOD if_badi_lord_do_pai~fill_supply_list.
IF iv_object_id EQ 'HEAD'.
CLEAR ls_supply.
ls_supply-field = 'FIELD1'.
APPEND ls_supply TO ct_supply.
ENDIF.
ENDMETHOD.
METHOD if_badi_lord_get_input_mode~get_input_mode.
IF is_screen-name EQ 'VBAK-FIELD1'
es_screen-input = 1.
es_screen-output = 1.
es_screen-active = 1.
ENDIF.
ENDMETHOD.
End of Requirement 2
Please feel free to comment if you feel adding extra things would be useful.
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 | |
1 | |
1 | |
1 | |
1 | |
1 |