Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Soft Switch Framework

$
0
0

Purpose
The main purpose of the Switch Framework is to simplify an ABAP-based system landscape by adopting one or more industry solutions in a standard system. The Switch Framework allows you to externally control the visibility of repository objects or their components by means of switches.

By using the Switch Framework, all industry solutions and a restricted list of repository objects are delivered in an inactive state in the system. With minor exceptions, you no longer need to install an industry solution – you can activate it when required.


Integration
The Switch Framework is integrated in the ABAP Workbench and works closely together with the Enhancement Framework.

 

Features
The Switch Framework enables you to:

● Switch on industry solutions and Enterprise Add-Ons

● Enhance delivered partner and customer systems

 

Go To Transaction – YESF

 

Below is an example of triggering of Sales Order Confirmation Adobeform in SAP CRM

Driver Program Class Name is 'YCL_O2C_PROCESS_CRM_ORDER'

An Class Interface is create with name 'YIF_O2C_PROCESS_CRM_ORDER' and Method 'ORDER_CONF'

Another Class is created which will call this Interface with the name 'YCL_O2C_PROCESS_CRM_ORDER_FR'.

From this class 'YCL_O2C_PROCESS_CRM_ORDER_FR' method 'YIF_O2C_PROCESS_CRM_ORDER~ORDER_CONF', Driver Program is called i.e. 'YCL_O2C_PROCESS_CRM_ORDER'.

 

Right Click on the Customer to Order

 

1.jpg

Create Application Node with below Table Name and Field Name (T005-LAND1 (Countries))

2.jpg

 

Right Click on Sales Order Conf and First Create rule node and then Create exit node

3.jpg

Soft Switch Framework is done country specific like Eg: FR (France)

 

4.jpg

Double click on Exit Node ‘Sales Order Conf’

5.jpg

BADI Class - YCL_IM_AF_BADI_ORDER_CONF

BADI Method - IF_EX_DOC_PERSONALIZE_BCS~PERSONALIZE_PDF_DOC_PDFIF

Rule structure - HRP1028 - LAND1 (To compare the country of the Soft Switch Framework and the country for which the Adobeform is triggered)

 

Right Click on Exit Node ‘Sales Order Conf’ and Create Implementation Node

6.jpg

 

In the Implementation Node enter as below

 

Implement. Class - YCL_O2C_PROCESS_CRM_ORDER_FR

Method - YIF_O2C_PROCESS_CRM_ORDER~ORDER_CONF

 

7.jpg

In Exit Node

 

8.jpg

Click on Formula

9.jpg

In Exit Node

Click Exit

 

12.jpg

 

11.jpg

 

Code To trigger from BADI Class - YCL_IM_AF_BADI_ORDER_CONF

BADI Method - IF_EX_DOC_PERSONALIZE_BCS~PERSONALIZE_PDF_DOC_PDFIF

 

Code Snippets

 

 

METHOD if_ex_doc_personalize_bcs~personalize_pdf_doc_pdfif.

  DATA: rf_appl_object TYPE REF TO cl_doc_crm_order_h.

  CONSTANTS: lco_order_conf TYPE char17 VALUE 'YSALES_ORDER_CONF',
             lco_e TYPE char1 VALUE 'E',
             lco_plvar TYPE plvar VALUE '01'.

*----------------------------------------------------------------------
* internal tables
*----------------------------------------------------------------------
  DATA:
    lt_exit               TYPE ytt_esfinstance.
*----------------------------------------------------------------------
* work areas
*----------------------------------------------------------------------
  DATA:
    lwa_exit              TYPE yesfinstance,
    lwa_orgman_ui         TYPE crmt_1001_orgman_ui,
    lwa_hrp1028           TYPE hrp1028,
    lwa_guid              TYPE crmt_object_guid.
*----------------------------------------------------------------------
* Constants
*----------------------------------------------------------------------
  CONSTANTS:
    lco_kind_a            TYPE crmt_object_kind    VALUE 'A',
    lco_int_orgman        TYPE crmt_interface_name VALUE 'CRMT_1001_ORGMAN_UI'.
*----------------------------------------------------------------------
* reference variables
*----------------------------------------------------------------------
  DATA:
    lrf_o2c_process_crm_order TYPE REF TO yif_o2c_process_crm_order,
    rf_cx_os_object_not_found TYPE REF TO cx_os_object_not_found,
    rf_cx_sy_move_cast_error TYPE REF TO cx_sy_move_cast_error .


  IF flt_val EQ lco_order_conf.
    cp_document_title = text-001."Sales Order Confirmation
    rf_appl_object ?= io_appl_object.
