cancel
Showing results for 
Search instead for 
Did you mean: 

TABLE_INVALID_INDEX run time error

Former Member
0 Kudos
185

hi i am writing this code for loading data of last two months from r/3.It is not giving any syntax Error. but when i schedule the load it throws a run time error . can any one suggest how to correct this error.

data: l_idx like sy-tabix.

DATA: lv_calmonth LIKE /BI0/SCALMONTH-CALMONTH.

DATA: lv_day TYPE DATS.

"previous month

lv_day = SY-DATUM.

lv_day+6(2) = '01'.

lv_day = lv_day - 1.

lv_calmonth = lv_day(6).

READ TABLE l_t_range with key fieldname = 'CALMONTH'.

l_idx = sy-tabix.

MOVE lv_calmonth TO l_t_range-low.

MODIFY l_t_range INDEX l_idx.

"previous month - 1

lv_day+6(2) = '01'.

lv_day = lv_day - 1.

lv_calmonth = lv_day(6).

MOVE lv_calmonth TO l_t_range-low.

APPEND l_t_range.

p_subrc = 0.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

hi ,

I am getting following error can any one help me in solving this error.

Extractor only supports one time selection HR_BW_PY99

Errors in source system RSM

Former Member
0 Kudos

Hi, I have corrected the program but now it is again giving a error mesage in the monitor

Extractor only supports one time selection

I am using HR_PT_01 data source.

how can i rectify this

Former Member
0 Kudos

can you please post the whole piece of code.

Regards,

Atish

Former Member
0 Kudos

1. what is the structure of l_t_range?? Does it contain a field with name fieldname?

READ TABLE l_t_range with key fieldname = 'CALMONTH'.

<b>l_idx = sy-tabix.</b>

use READ TABLE you cannot get the SY-TABIX value

so the error comes when you use MODIFY where there is no value for l_idx.

try using workareas

READ TABLE l_t_range into wa_range with key fieldname = 'CALMONTH'.
MOVE lv_calmonth TO wa_range-low.
MODIFY l_t_range from wA_range.

Former Member
0 Kudos

Hi,

Try the code in BOLD.

data: l_idx like sy-tabix.

DATA: lv_calmonth LIKE /BI0/SCALMONTH-CALMONTH.

DATA: lv_day TYPE DATS.

"previous month

lv_day = SY-DATUM.

lv_day+6(2) = '01'.

lv_day = lv_day - 1.

lv_calmonth = lv_day(6).

READ TABLE l_t_range with key fieldname = 'CALMONTH'.

<b>if sy-subrc = 0.</b>

l_idx = sy-tabix.

MOVE lv_calmonth TO l_t_range-low.

MODIFY l_t_range INDEX l_idx.

<b>endif.</b>

"previous month - 1

lv_day+6(2) = '01'.

lv_day = lv_day - 1.

lv_calmonth = lv_day(6).

MOVE lv_calmonth TO l_t_range-low.

APPEND l_t_range.

p_subrc = 0.

Regards,

Atish

Former Member
0 Kudos

Do modify only if the READ was successful.

READ TABLE l_t_range with key fieldname = 'CALMONTH'.

IF sy-subrc IS INITIAL.

l_idx = sy-tabix.

MODIFY l_t_range INDEX l_idx.

ENDIF.

Hope this helps