Tuesday 14 November 2017

Routines in SAP BW 7.x

There are different types of Routines available to write (ABAP) in SAP BW for data modification/population at different levels. Routines helps us to implement Business Rules or setup better Data Model which is not available in standard way.

This document will cover below routines in SAP BW (7.x).
(Covering “when to write” examples however “how to write” is kept on exploring mode)

◉ Transfer Routine
◉ Start Routine
◉ End Routine
◉ Expert Routine
◉ Field Routine

Transfer Routine will be available at Infoobject level whereas Start, End, Field & Expert Routine will be available at Transformation level.

In Transformation, the execution sequence either will be Start Routine -> Field Routine -> End Routine or only Expert Routine. Options for Start, End & Field Routine will be disabled once Transformation with Expert Routine is created.

◉ Transfer Routine: Available for Char/Currency/Unit infoobjects.


This routine is available at Infoobject level and executes only when data from DataSource is transferred to immediate infoprovider.

Purpose: Data transformation at Infoobject level. Data will be Refined as soon as it enters BW Infoprovider (data model).

Example: Suppose a BW is connected to 2 different ECC. One of the ECC stores unit for Litre as “L” and other as “LT”. In this case BW wants to maintain a single unit for Litre as “L” then Transfer Routine will ensure this process is followed and “LT” is converted to “L” using ABAP.

SAP BW, SAP Live, SAP Tutorial and Material, SAP Guides, SAP All Modules

◉ Start Routine: Can be written in Transformation.


Start Routine executes first when a DTP is executed and can be created in a transformation as shown in the below screenshot. Start Routine processes whole bunch of data at a time (DTP Package size).

SAP BW, SAP Live, SAP Tutorial and Material, SAP Guides, SAP All Modules

Purpose: Modify the source data (SOURCE_PACKAGE) i.e source DS, DSO or Cube etc. Before the data is reached  to target.

Example:

1. Deletion of record during data loads (Similar to DTP filter but Hard-Coded).
2. Populating Internal Table (Global) which can be used further.
3. Sorting of source data before sending to target.

◉ End Routine: Can be written in Transformation.


End Routine executes last when a DTP is executed and can be created in a transformation as shown in the below screenshot. End Routine processes whole bunch of data at a time (DTP Package size).

SAP BW, SAP Live, SAP Tutorial and Material, SAP Guides, SAP All Modules

Purpose: Modify the target data (RESULT_PACKAGE) i.e. target DSO or Cube etc i.e. once data is processed in transformation and ready to store in infoprovider at that time modification can be done.

Example:

1. Population/Modification of target fields.
2. Populating Internal Table which can be used again in End Routine.

If multiple fields (Target) need to be populated/modified then End Routine should be used as all the fields can be populated/modified at one go in that data package instead of Field Routine which will work on individual field at a time.

◉ Expert Routine: Can be written in Transformation.


Expert Routine is alternate approach to Start, Field & End Routine and can be created using below screenshot.

SAP BW, SAP Live, SAP Tutorial and Material, SAP Guides, SAP All Modules

After above screenshot, confirm the change. Once confirmed, below are the options.

SAP BW, SAP Live, SAP Tutorial and Material, SAP Guides, SAP All Modules

Purpose: To handle complex requirement when standard approach for Start Routine & End Routine does not satisfy. In this routine SOURCE_PACKAGE and RESULT_PACKAGE both can be used at the same time for data modification.

Example:

Transpose of data i.e. source has 12 records (Monthly) for a year and in target only single record is required with all the months as columns for that year.

◉ Field Routine: Can be written in Transformation.


Field Routine is written for single field in the transformation where complex modification/derivation is required. Can be created as shown in the below screen shot.

SAP BW, SAP Live, SAP Tutorial and Material, SAP Guides, SAP All Modules

Purpose: To modify/derive a individual field value.

Example:

1. Modification/Population of single field where the internal table is populated in Start Routine and read in Field Routine.

Note: If all the source fields are not mapped 1:1 in target then only Field Routine should be used else End Routine would be best option, as all the required fields are mapped and available in target for bulk processing.

2. Concatenate of 2 or more fields in to the single target field.
3. String modifications on the source fields and storing that in to target field.

Point (a) from example is explained:

Consider an example where Future Joiner’s Period, Quarter & Year needs to be calculated using Future Joiner field value as TRUE or FALSE. Below is the screenshot for the same.

SAP BW, SAP Live, SAP Tutorial and Material, SAP Guides, SAP All Modules

As mentioned, if the fields used in the logic/calculation are available in the target and then End Routine will be best option as only single if will suffice to calculate all the fields falling under same condition. In this scenario, End Routine will improve the performance of the transformation.

If Future Joiner and Start Date are not available in Target then Field Routine should be used.

SAP BW, SAP Live, SAP Tutorial and Material, SAP Guides, SAP All Modules
SAP Online Guides, Tutorials, Materials and Certifications.

Related Posts

3 comments:

  1. thanks for guiding us with this beautiful information..

    sap institute



    ReplyDelete
    Replies
    1. Looking for the best SAP BO Training in Bangalore, then don't delay join IntelliMindz SAP BO Training in Bangalore. Join our SAP BO training to get hands-on training and practice in SAP BO Software. Any Queries call @ 9655877677. IntelliMindz is the best IT Training Institute in Bangalore with placement, offering 200 and more software courses with 100% Placement Assistance.
      SAP BO Course in Bangalore
      SAP BO Course in Chennai
      SAP BO Online Course

      Delete
  2. Nice Article very nicely explained about the topic.

    ReplyDelete