cancel
Showing results for 
Search instead for 
Did you mean: 

I need to load 2 years of data dynamically

Former Member
0 Kudos

I have fiscal period in my selection tab of infopackage. I am looking for the abap routine which would help me in achieving this selection condition. I am new to ABAP language so any help with abap code is appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

In the info package selection for FISCPER field,

select ABAP Routine type Variable and write the below code.

Note: I have not tested this code. there may be minor cahnges to this code required.

DATA:   fiscper TYPE rsfiscper,
        v_fiscper_cur TYPE rsfiscper,  ' to determine current fiscper
        v_fiscper_from TYPE rsfiscper, ' to determine from which fiscper you want to load
        v_year TYPE rsfiscyear,
        v_year_from TYPE rsfiscyear,
        


CALL FUNCTION 'RSARCH_DATE_CONVERT'
    EXPORTING
      i_date      = sy-datlo
      i_fiscvarnt = 'Z1'    ' Here give your FISCVARNT
    IMPORTING
      e_fiscper   = v_fiscper_cur
      e_fiscyear  = v_year.


  v_fiscper_from = v_fiscper_cur - 24.

  data: l_idx like sy-tabix.
  read table l_t_range with key
       fieldname = 'FISCPER'.
  l_idx = sy-tabix.

  l_t_range-low = v_fiscper_from.
  l_t_range-high = v_fiscper_cur.
  l_t_range-option = 'BT'.

  modify l_t_range index l_idx.

  p_subrc = 0.

Good luck

Cheers

Praveen