cancel
Showing results for 
Search instead for 
Did you mean: 

BEx: User exit for key date

Former Member
0 Kudos

Hi experts

We need to calculate the key date of a query feeded by a variable on 0CALMONTH.

But the coding below doesn't fill up the keydate.

Any ideas?

The coding:

WHEN 'ZKEY_DATE_001'.

    DATA: range_low_key_001 type d,
          key_002 type c,
          key_003 type d.

    IF I_STEP = 2.
      LOOP AT i_t_var_range INTO loc_var_range WHERE VNAM = 'ZCALMONTH_EV_001'.
        clear l_s_range.
        key_002 = loc_var_range-low + 1.
        concatenate key_002  '01' into range_low_key_001.
        key_003 = range_low_key_001 - 1.

        l_s_range-low = key_003.
        l_s_range-sign = 'I'.
        l_s_range-opt = 'EQ'.
        APPEND l_s_range TO e_t_range.
      ENDLOOP.
    ENDIF.

Accepted Solutions (1)

Accepted Solutions (1)

Loed
Active Contributor
0 Kudos

Hi Thomas,

Sorry did not understand your requirement..What do you want to do?

Perhaps the problem lies in this part of code? What do you want to with that code? If you have 201506 for June 2015, the code will just give you the 01506, excluding the "2" in front..

key_002 = loc_var_range-low + 1.

Regards,

Loed

Former Member
0 Kudos

Hi Loed

CALMONTH: 201406

keydate: 20140630

Loed
Active Contributor
0 Kudos

Hi Thomas,

Do this:

WHEN 'ZKEY_DATE_001'.

     DATA: range_low_key_001 type d,
           key_002 type d.

     IF I_STEP = 2.
       LOOP AT i_t_var_range INTO loc_var_range WHERE VNAM = 'ZCALMONTH_EV_001'.
         clear l_s_range.
        
         CONCATENATE loc_var_range-low(6) '01' into range_low_key_001.
        
         CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
   EXPORTING
     day_in                  = range_low_key_001
  IMPORTING
    LAST_DAY_OF_MONTH       = key_002
  EXCEPTIONS
    DAY_IN_NOT_VALID        = 1
    OTHERS                  = 2.

         l_s_range-low = key_002.
         l_s_range-sign = 'I'.
         l_s_range-opt = 'EQ'.
         APPEND l_s_range TO e_t_range.
       ENDLOOP.
     ENDIF.

Regards,

Loed

Answers (0)