cancel
Showing results for 
Search instead for 
Did you mean: 

BEx Variable > 0CALMONT - Derive range - How to?

kern_pascal
Explorer
0 Kudos

Hi,

In data-model I have 0CALMONTH. Dependent of system date the result of Exit should be range from first month of year - last month of current year + 2.

1. Example: Sys. Date: 27th of August 2015: Result: 01.2015 - 12.2017

2. Example: Sys. Date: 03rd of March 2016: Result: 01.2016 - 12.2018

Can s.b. provide code sample for function module. Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Loed
Active Contributor
0 Kudos

Hi,

Create a variable to your 0CALMONTH with CUSTOMER EXIT as its processing by and has an INTERVAL option, let's call your variable VAR_RANGE..

Do this in CMOD:

data: zstart(6) type c,

          zend(6) type c,

          zyear(4) type c.

   WHEN 'VAR_RANGE'.                    

      zyear = sy-datum(4) + 2.

     

     concatenate sy-datum(4) '01' into zstart.

     concatenate zyear '12' into zend.

         L_S_RANGE-LOW      = zstart.  

         L_S_RANGE-HIGH      = zend.  

         L_S_RANGE-SIGN        = 'I'.

         L_S_RANGE-OPT         = 'BT'.

         APPEND L_S_RANGE TO E_T_RANGE.

         EXIT.

       ENDLOOP.

     endif.

Regards,

Loed