Skip to Content

A demo on creating and using a custom switch, which is explained via various steps involved in the process. Many documents are available in the internet on Switch framework, but most of them end up with definition and explanation. I thought of creating a simple, very basic demo, which is aimed to the beginners, for them to understand the creation of switches and how the switch on/off reflects in the system.

Switch Framework

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.

Here we discuss about the creation of switches. Starting with Tcode SFW1, where we will create a new switch. In the ‘Packgs’ tab, we can add our package name. Here I have added my package ‘ZABY_SFW_TEST_PACKAGE’, where I will be saving the enhancements which I add later. Save and activate the switch.

Next we need to create a Business Function via the Tcode SFW2.


A Business Function is a building block of a business function set. From a business perspective, it represents a self-contained function that you can switch on. Technically, a business function is a set of switches that assign objects to the business function. Business functions are switched on at a system level. By activating a business function, you activate all of its switches except for conflict switches. Conflict switches are not assigned to business functions.

When you switch on a business function, all switches assigned to it are switched to ON or STANDBY, respectively, depending on the definition of the business function.

The business functions can be reversible and non-reversible. Only reversible business functions can be switched off.


The following types of business functions are available:

●      Industry Business Function: always needs a business function set to be attached to

●      Enterprise Business Function: independent of business function sets

●     Enterprise Add-Ons: can no longer be created. Semantically they are the same as Enterprise Business Functions but are based on another technique.

I have created a business function with Type G which is an enterprise business function.

/wp-content/uploads/2013/10/dialog_294273.jpg

In the Business function, I have added the switch which we have created in the previous step. See the image below. 

Now go to the properties tab and tick the check box ‘Reversible’, as shown in below image. Only the business functions with reversible status can be deactivated again, once it is activated. Now Save and activate the business function.

/wp-content/uploads/2013/10/dialog2_294245.jpg

In case if you have created a Industry Business Function, its always needs a business function set to be attached to. Those who are following with Enterprise Business Function(as followed above) can avoid this step of creating Business function set, and can continue with SFW5 to switch on business functions.


A Business Function Set is the top component of the Switch Framework and represents an industry solution that you tailor from existing solutions in the SAP system.

A business function set groups into a unit several business functions that:

●      meet the requirements of an industry solution

●      can be switched on in parallel (unless they are defined as excluding in transaction SFW2).


To create a business function set, use Tcode SFW3 and. And add your business function to the business function tab in the business function set, as shown below. Save and activate it.

/wp-content/uploads/2013/10/dialog3_294272.jpg

Now use transaction SFW5 to switch on business functions and all switches assigned to them.  Expand the node ENTERPRISE_BUSINESS_FUNCTIONS, as shown in the image below.

Scroll down to our new Business Function and you can see the planned status column as unchecked by default, ie business function is in switched off position. The icon just right of the business function name indicates that it is a reversible one.

/wp-content/uploads/2013/10/dialog5_294264.jpg

Now we will see how this status reflects in the system.

  I am creating an implicit enhancement in ‘userexit_save_document_prepare’  of sales order program.  I have saved the enhancement in the Package ‘ZABY_SFW_TEST_PACKAGE’ which is assigned to switch, which we have just created.


And when you save any document in Sales order program VA01/VA02, you will notice that even though the above enhancement implementation is active, program won’t touch the break-point which is hard coded there.


Now come back to Tcode SFW5 to switch on the business function. Tick the checkbox in’ Planned status’ column and click the ‘Activate changes’ button in the top.

/wp-content/uploads/2013/10/dialog4_294250.jpg

Now again save a sales order and you will see that the execution has reached inside our enhancement.

Since the switch is a reversible one, again we can switch off it, thereby the enhancement.

Thanks.

To report this post you need to login first.

38 Comments

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

  1. Wouter Peeters

    Great document. Does anyone know any specific use cases for this ( that they actually used at customers ) ?

    I can only imagine this is useful in case of a bigger custom development?

    (0) 
    1. Abyson Joseph Post author

      Hi Wouter,

      In real scenarios we usually use the standard Business Function Sets provided by the SAP, which relates to the particular industry solution and corresponding set of business attributes and functions. I have given here a very basic demo to understand the various components in the switch framework and how they are correlated.

      Regards,

      (0) 
  2. Kiran K

    Abyson,

    I read quite a few documents explaining the concept of Switch ON/OFF of Enhancements but this is the first document where I got to know how to create a Switch and then linking it to Business Function/SET and then to SFW5.Very nice and useful document.

    My queries are

    1.What are the advantages of using this SWITCH concept instead of deactivating (Comment the Code) or activating (Uncomment the Code) the Enhancement at the Code level.

    2.Is it mandatory that we have the Static and Dynamic Enhancement within the same Spot ?

    3.How it will behave if we have different spots  within the same package or different package for each ?

    Thanks,

    K.Kiran.

    (0) 
    1. Abyson Joseph Post author

      Hi Kiran,

      Thanks for the comments.

      Query 1:

      The main use of  Switch Framework is, 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.

      Means, switch frameworks are be considered in a broader aspect.

      For a better understanding I will explain it in a simple way. In case of an enhancement for a small business requirement, we just can go with usual enhancement techniques and can activate/deactivate the changes by comment/uncomment the code. But think of a huge development with many number of enhancements. If we want to deactivate it, we need to go each object and has to comment the code. But if all the packages in the development are added to a switch, we just can simply activate/deactivate the full development by on/off the switch.

      Query2:

      It is not mandatory. Its fully based on your requirement. Switch works on the package level. Switch considers static and dynamic enhancements based on the ‘Switch Type’ maintained in Business function. Check this doc Static Enhancement vs Dynamic Enhancement

      Query3:

      Switch considers the enhancement in the packages which are assigned to it via Business function. You can add multiple packages to a switch. If your enhancement implementations are saved in two package and both assigned to a switch, the on/off of switch will affect both. The ‘switch type’ maintained against switch in Business function has some role with the behavior of objects(Static and dynamic). Check this document Static Enhancement vs Dynamic Enhancement

      (0) 
  3. Parveen Kumar

    Hello Abyson,

    Thanks for sharing the useful information.

    An important use of Switches/Business Functions can also be made when adding new values to a domain.

    We can add a new Fixed value append to a domain and control the fixed value append from a switched package.

    i.e. when the switch is on , the domain will show additional values.

    Regards,

    Parveen Kumar

    (0) 
      1. Solman Novice

        hi Joseph

        very informative document. but i have one query for different purpose.

        we need to migrate transports from one landscape to another landscape without using the data and cofiles. is it possible to bundle all the RICEFW in one package and use the package in the switch framework feature to move from one landscape to another landscape ( import and export of files like BC sets )  ?

        Thanks

        Sol man

        (0) 
        1. Abyson Joseph Post author

          Switch Framework is used to activate various industry solutions which are already delivered in the system in an inactive status. That means, the objects should be available in system. As of my understanding Switch frame work cannot be used to import/export objects between different landscape. Also BC Set are  used to share ‘customization settings’. We can also centrally activate business functions in managed systems from Switch Framework Cockpit in Solution Manager, but it does not have the provision for migrating transports between landscapes.

          (0) 
  4. Gautam Totekar

    I am new at this and going to try this. Just out of curiosity. I see that  the individual DDIC objects or say append structures under a business functions are shown in status ‘switched off’ . Is it possible to manually activate them from say Se11 without actually activating business function. ?

    If not is there a SAP note that confirms it.?

    (0) 

Leave a Reply