Saturday, September 19, 2009

How to remove duplicate records in the cube?




Scenario: The cube consists of duplicate records of one particular request
The cube is compressed & rolled up into aggregates .

EX : Cube 0IC_C01 is being updated from two ODS i.e 0IC_O01,0IC_O04
This ODS are getting data from data sources 2lis_02_scl,2lis_02_itm respectively

Each ODS has got three data targets. Updating is done by delta method

Sol’s: Goto –Monitor screen of ODS –data target –request- application tool bar –select the icon request reverse posting –monitor the request – until green.

In order to nullify the duplicate records present in the cube compress the request & rollup into aggregates.

The request will be posted if the selection criteria in info package processing tab if we have selected the PSA option i.e first three options
  
Here the case is that the data is being directly updated into the data target
The selection in processing tab is data target only

So, we don’t have the option request reverse posting.

If we have uploaded the data by using the option PSA the process was as follows

Goto :ODS info package monitor screen
Select the request which you want to post .
And push the button in the app. Toolbar request reverse posting
The request will be posted with the Reverse Image & the records will be nullified .
Thus the incorrect records will be deleted.


If the request is directly uploaded into data target with the selection in the processing tab Data target only
We don’t find the icon in application toolbar (Request Reverse Posting)

What to do?

This is one of the procedures which can be followed:

From the ODS the change log table should be used in creating the data source in BW with the selection Request.
Appl comp DM






Once the data source is created by using the T.Code RSO2—Data base view
Using change log table name./ bic /b followed by 10digit no.

Use my self source system (BW )

The data source is mapped to the data target using PSA.
In doing so the fields that are present in the ODS should be present in the data source
Except like Request ID , data packet ID ,part no ,record.

Where it should meet the original update rules to that of ODS



In doing so the communication structure will match to the ODS

In up date rules we write an Source code  to inverse the data in the fields while updating into the Cube.

 Source Code:
UPDATE ROUTINE FOR THE INVERSION OF FIELDS:

PROGRAM UPDATE_ROUTINE.
*$*$ begin of global - insert your declaration only below this line  *-*
* TABLES: ...
* DATA:   ...
*$*$ end of global - insert your declaration only before this line   *-*


FORM compute_data_field
  TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
  USING    COMM_STRUCTURE LIKE /BIC/CSRIC_O04_CL_DATA
           RECORD_NO LIKE SY-TABIX
           RECORD_ALL LIKE SY-TABIX
           SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
  CHANGING RESULT LIKE /BIC/VRIC_C01T-/BIC/RRECVSVAL
           RETURNCODE LIKE SY-SUBRC
           ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
*
*$*$ begin of routine - insert your code only below this line        *-*



* fill the internal table "MONITOR", to make monitor entries

IF ( COMM_STRUCTURE-PROCESSKEY = '050'   "Sonstiger Zugang / Umbewertung
  OR COMM_STRUCTURE-PROCESSKEY = '051'   "Preisänderung + / Umbewertung
  OR COMM_STRUCTURE-PROCESSKEY = '052' ) "Rechnungsprüf. + / Umbewertung
  AND  COMM_STRUCTURE-BWAPPLNM EQ 'MM'.
    RESULT = ( -1 ) * ABS( COMM_STRUCTURE-CPPVLC ).
* if the returncode is not equal zero, the result will not be updated
    RETURNCODE = 0.
  ELSE.
  RESULT = ABS( COMM_STRUCTURE-CPPVLC ).
* if the returncode is not equal zero, the result will not be updated
    RETURNCODE = 0.
  ENDIF.
* if abort is not equal zero, the update process will be canceled
  ABORT = 0.

*$*$ end of routine - insert your code only before this line         *-*
*
ENDFORM.

The data will be posted with  Reverse Image into the cube.thus the duplicate records will be nullified.

0 comments: