Skip to Content
0
Feb 08, 2019 at 12:45 AM

AO hierarchy node variables customer exit issue

80 Views

Hi,

I have a requirement to write a variable exit for hierarchy node variable. When I run the query in RSRT , the variable exit is working as expected . But when i execute the query using AO , i am getting the error error-message.jpg . I think this is due to the code below in the exit. Ao is unable to interpret l_s_range-high = '0HRPOSITION'. value for the variable. Any help is approciated.

l_s_range-low = lv_hrposition.
l_s_range-high = '0HRPOSITION'.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.

APPEND l_s_range TO c_t_range.

here is the complete code:

method IF_RSROA_VARIABLES_EXIT_BADI~PROCESS.

DATA: l_v_range TYPE rrrangeexit,
l_s_range TYPE rrrangesid,
lv_uname TYPE sy-uname,
lv_stdate TYPE sy-datum,
lv_eddate TYPE sy-datum,
lv_cmonth TYPE /bi0/oicalmonth,
lv_hrposition TYPE /bi0/oihrposition.

TYPES : begin of ty_emp,
employee type /bi0/oiemployee,
objvers type rsobjvers,
dateto type /bi0/oidateto,
datefrom type /bi0/oidatefrom,
username type /bi0/oiusername,
hrposition type /bi0/oihrposition,
end of ty_emp ,

begin of ty_hrp,
hrposition type /bi0/oihrposition,
objvers type rsobjvers,
dateto type /bi0/oidateto,
datefrom type /bi0/oidatefrom,
end of ty_hrp.

field-symbols:
<emp> type ty_emp,
<hrp> type ty_hrp.

DATA: lt_emp TYPE STANDARD TABLE OF ty_emp,
lt_hrp TYPE STANDARD TABLE OF ty_hrp.

CASE i_vnam.

* seudunur - 02/05/2019
*When the report is executed , based on the user who exectured the report, code will retrieve the position details. User will either enter calendarmonth or date range.
WHEN 'ZGCAMV'.

lv_uname = 'SMUSSER'. "sy-uname.
select employee objvers dateto datefrom username hrposition
from /bi0/qemployee
into table lt_emp
where username = lv_uname and
objvers = 'A'.
if sy-subrc = 0.
sort lt_emp by employee dateto descending.
delete adjacent duplicates from lt_emp comparing employee hrposition.
endif.

select hrposition objvers dateto datefrom
from /bi0/qhrposition
into table lt_hrp
for all entries in lt_emp
where hrposition = lt_emp-hrposition and
objvers = 'A'.
if sy-subrc = 0.
sort lt_hrp by hrposition dateto ascending.
endif.


IF i_step = 2.

CLEAR:l_s_range,lv_stdate,lv_eddate,lv_cmonth,lv_hrposition .

* if the user enter date range , code will need to check hrposition dates with user entered dates.
READ TABLE i_t_var_range INTO l_v_range WITH KEY vnam = 'ZGVCMOI_CALDAY'.
if sy-subrc = 0.
lv_stdate = l_v_range-low.
lv_eddate = l_v_range-high.
endif.
*if user enter calendar Month , we need to get first and last day of the month
clear: lv_cmonth.
READ TABLE i_t_var_range INTO l_v_range WITH KEY vnam = 'ZGVCCOV_CALMON'.
if sy-subrc = 0.
lv_cmonth = l_v_range-low.

CONCATENATE lv_cmonth(4) lv_cmonth+4(2) '01' into lv_stdate.

CALL FUNCTION 'SN_LAST_DAY_OF_MONTH'
EXPORTING
DAY_IN = lv_stdate
IMPORTING
END_OF_MONTH = lv_eddate.
endif.

* an employee can have multiple postitions and each position may have different validity dates.
loop at lt_emp assigning <emp>.
loop at lt_hrp assigning <hrp>
where hrposition = <emp>-hrposition.
if <hrp>-datefrom LE lv_stdate and
<hrp>-dateto GE lv_eddate.
lv_hrposition = <hrp>-hrposition.
endif.
endloop.
endloop.
* if user entered date range is unable to identify position , fill with latest position.
if lv_hrposition is initial.
read table lt_emp assigning <emp> with key dateto = '99993112'.
lv_hrposition = <emp>-hrposition.
endif.

l_s_range-low = lv_hrposition.
l_s_range-high = '0HRPOSITION'.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.

APPEND l_s_range TO c_t_range.

refresh : lt_emp,lt_hrp.

ENDIF.

ENDCASE.

endmethod.

Attachments

error-message.jpg (35.9 kB)