cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Customer exit variable

Former Member
0 Kudos
132

Hi Guys,

I need your urgent help. I have a requirement where I need to create a variable (on CALDAY) in a report which should use the input value given for another variable (created on CALMONTH). To put in words more clearly, CALMONTH is a variable that is mandatory for input but the CALDAY variable should not appear on the selection screen. I was told that I should write a customer exit to make this happen. So can someone please explain me the process of creating a customer exit and give me the code.

WHEN CALMONTH values are selected to be 07/2006 - 08/2006... CALDAY values should be 07/01/2006 to 08/31/2006.

CALMONTH is user entry, mandatory, range and multiple selection variable.

Early reply is highly appreciated and duely rewarded. Please let me know if I am not clear about the requirement. Thanks a bunch in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Let us say, user enters multiple ranges for the month, you would want corresponding date ranges for the same, right?



data : w_date like sy-datum.


case I_VNAM. 
when 'ZCALDAY'. " Calday var 
loop at i_t_var_range into LOC_VAR_RANGE          
     where iobjnm = 'ZCALMONTH'. 
  WA_RANGE-SIGN = 'I'.      
  wa_date+2(6) = loc_var_Range-low.
  wa_date+0(2) = '01'.
  wa_range-low = wa_date.
  if loc_var_range-high eq space.
    WA_RANGE-OPT = 'EQ'.      
  else.
    wa_range-opt = 'BT'.
    wa_date+2(6) = loc_var_range-high.
    wa_date+0(2) = '01'.
    wa_date = wa_date + 31.
    wa_date+0(2) = '01'.
    wa_date = wa_date - 1.
    wa_range-high = wa_date.
   endif.
   append wa_range to e_t_range. clear wa_range.
endloop.

endcase.

This should do.

Former Member
0 Kudos

Hi Ajay -

Users may enter just one month, or a range or multiple values. Will this code work for all these cases. Also can you please tell me where to insert this code...

Former Member
0 Kudos

It should work for all.

This needs to be added to the user-exit for variables. For an example of user-exit implementation, see the document https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/462fe790-0201-0010-3ca4-adf...

It is for something else, only part relevant for you is where the document talks of implementing variable exit RSR00001 (page 10 on)

But, do verify what AHP has said. It should select all the days of the month, if you just specify the month(s).

Former Member
0 Kudos

Hi Ajay -

Thanks for the reply. I have one last question. I am new to ABAP so wanted to confirm that the code you have given would take care of the fact that feb has only 28 days, some months have 30 days and the others 31 days ?? Please let me know.

Former Member
0 Kudos

Yes, it would.

Answers (1)

Answers (1)

edwin_harpino
Active Contributor
0 Kudos

hi Joseph,

how are you doing ?

think you have no need to write variable exit for this,

you can include 0calday in your query, and it should automatically have values accordingly.

anyway, please provide your email, will send you how to derive variable doc.

hope this helps.

Former Member
0 Kudos

Hi A.H.P -

Thanks for such an early reply. My email id is jsmith_bw@yahoo.com. Please send me the documents.

Ajay -

Thanks a lot for the code. Shall try it out.

Former Member
0 Kudos

For more clarification...CALDAY and CALMONTH are totally different info objects. For ease of understanding I have used those names to explain that one variable is created on a date field and the other on a month.