cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP routine for current calmonth based on system date in DTP ?

former_member182467
Participant
0 Kudos

Can you please update how do code abap routine in DTP filter to select calmonth based on system date ( sy-datum ) field ?

Can we do it with a formula or do we need a routine ? Can we achieve this in start routine ? Please advise.

thanks

DR

Accepted Solutions (1)

Accepted Solutions (1)

ccc_ccc
Active Contributor
0 Kudos

Hi Daniel,

You want extract data for current month?

If yes ,

Approach 1

Write routine at DTP level for 0CALMOTH InfoObject :

l_t_range-fieldname = 'CALMONTH'.

l_t_range-option = 'EQ'.

l_t_range-sign = 'I'.

l_t_range-low = SY-DATUM+0(6).

append l_t_range.

Approach 2


Write below code in Start Routine

Data: calmon type /BI0/OICALMONTH

clear: calmon.

calmon = sy-datum+0(6).

DELETE SOURCE_PACKAGE WHERE CALMONTH NE calmon.

Thank you,

Nanda

RafkeMagic
Active Contributor
0 Kudos

approach 2 implies you're selecting ALL data first and then removing what you don't need... sounds like a (potentially serious) waste of time to me

Answers (3)

Answers (3)

sumaghosh
Participant
0 Kudos

Thanks for the code. it solved my issue.

Loed
Active Contributor
0 Kudos

Hi,

Any of the methods suggested by Nanda and Sander will work..

Regards,

Loed

sander_vanwilligen
Active Contributor
0 Kudos

Hi,

The coding in the DTP filter routine for Time Characteristic 0CALMONTH should look like this:

DATA: l_s_rangeTYPE rssdlrange.

CLEAR l_s_range.

l_s_range-fieldname = i_fieldnm.

l_s_range-sign = rs_c_range_sign-including.
l_s_range-option= rs_c_range_opt-equal.
l_s_range-low  = sy-datum(6).

APPEND l_s_range TO l_t_range.

p_subrc = 0.

Best regards,

Sander