Doing a transformation Look-up on a SPO
Since BW 7.3 SAP has introduced a new storage object, the Semantically Partitioned Objects (or simply the SPO). For those of you who are not familiar with SPOs, I would recommend the following blogs,
http://scn.sap.com/people/alexander.hermann/blog/2010/10/11/bw-730-semantically-partitioned-objects
http://scn.sap.com/docs/DOC-19451
I will keep this post simple. A lot of times we require a look-up to be done on an infoobject table or a DSO table while loading data from a source to a target. With the introduction of SPOs, particularly the DSO SPO, this becomes a little complicated since we have separate tables for each of the partitioned object with data stored for particular partition criteria. Generally this would be the fiscal period or geographic location or can be something else depending on the requirement to split the data.
The following SPO DSO was created directly from RSA1 with the partition criteria and partition names hard-coded. We can also create SPOs using BADIs which can have a rolling values for the partition criteria and the description can be changed likewise.
The RSLPOPARTRANGE and RSLPOPART are the two tables which hold information regarding the partition criteria for SPOs. RSLPOPARTRANGE table gives us the infoobjects used for partitioning the SPO and the partition ID(which is unique identifier) for the partition. The technical name of the partition provider can be obtained from the RSLPOPART table if we know the SPO technical name and partition ID.
In the following code, since I know the partitioning infoobject, I get the value for the data from the source package. A SELECT on the RSLPOPARTRANGE table gives me the partition ID based on which I get the part provider DSO name from the RSLPOPART.
CHOOSE part provider from SPO for look-up
* Take only available FISCYEAR values
SORT t_SOURCE_PACKAGE BY FISCYEAR.
DELETE ADJACENT DUPLICATES FROM t_SOURCE_PACKAGE COMPARING FISCYEAR.
LOOP AT t_SOURCE_PACKAGE INTO wa_SOURCE_PACKAGE.
wa_LPO-f_FISCYEAR = wa_SOURCE_PACKAGE-FISCYEAR.
APPEND wa_LPO TO t_LPO.
ENDLOOP.
* Select partid and position for part provider
SELECT * FROM RSLPOPARTRANGE
INTO TABLE t_RSLPOPARTRANGE
FOR ALL ENTRIES IN t_LPO
WHERE low = t_LPO-f_FISCYEAR
AND iobjnm = ‘0FISCYEAR’
AND lpo = ‘ZSPOD1’
AND objvers = ‘A’.
IF sy-subrc = 0.
LOOP AT t_RSLPOPARTRANGE ASSIGNING <fs_RSLPOPARTRANGE>.
READ TABLE t_LPO ASSIGNING <fs_LPO>
WITH KEY f_FISCYEAR = <fs_RSLPOPARTRANGE>-LOW.
IF sy-subrc = 0.
<fs_LPO>-f_IDPART = <fs_RSLPOPARTRANGE>-IDPART.
MODIFY TABLE t_LPO FROM <fs_LPO>.
ENDIF.
ENDLOOP.
ENDIF.
* Select part provider name from SPO table
SELECT * FROM RSLPOPART
INTO TABLE t_RSLPOPART
FOR ALL ENTRIES IN t_RSLPOPARTRANGE
WHERE idpart = t_RSLPOPARTRANGE-IDPART
AND lpo = ‘ZSPOD1’
AND objvers = ‘A’.
IF sy-subrc = 0.
LOOP AT t_RSLPOPART ASSIGNING <fs_RSLPOPART>.
READ TABLE t_LPO ASSIGNING <fs_LPO>
WITH KEY f_IDPART = <fs_RSLPOPART>-IDPART.
IF sy-subrc = 0.
CONCATENATE ‘/BIC/A’ <fs_RSLPOPART>-PARTPROV ’00’
INTO <fs_RSLPOPART>-PARTPROV.
<fs_LPO>-f_PARTPROV = <fs_RSLPOPART>-PARTPROV.
MODIFY TABLE t_LPO FROM <fs_LPO>.
ENDIF.
ENDLOOP.
ENDIF.
This can also come in handy when you are doing an extraction through a OHD on the SPO.
Thanks for sharing! nice presentation.
-Umashankar
Helpful doc, Thanks.
Useful article, Thanks for sharing Vasanth.