cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed in Abap

Former Member
0 Kudos

Hi all;

I am trying to delete the request from cube except the last load of the month(we have daily load now so assume that last day of the month) of the fiscal period. I am writing the following code in the delete routine, but can't figure out how to avoid the lastday of the month in fiscal period.

Could anyone help me!


TABLES: RSMONICDP.
DATA:  request LIKE RSMONICDP-RNR,
ts LIKE RSMONICDP-TIMESTAMP.
   
 loop at l_t_request_to_delete.

        SELECT DISTINCT RNR INTO request FROM RSMONICDP
               WHERE ICUBE = 'Zdis_c01'.
               SELECT TIMESTAMP INTO ts FROM RSMONICDP
               WHERE RNR = request.
               ENDSELECT.
    (how do I avoid the last day of the month here ?)

        CALL FUNCTION 'RSSM_DELETE_REQUEST'
        EXPORTING REQUEST = request
        INFOCUBE = 'Zdis_c01'.
        ENDSELECT.

  endloop.

     clear p_subrc.

Thank you.

Krishma.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Krishma,

Table RSMONICDP has field TIMESTAMP. I think you can use this time stamp, convert it into a date, and from there you can use an IF statement to avoid executing the CALL FUNCTION MODULE unless day of obtained date is not month's last day (I would use a CASE statement by month for example). Here you are how the routine would look like:

STATICS: l_time TYPE sy-uzeit,

l_date TYPE sy-datum,

l_month(2) TYPE N,

l_day(2) TYPE N.

loop at l_t_request_to_delete.

SELECT DISTINCT .....

CONVERT TIME STAMP RSMONICDP-TIMESTAMP

TIME ZONE 'UTC+12' "your time zone

INTO DATE l_date

TIME l_time.

L_MONTH = L_DATE+4(2).

L_DAY = L_DATE+6(2).

clear l_delete.

CASE l_month.

WHEN 1.

IF l_day < 31. l_delete = 1. ENDIF.

WHEN 2.

  • implement something for leap year here

IF l_day < 29. l_delete = 1. ENDIF.

...

WHEN 12.

IF l_day < 31. l_delete = 1. ENDIF.

ENDCASE.

IF l_delete = 1.

CALL FUNCTION ....

ENDIF.

ENDLOOP.

Hope it helps!

Mario.