cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Key date variable based on posting date

Former Member
0 Likes
1,956

I have a requirement to create a key date variable based on posting date so that user can input key date and return values based on this logic

PSTNG_DATE <= "Key Date"  AND CLEAR_DATE >= "Key Date" ) OR ( PSTNG_DATE <= "Key Date" AND CLEAR_DATE = '00000000'  ) .

The Bex Query definitions looks like this

The key date variable is supposed to do something like this dynamicly using customer exit.  User is supposed to enter "Key date" and the customer exit is supposed to apply the input date to both "Posting date" and "Clearing date" using the same conditions as below.

I have implemented the code below but the result only gives me results where key date equals user input date.  It is not pulling in records less than user input date according to the code.  What am I missing?

CASE i_vnam.

*IF I_STEP <> 2.

*RAISE no_processing.

*ENDIF.

   WHEN 'ZVAR_PSTNG_ZP_KEYDT'.

     IF i_step = 2.

       CLEAR l_s_range.

       READ TABLE i_t_var_range INTO loc_val_range WITH KEY vnam = 'ZP_KEYDT'.

       IF sy-subrc = 0.

         l_s_range-sign = 'I'.

         l_s_range-opt  = 'LE'.

         l_s_range-low  = loc_val_range-low.

         APPEND l_s_range TO e_t_range.

       ENDIF.

     ENDIF.

   WHEN 'ZVAR_CLRDT_ZP_KEYDT'.

     IF i_step = 2.

       CLEAR l_s_range.

       READ TABLE i_t_var_range INTO loc_val_range WITH KEY vnam = 'ZP_KEYDT'.

       IF sy-subrc = 0.

         l_s_range-sign = 'I'.

         l_s_range-opt  = 'GT'.

         l_s_range-low  = loc_val_range-low.

         APPEND l_s_range TO e_t_range.

         CLEAR l_s_range.

         l_s_range-sign = 'I'.

         l_s_range-opt  = 'EQ'.

         l_s_range-low  = '#'.

         APPEND l_s_range TO e_t_range.

       ENDIF.

     ENDIF.

ENDCASE.

Accepted Solutions (1)

Accepted Solutions (1)

sriramvijay_ravidoss
Contributor
0 Likes

Hi,

You have Input date n Default values. This will restrict entire report to that date only.

To achieve your requirement create a dummy selection in columns and put your input ready variable inside it. this dummy you are going to hide. by doing this you have moved the variable " ZP_KEYDT into column level(hidden) and not at the global level(Default values pane).

All other varibles you have used in characteristic restriction, (i.e) ZVAR_*(not input ready) in your case will be calculated from Customer exit and applied at global level. This will bring you the records restricted in ranges(<= or >=) on Dates.

-Sriram

Answers (1)

Answers (1)

former_member186399
Active Contributor
0 Likes


Hello Mark,

You will have to define the query accordingly to get the data. I don't see any issue with customer variable. Can you follow the below link and try to use the variable and characteristics as mentioned in that.

http://scn.sap.com/community/data-warehousing/bw/blog/2014/03/16/accounts-receivables-a-walk-through...

Regards

Gajesh