cancel
Showing results for 
Search instead for 
Did you mean: 

customer exit

Former Member
0 Kudos

Hi,

We have the requirement to use the two customer exits within the same query. The ABAP'er wrote the code for both at the same place in CMOD->ZXRSRU01->

Though the query variable is correctely passed, only one case(the first variable) is executing but not the second. For your reference I am copying the code here.

DATA: l_number_of_days TYPE i.

DATA: loc_var_range LIKE rrrangeexit.

DATA: L_S_RANGE TYPE RSR_S_RANGESID,

d1 type sy-datum,

d2 type sy-datum,

d3 type i.

CASE i_vnam. " Variablenname

when 'ZVAR_DAYSINMONTH'.

DATA: l_firstday LIKE SY-DATUM,

l_lastday LIKE SY-DATUM,

ws_year(4) type c,

ws_mth(2) type c.

clear : ws_year, ws_mth.

IF i_step = 2.

LOOP AT i_t_var_range INTO loc_var_range

WHERE vnam = '0I_DAYS'.

EXIT.

ENDLOOP.

ws_year = loc_var_range-low(4).

ws_mth = loc_var_range-low+4(2).

CONCATENATE ws_year ws_mth '01' INTO l_firstday.

CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'

EXPORTING

DAY_IN = l_firstday

IMPORTING

LAST_DAY_OF_MONTH = l_lastday.

l_number_of_days = l_lastday - l_firstday.

l_number_of_days = l_number_of_days + 1.

CLEAR l_s_range.

l_s_range-low = l_number_of_days .

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range to e_t_range.

ENDIF.

endcase.

CASE i_vnam. " Variablenname

when 'ZVAR_SDAYS'.

Read table i_t_var_range INTO loc_var_range With key vnam = '0I_DAYS'.

d3 = loc_var_range-high - loc_var_range-low.

d3 = d2 - d1.

l_s_range-low = d3 .

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range to e_t_range.

ENDCASE.

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

shanthi_bhaskar
Active Contributor
0 Kudos

DATA: l_number_of_days TYPE i.
DATA: loc_var_range LIKE rrrangeexit.
DATA: L_S_RANGE TYPE RSR_S_RANGESID,
d1 type sy-datum,
d2 type sy-datum,
d3 type i.

CASE i_vnam. " Variablenname
when 'ZVAR_DAYSINMONTH'.
DATA: l_firstday LIKE SY-DATUM,
l_lastday LIKE SY-DATUM,
ws_year(4) type c,
ws_mth(2) type c.
clear : ws_year, ws_mth.

IF i_step = 2.
LOOP AT i_t_var_range INTO loc_var_range
WHERE vnam = '0I_DAYS'.
EXIT.
ENDLOOP.

ws_year = loc_var_range-low(4).
ws_mth = loc_var_range-low+4(2).
CONCATENATE ws_year ws_mth '01' INTO l_firstday.
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
DAY_IN = l_firstday
IMPORTING
LAST_DAY_OF_MONTH = l_lastday.

l_number_of_days = l_lastday - l_firstday.
l_number_of_days = l_number_of_days + 1.

CLEAR l_s_range.
l_s_range-low = l_number_of_days .
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range to e_t_range.

ENDIF.
endcase.

IF I_STEP = 2, "Add this
CASE i_vnam. " Variablenname
when 'ZVAR_SDAYS'.
Read table i_t_var_range INTO loc_var_range With key vnam = '0I_DAYS'.
d3 = loc_var_range-high - loc_var_range-low.
d3 = d2 - d1.
l_s_range-low = d3 .
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range to e_t_range.
ENDCASE.
ENDIF. "Add this
Former Member
0 Kudos

Hi,

Please go thru the link. It will help you to understand:

http://help.sap.com/saphelp_bw320/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htm

Thanks,

Jitender

Former Member
0 Kudos

Thank you all and the points has been assigned to all.The solution was i_step=2 needs to be added before when statment.

Answers (2)

Answers (2)

Former Member
0 Kudos

even if you need different code on same variable .. there must be some distinction as to when to execute which code...

here specifying code in difference When will not work as only 1st occurance of when will always suffice the condition and second occurance will not get executed at all...

so you need to place both the pieces of code in single when... and bifurcate them based on the condition...

Regards,

Sharayu

former_member204514
Contributor
0 Kudos

Please mention i_step value for the second variable just after When statement.

Hope this helps,

Anil Kamsala