Skip to Content
avatar image
Former Member

BW - Delete Last Cube Request Routine

Hello experts.

I need to delete the last request in a infocube using a Process Chain Overlapping Request Deletion. I need a ABAP code to delete only the last loaded request. This request isn't necessary overlap, I just need a code to delete the last cube request.

Can you guys help me?

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 20, 2017 at 07:26 PM

    Hi Jeunon,

    Here is the code , to delete last request from infocube.

    1 Goto SE38 and create new program and copy below code

    2 Create variant with and provide infocube name

    3 In Process chain add "Execute ABAP program" process step and add program , variant

    4 Please test program thoroughly and use.

    Code

    DATA: T_ALL_REQS TYPE STANDARD TABLE OF MCH_S_PART,
    W_ALL_REQS TYPE MCH_S_PART,
    T_LAST_REQ TYPE STANDARD TABLE OF RSMPC_S_RNRLIST,
    W_LAST_REQ TYPE RSMPC_S_RNRLIST.


    DATA: JOBNAME TYPE BTCJOB.

    PARAMETERS: CUBENAME TYPE RSINFOCUBE OBLIGATORY.

    PERFORM GET_LAST_REQ_CUBE.
    PERFORM DEL_LAST_REQ.

    *--forms-----
    FORM GET_LAST_REQ_CUBE .
    CLEAR: T_ALL_REQS.

    CALL FUNCTION 'RSSM_ICUBE_REQUESTS_GET'
    EXPORTING
    I_INFOCUBE = CUBENAME
    * I_RSMDATASTATE_UPDATE = ' '
    * I_DATE_FROM = '00000000'
    * I_DATE_TO = '00000000'
    * I_WITHOUT_TEXTS = ' '
    IMPORTING
    E_T_REQUEST = T_ALL_REQS
    * EXCEPTIONS
    * WRONG_INFOCUBE = 1
    * INTERNAL_ERROR = 2
    * OTHERS = 3
    .
    IF SY-SUBRC <> 0.
    * Implement suitable error handling here
    ELSE.
    "Take only last reqeust.
    SORT T_ALL_REQS BY PARTNR ASCENDING.
    LOOP AT T_ALL_REQS INTO W_ALL_REQS.
    IF SY-TABIX EQ 1.
    W_LAST_REQ-RNR = W_ALL_REQS-RNR.
    APPEND W_LAST_REQ TO T_LAST_REQ.
    CONCATENATE CUBENAME '_' W_ALL_REQS-PARTNR '_' SY-DATUM INTO JOBNAME.
    ENDIF.

    ENDLOOP.
    ENDIF.

    ENDFORM.
    *&---------------------------------------------------------------------*
    *& Form DEL_LAST_REQ
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM DEL_LAST_REQ .

    CALL FUNCTION 'RSSM_PROCESS_REQUDEL_CUBE_PAR'
    EXPORTING
    I_INFOCUBE = CUBENAME
    I_T_REQUEST = T_LAST_REQ
    I_JOBNAME = JOBNAME
    * I_VARIANT =
    * I_INSTANCE =
    * IMPORTING
    * E_ERROR =
    * E_T_MSG =
    .
    IF SY-SUBRC EQ 0.
    LOOP AT T_LAST_REQ INTO W_LAST_REQ.
    WRITE: W_LAST_REQ-RNR.
    WRITE:'Request was deleted'.
    ENDLOOP.
    ENDIF.

    ENDFORM.

    Thank you,

    Nanda

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 25, 2017 at 02:28 PM

    Thank you very much Nanda, I will test the program and post the results.

    Add comment
    10|10000 characters needed characters exceeded