Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

User exit variable code- strange behavior

Hi Guys,

In the customer exit code for Fiscal week, I have written a code as below. However Could you please tell me what value should I use in 'VNAM' field in the below Loop statement.

I am creating a customer exit variable on characteristic 'ZFISCWEEK'. I think in the below loop statement, I am supposed to use 'ZFISCWEEK' for VNAM? but the I am getting null values in the BEx report.

But if I use '0DAT' in place of 'ZFISCWEEK' for VNAM below in the code.. it's working perfect . Isn't it strange? or am I wrong? We are on BW 7.4 version. Any comments will be appreciated.

WHEN 'ZFISCWEEK'.

     IF i_step = 2.

_ _ _ _

_ _ _ _


LOOP AT  i_t_var_range INTO  loc_var_range  WHERE  vnam = '0DAT'.

       loc_var_range-low = C_week.

       l_s_range-low = loc_var_range-low.

       l_s_range-sign    = 'I'.

       l_s_range-opt      = 'EQ'.

    APPEND l_s_range  TO  e_t_range.

EXIT.

ENDLOOP.


ENDIF.

ENDCASE.

Tags:
Former Member
Former Member replied

Hi Ricky,

I understand that you are not an ABAPer so let me explain this to you.

'i_t_var_range' is an internal table which carries values and names of the variables that you are currently running. If your customer exit value depends on any of the values in those variables then and then only you need to read this table with variable name that you want to use.

e.g. Derive Age from Date of birth. When user enters the date of birth the selection screen and executes the query, the customer exit code (I_step = 2) will start executing. as the Age calculation depends on the Date of birth enetered by the user, we will need to read it from table  'i_t_var_range'. we DON'T NEED to read this table if our customer exit code is independent of values in the other variables of the query being executed.

as per me, all your code is correct. Only in the last 10 statements you need below change, because you do not need to read any variable value.

Current Code:

CONCATENATE year weeks INTO C_week.

LOOP AT  i_t_var_range INTO  loc_var_range  WHERE  vnam = '0DAT'.

       loc_var_range-low = C_week.

       l_s_range-low = loc_var_range-low.

       l_s_range-sign    = 'I'.

       l_s_range-opt      = 'EQ'.

    APPEND l_s_range  TO  e_t_range.

EXIT.

ENDLOOP.

ENDIF.


Correct code:



CONCATENATE year weeks INTO C_week.

 

       l_s_range-low = C_week.

       l_s_range-sign    = 'I'.

       l_s_range-opt      = 'EQ'.

    APPEND l_s_range  TO  e_t_range.

EXIT.

ENDLOOP.

ENDIF.


Please let me know if you face any issues.


-Swati.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question