Thursday, January 12, 2012

How To Group Records in a Data Package (DTP) in SAP Netweaver BW (BI)



How To Group Records in a Data Package (DTP) in SAP Netweaver BW (BI)
Here is an example where I wanted to specify how the records are read and formed when data is loaded in BW. That is, I wanted to ensure certain groups of data are logically packaged in one data package (DTP) and not sprinkled across two different data packages.
In this example, I have created a custom data model that shows the related serial number(s) for a given delivery number, item, and material number. When loading the infocube, I want to ensure that all serial numbers for a given delivery number, item, and material are contained within the same data transfer package (DTP).
However, the settings for Semantic Groups are unavailable by default (as seen below)
Fig. 1 Semantic Group is disabled by default.
Before you can specify the Semantic Grouping, you will need to decide how error records are handled.
Navigate to the ‘Update’ tab and click on the ‘Error Handling’ window to see the four options:
  • Deactivated
  • No Update, No Reporting (default)
  • Valid Records Update, No Reporting (Request Red)
  • Valid Records Update, Reporting Possible (Request Green)
To learn more about error handling, please visit the following page. http://help.sap.com/saphelp_nw70/helpdata/en/42/fbd598481e1a61e10000000a422035/content.htm


Error Stack Setting in SAP Netweaver BW (BI)
Fig. 2 Default Error Stack Setting
In my scenario, I want to be alerted when errors occur and I want process the errors before the records are sent to the data target.
Selecting the option “Valid Records Update, No Reporting (Request Red)” will leave the error records in the error stack and set the QM status for this request to Red. Now that I have chosen my error handing option, I can set Semantic Group.
Error Stack Setting in SAP Netweaver BW (BI)
Fig 3. Custom Error Package Setting
Navigate to the ‘Extraction’ tab and confirm that a Green checkmark appears next to the ‘Semantic Group’ button. This indicates that a selection has been made.
Click on the ‘Semantic Group’ button and confirm that a ‘Selection of Key Fields for Error Stack’ window appears.
Now, you can determine how the system groups the records when reading from the data source. Unselect the unnecessary fields. Leave the key fields for your logical group as checked.
Semantic Group via DTP in SAP Netweaver BW (BI)
Fig. 4 Semantic Grouping is now available
Update (1/14/2011):
Recently, I had to implement my own version of the obsolete ABAP construct “ON CHANGE OF” event block and found the following to be true: While records may be grouped in a DTP as shown above, you cannot assume that they are sorted by the DSO keys as defined.
You will need to perform an explicit “SORT” on the source/result package as required by your start/end routine logic if you are performing custom comparison operations. Be diligent! =D

No comments:

Post a Comment