cancel
Showing results for 
Search instead for 
Did you mean: 

DTP Routine problem 0CALDAY

probledo
Participant
0 Kudos

Hi

Hi Could you please let me know where the problem in this code .This one is actually in routine used in DTP in 0CALDAY  field and I used the values related with the TVARV table.

This is the code:


DATA: w_datei TYPE d.

tables: tvarvc.

data: l_low(45).

BREAK-POINT.

read table l_t_range with key

      fieldname = '0CALDAY' .

  

select SINGLE low

        into l_low

        from tvarvc

        where name = 'ZIFRSCF_PRIORITARIOS_DEL_RESP'.

l_t_range-low = l_low.

w_datei = SY-DATUM - l_t_range-low.

l_t_range-low = w_datei.

modify l_t_range index l_idx.

However, when I execute the DTP I get an ABAP dump TABLE_INVALID_INDEX. Do you see anything wrong with the code?

Accepted Solutions (0)

Answers (1)

Answers (1)

ccc_ccc
Active Contributor
0 Kudos

Hi Pablo,

Correct as like below.

Read table l_t_range with key fieldname = 'CALDAY'.

l_t_range-sign = 'I'.

l_t_range-option = 'EQ' " BT-Between as per logic

l_t_range-fieldname = 'CALDAY'.

l_t_range-low = I_low

l_t_range-high = "fill to date.

modify l_t_range index l_idx.

Regards

Nanda

probledo
Participant
0 Kudos

Thank you very much, but the error still persists.

Regards.

ccc_ccc
Active Contributor
0 Kudos

Hi Pablo,

Try below code, it works me.

DATA : L_IDX LIKE SY-TABIX.

DATA: L_LOW(45.

READ TABLE L_T_RANGE WITH KEY FIELDNAME = 'CALDAY'.

IF SY-SUBRC EQ 0.

L_IDX = SY-TABIX.

ENDIF.

SELECT SINGLE LOW INTO L_LOW FROM TVARVC WHERE NAME = 'ZIFRSCF_PRIORITARIOS_DEL_RESP'."Check variable name

IF SY-SUBRC EQ 0.

L_T_RANGE-SIGN = 'I'.

L_T_RANGE-OPTION = 'EQ'.

L_T_RANGE-FIELDNAME = 'CALDAY'.

L_T_RANGE-LOW = L_LOW.

L_T_RANGE-HIGH = L-LOW

IF L_IDX <> 0.

MODIFY L_T_RANGE INDEX L_IDX.

ELSE.

APPEND L_T_RANGE.

ENDIF.

ENDIF.

P_SUBRC = 0.

Regards

Nanda