Downtime Announcement: Please note the SAP Community Wiki will be unavailable due to a system upgrade on Thursday, September 24th between 6 and 7 AM CEST
Child pages
  • To delete the Data load request except the latest data load in SAP BW
Skip to end of metadata
Go to start of metadata

I would like to share a interesting scenario where we are having full data loads (Planning Data) in the infocube on daily basis and our requirement was that the cube should have the latest data load request only and rest should be deleted.

In the standard BI7.0 Package, we have the functionality to delete the overlapping requests in the process chain. 

The above functionality does not work because in our scenario we were populating  cal/month dynamically in DTP. In the start of a month, month gets populated in the DTP which is different from the last day month/year. For Example Take a case today the date is 31st Jan 2010 so the calmonth/year which gets populated in the DTP would be 012010 and the very next day it would be 022010 as the month gets changed from Jan to Feb and the same problem will come when there would be change in the year then both the month and year would be changed.

This was the problem which we were facing due to this the selection conditions does not remains overlapping and we were getting two requests instead of one which needs to deleted manually.

The second constraint was that they dont want older data in the cube, so we can not keep the older data and we just require current month data in the cube (Data related to planning).

To overcome the above problem we have written the following code in which we are taking all the requests from the cube with reference to the DTP. We are passing the request number and Infocube technical name to the function module RRSM_DELETE_REQUEST and catching all the exceptions for the process chain.

*Selection Screen**

SELECTION-SCREEN BEGIN OF BLOCK 001 WITH FRAME TITLE text-001.
parameters: InfoCube(30) TYPE C OBLIGATORY,
          : DTP TYPE STRING OBLIGATORY.
SELECTION-SCREEN END OF BLOCK 001.

TYPES t_rsicount like rsiccont.
data  : i_rsicount TYPE STANDARD TABLE OF t_rsicount,
      : wa_rsicount like LINE OF i_rsicount,
      : req type rsiccont-rnr,
      : cnt type i.

TYPES: BEGIN OF tab,
       request type rsiccont-rnr,
       end of tab.

DATA: i_tab type STANDARD TABLE OF tab,
    :  wa_tab like LINE OF i_tab.

*****All requests for the Cube into internal Table.****

select *
from RSICCONT
into table i_rsicount
where ICUBE = Infocube
ORDER BY Timestamp DESCENDING.

*****Filter on all the request as per the DTP on the selection screen.******

loop at i_rsicount INTO wa_rsicount.

  select rnr into wa_tab
  from RSREQDONE
  where
  rnr = wa_rsicount-rnr and
  LOGDPID = DTP.

  ENDSELECT.

  if sy-subrc eq 0.

    wa_tab-request = wa_rsicount-rnr.

    APPEND wa_tab-request to i_tab.

  ENDIF.

ENDLOOP.

DESCRIBE table i_tab lines cnt.

if cnt > 1.

clear wa_tab.

*****Request Deletion leaving latest request.******

Loop at i_tab INTO wa_tab.

If sy-tabix ne 1.

    if sy-subrc = 0.

      req = wa_tab-request.

      CALL FUNCTION 'RSSM_DELETE_REQUEST'
        EXPORTING
          REQUEST                    = req
          INFOCUBE                   = InfoCube
        EXCEPTIONS
          REQUEST_NOT_IN_CUBE        = 1
          INFOCUBE_NOT_FOUND         = 2
          REQUEST_ALREADY_AGGREGATED = 3
          REQUEST_ALREADY_COMDENSED  = 4
          NO_ENQUEUE_POSSIBLE        = 5
          CUBE_IN_PLANNING_MODE      = 6.

*****Reading the exceptions from the function module.************

      CASE SY-SUBRC .

        WHEN 0.
        MESSAGE s051(rsar) WITH 'Successfully Done'.

        WHEN 1.
        MESSAGE e051(rsar) WITH 'REQUEST_NOT_IN_CUBE'.
        EXIT.

        WHEN 2.
        MESSAGE e051(rsar) WITH 'INFOCUBE_NOT_FOUND'.
        EXIT.

        WHEN 3.
        MESSAGE e051(rsar) WITH 'REQUEST_ALREADY_AGGREGATED'.
        EXIT.

        WHEN 4.
        MESSAGE e051(rsar) WITH 'REQUEST_ALREADY_COMDENSED'.
        EXIT.

        WHEN 5.
        MESSAGE e051(rsar) WITH 'NO_ENQUEUE_POSSIBLE'.
        EXIT.

        WHEN 6.
        MESSAGE e051(rsar) WITH 'CUBE_IN_PLANNING_MODE'.
        EXIT.

      ENDCASE.

    ENDIF.

  ENDIF.

ENDLOOP.

else.

MESSAGE s051(rsar) WITH 'No Request Available for Deletion'.

ENDIF.  

Thanks & Regards

Arun Manocha

You can check the code in the wiki also at following link.....

*****http://wiki.sdn.sap.com/wiki/display/Snippets/To+delete+the+Data+load+request+except+the+latest+data+load+in+SAP+BW.*****\\*

2 Comments

  1. Unknown User (102kva0cz)

    If you just need the data from most recent request, why don't you delete the InfoCube contents before loading the recent request?

  2. Anonymous

    Hi Srinivas,

    I can not delete the cube as data is getting loaded from other sources/DTPs also.

    Rds