This Document is about calling ECC Transaction from CRM with Search Parameter using Transaction Launcher with Parameter without adding the TL in any of the workcenter by using Dynamic navigation

You can Refer dcoumnet Transaction launcher with parameter using Dynamic navigation without adding TL in Workcenters for calling TL using Key value

This document is about calling TRansaction using Search parameter. Say for example for We need to call VA03 Sales Order from CRM with PO number details instead of Sales order details

PO_TL1.jpg

STEP1: We need to create Object Type in R3 system by copying the standard Object type .

For sales order we need to copy BUS2032

Go to SWO1 Transaction and provide BUS2032 in object type and click on copy

PO_TL12.jpg

In the POPUP provide the details

PO_TL3.jpg

Click on Copy and then open ZBUS2032 in edit mode

PO_TL4.jpg

After that cursor on method and click create button to create custom method

Click on no in the popup

which ask to create using FM and then provide following details and click on Ok

PO_TL5.jpg

Then curson on the method ZLIST_ORDER and cick parameter

PO_TL6.jpg

PO_TL7.jpg

Create parameter for Purchase Order click on Yes in the popup

PO_TL8.jpg

Provide BAPIORDERS in Table name and choose PURCH_NO field and click ok

PO_TL9.jpg

Check Import and Mandatory and click on create

Press F3 and cursor on ZLIST_ORDER method and click program

PO_TL10.jpg

PO_TL11.jpg

Click on Yes in Popup

and put the below code in the moethod

For this You need to find out Scrren number and Program name for the TCODE VA03.

Go to VA03 and in PUrchase Order Number field press F1 and see the detials from technical details

PO_TL19.jpg

PO_TL20.jpg

Using These details we can call transaction VA03 in code.

begin_method zlist_order changing container.
DATA:
      purchaseorderno TYPE bapiorders-purch_no,
      t_bdcdata TYPE bdcdata OCCURS 1 WITH HEADER LINE,
      salesorders LIKE bapiorders OCCURS 0,
      salesorder LIKE bapiorders .
DATA:li_vbak TYPE TABLE OF vbak.
DATA:lwa_vbak TYPE vbak.
DATA: bdcdata_wa  TYPE bdcdata,
         bdcdata_tab TYPE TABLE OF bdcdata.

DATA opt TYPE ctu_params.

swc_get_element container ‘PurchaseOrderNo’ purchaseorderno.

CLEAR bdcdata_wa.
bdcdata_wa-program  = ‘SAPMV45A’.
bdcdata_wa-dynpro   = ‘0102’.
bdcdata_wa-dynbegin = ‘X’.
APPEND bdcdata_wa TO bdcdata_tab.

CLEAR bdcdata_wa.
bdcdata_wa-fnam = ‘BDC_CURSOR’.
bdcdata_wa-fval = ‘RV45S-BSTNK’.
APPEND bdcdata_wa TO bdcdata_tab.

CLEAR bdcdata_wa.
bdcdata_wa-fnam = ‘RV45S-BSTNK’.
bdcdata_wa-fval = purchaseorderno.
APPEND bdcdata_wa TO bdcdata_tab.

CLEAR bdcdata_wa.
bdcdata_wa-fnam = ‘BDC_OKCODE’.
bdcdata_wa-fval = ‘=SUCH’.”to execute search command
APPEND bdcdata_wa TO bdcdata_tab.

opt-dismode = ‘E’.
opt-defsize = ‘X’.

IF salesorders IS INITIAL.
  CALL TRANSACTION ‘VA03’ USING  bdcdata_tab  OPTIONS FROM opt.
ELSE.
  CALL TRANSACTION ‘VA03’ USING  bdcdata_tab  OPTIONS FROM opt.
ENDIF.

end_method.

And save the method and press F3. Then cusrsor on method nad click EDIT->Change Release status->object type->To Implemented

and then EDIT->Change Release status->object type component->To Implemented

PO_TL13.jpg

Do the same by cursor on object type ZBUS2032. Then Generate the method and Object type by clicking Generate

PO_TL14.jpg

PO_TL15.jpg

STEP2: Create Transaction Launcher for this object type ZBUS2032 in CRM

for more details to create TL check this document STEP2 Transaction launcher with parameter using Dynamic navigation without adding TL in Workcenters

PO_TL17.jpg

After this go to the class got created for this TL and replace the code in method prepare_data_flow

METHOD if_crm_ic_action_handler~prepare_data_flow.
  DATA: __gdc    TYPE REF TO if_crm_ui_data_context,
        __source TYPE        string,
        __line   TYPE        string,
        __path   TYPE        crmt_ic_ac_identify_path.

  __gdc ?=
  cl_crm_ui_data_context_srv=>get_instance( gv_view_controller ).
********** Begin of parameter declaration ***********

  DATA icwcprocessedobject
  TYPE ty_icwcprocessedobject .
  DATA purchaseorderno
  TYPE ty_purchaseorderno .
  DATA l_salesorders
  TYPE ty_salesorders .
  DATA salesorders
  TYPE TABLE OF ty_salesorders .
  DATA icwebclientborkeyparameter
  TYPE ty_icwebclientborkeyparameter .

  CONCATENATE
  ‘/’
  ‘/’
  ‘OBJKEY’
  INTO __source.

  CALL METHOD cl_crm_ui_ltx_cuco_access_srv=>get_instance
    EXPORTING
      iv_controller = gv_view_controller
    RECEIVING
      rv_result     = gv_ltx_cuco.
  gv_selected_entity ?= gv_ltx_cuco->get_selected_clipboard_entry( ).
  IF gv_selected_entity IS BOUND.
    TRY.
        __path = __source.
        CALL METHOD
          cl_crm_ic_activity_clipboard=>get_property_as_value
          EXPORTING
            iv_xpath  = __path
            iv_entity = gv_selected_entity
          IMPORTING
            ev_result = icwebclientborkeyparameter.
      CATCH cx_crm_bdc_no_data cx_crm_bdc_xpath_error cx_root.
        CLEAR icwebclientborkeyparameter .
    ENDTRY.
  ENDIF.

* me->set_container_object(
*   iv_name        = ‘<*MAINOBJ*>’
*   iv_object_key  = ICWEBCLIENTBORKEYPARAMETER
*   iv_object_type = gv_bortype ).
  me->set_container_data(
   iv_name  = ‘PURCHASEORDERNO’
   iv_value = ICWEBCLIENTBORKEYPARAMETER ).

* Data flow is complete – set to false if data is missing
  gv_data_flow_complete = abap_true.

ENDMETHOD.

After creating TL Create Logical Link ID in SPRO for this TL ID

STEP3: For Dynamic Navigation We need to Create Object Type WRAPPED_ZBUS2032 in CRM system by maintaining entry in table

BSPDLCV_OBJ_TYPE for custom business type in SM30.

PO_TL16.jpg

Please check this document to maintain this entry in Navigation Bar profile using TL logical Link ID for dynamic navigation support in STEP5

Transaction launcher with parameter using Dynamic navigation without adding TL in Workcenters

STEP4: Calling TL in code with dynamic Navigation

On click of Purchase Order Number Put the below Code

method EH_ONPURC_ORD.

* Added by wizard: Handler for event ‘PURC_ORD’
  DATA: lv_viewname  TYPE string,
        lr_ctxtl     TYPE REF TO cl_bsp_wd_view_controller,
        lv_children  TYPE tbsp_wd_viewarea_content.

  DATA :lr_equi      TYPE REF TO cl_crm_bol_entity,
        lr_partner   TYPE REF TO cl_crm_bol_entity,
        lv_equi_id   TYPE comt_product_id,             “#EC NEEDED
        lr_msg_srv   TYPE REF TO cl_bsp_wd_message_service,
        lr_custh     TYPE REF TO cl_crm_bol_entity,
        lr_window    TYPE REF TO cl_prdobj_equdata.
  DATA: ls_ecc       TYPE SMOF_ERPSH,
        lv_logsys    TYPE LOGSYS,
        lv_obj_key   TYPE SWO_TYPEID,
        lv_purc_ord1 TYPE string,
        lv_purc_ord  TYPE CHAR20,
        lv_rfcdest   TYPE  RFCDES-RFCDEST,
        lv_error     TYPE SY-LISEL.
  DATA: gdc          TYPE REF TO if_crm_ui_data_context.
  DATA: gv_view_controller TYPE REF TO cl_bsp_wd_view_controller. “#EC NEEDED
  DATA: source       TYPE string.

  DATA: ls_oppt      TYPE crmst_opporth_btil.
  DATA: lr_type      TYPE REF TO cl_crm_bol_entity.
  DATA: lr_nav       TYPE REF TO if_crm_ui_navigation_service.
  DATA: lr_nav_descr TYPE REF TO if_bol_bo_property_access.
  DATA: lr_col       TYPE REF TO if_bol_bo_col.

  TRY.
      IF gdc IS NOT BOUND.
        gdc ?= cl_crm_ui_data_context_srv=>get_instance( ).
      ENDIF.
    CATCH cx_root.
  ENDTRY.

  CALL FUNCTION ‘CRM_GET_ERP_SYSTEM’
    IMPORTING
      ES_SMOF_ERPSH = ls_ecc.
  lv_rfcdest = ls_ecc-rfcdest.
  IF lv_rfcdest IS NOT INITIAL.
    CALL FUNCTION ‘RFC_TRUSTED_CHECK’
      EXPORTING
        RFCDEST       = lv_rfcdest
      IMPORTING
        ERROR_MESSAGE = lv_error.
    IF lv_error IS NOT INITIAL.
      lr_msg_srv = cl_bsp_wd_message_service=>get_instance( ).
      lr_msg_srv->add_message( iv_msg_type   = ‘E’
                            iv_msg_id     = ‘ZMSG_CL’
                            iv_msg_number = ‘002’ ).
      RETURN.
    endif.
  endif.
  lv_logsys = lv_rfcdest.
  CONCATENATE lv_logsys ‘_TRUSTED’ INTO lv_rfcdest.
  lr_custh ?= me->typed_context->btcustomerh->collection_wrapper->get_current( ).
  if lr_custh IS BOUND.
    lv_purc_ord = lr_custh->get_property_as_string( iv_attr_name = ‘PURC_ORD’ ).

    lv_obj_key = lv_purc_ord.

    lr_nav_descr = cl_crm_ui_descriptor_obj_srv=>create_bor_based(
                                                            iv_bor_object_type  = ‘ZBUS2032’
                                                            iv_bor_object_key   = lv_obj_key
                                                            iv_logical_system   =  lv_logsys
                                                            iv_ui_object_type   = ”
                                                            iv_ui_object_action = if_crm_ui_descriptor_object=>gc_action_display ).

    CREATE OBJECT lr_col TYPE cl_crm_bol_bo_col.
    lr_col->add( lr_nav_descr ).
    lr_nav = cl_crm_ui_navigation_service=>get_instance( me ).

    CHECK lr_nav IS BOUND.
    IF lr_nav->is_dynamic_nav_supported( lr_nav_descr ) = abap_true.
      lr_nav->navigate_dynamically( lr_col ).
    ENDIF.
  endif.

endmethod.

RESULT:

When you Click on Purchase order number 123 in CRM WEBUI You will get the POPUP with Sales Orders which has 123 as purchase Order Number

PO_TL18.jpg

Regards,

Deepika.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply