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.
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.
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.
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.
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.
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.
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.