*----------------------------------------------------------------------
* Processing Logic
*----------------------------------------------------------------------
    TRY.
        CALL METHOD rf_appl_object->get_crm_obj_guid
          RECEIVING
            result = lwa_guid.
      CATCH cx_os_object_not_found INTO rf_cx_os_object_not_found.
        MESSAGE rf_cx_os_object_not_found TYPE lco_e.
    ENDTRY.

* Fetch organizational data from screen
    CALL FUNCTION 'CRM_INTLAY_GET_DATA'
      EXPORTING
        iv_guid           = lwa_guid
        iv_kind           = lco_kind_a
        iv_interfacename  = lco_int_orgman
      IMPORTING
        es_interfacevalue = lwa_orgman_ui.
* Use organizational data to find country code
    SELECT *
        UP TO 1 ROWS
      INTO lwa_hrp1028
      FROM hrp1028 CLIENT SPECIFIED
     WHERE objid = lwa_orgman_ui-sales_org
      AND plvar EQ lco_plvar
      AND mandt EQ sy-mandt.
    ENDSELECT.

* Implementation of Soft Switch Framework
    CALL METHOD ycl_esf_exit=>composer
      EXPORTING
        iv_application_id = '0000000003'
        iv_exit_id        = '0000000007'
        is_decision       = lwa_hrp1028
      IMPORTING
        et_exit           = lt_exit.

    LOOP AT lt_exit INTO lwa_exit.
      TRY.
          lrf_o2c_process_crm_order ?= lwa_exit-o_exit.

          CALL METHOD lrf_o2c_process_crm_order->order_conf
            EXPORTING
              i_hrp1028           = lwa_hrp1028
              flt_val             = flt_val
              io_appl_object      = io_appl_object
              io_personalize_data = io_personalize_data
              ip_application_log  = ip_application_log
              ip_user_settings    = ip_user_settings
              ip_function_name    = ip_function_name
              ip_form_name        = ip_form_name
              is_outputparams     = is_outputparams
            IMPORTING
              es_formoutput       = es_formoutput
              es_joboutput        = es_joboutput
            CHANGING
              cs_docparams        = cs_docparams
              cp_document_title   = cp_document_title.

        CATCH cx_sy_move_cast_error INTO rf_cx_sy_move_cast_error.
          MESSAGE rf_cx_sy_move_cast_error TYPE lco_e.
      ENDTRY.
    ENDLOOP.
  ENDIF.

ENDMETHOD.

 

In Exit Node

 

10.jpg

Click Code

 

Here we call the Driver Program

 

METHOD yif_o2c_process_crm_order~order_conf.

  DATA: rf_order_conf TYPE REF TO ycl_o2c_process_crm_order,
        rf_container  TYPE REF TO object,
        rf_cx_sy_ref_is_initial TYPE REF TO cx_sy_ref_is_initial.

  CONSTANTS: lco_e TYPE char1 VALUE 'E'.

  MOVE io_appl_object to rf_container.
  TRY.
*-- Object is created
      CREATE OBJECT rf_order_conf
        EXPORTING
          i_appl_object  = rf_container
          i_adobe_form   = ip_form_name
          i_outputparams = is_outputparams.

*-- Calling CRM Order Confirmation Class YCL_O2C_PROCESS_CRM_ORDER
      IF rf_order_conf IS BOUND.
*-- Method to Fetch Data using FM CRM_ORDER_READ
        CALL METHOD rf_order_conf->fetch_data( ).

*-- Method to Call Adobe Form Function Module
        CALL METHOD rf_order_conf->process
          CHANGING
            c_sfpjoboutput = es_joboutput
            c_fpformoutput = es_formoutput
            c_sfpdocparams = cs_docparams.
      ENDIF.
    CATCH cx_sy_ref_is_initial INTO rf_cx_sy_ref_is_initial.
      MESSAGE rf_cx_sy_ref_is_initial TYPE lco_e.
  ENDTRY.

ENDMETHOD.

 

Now this Adobeform will be triggered in the T005-LAND1 is same as HRP1028-LAND1

 

If you wait to switch this off, then the Exit Node uncheck the checkbox.

 

13.jpg


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>