Skip to Content
0
Former Member
Oct 14, 2014 at 11:44 AM

Issue in DTP Routine

371 Views

Hi Experts,

I have written a routine in DTP for filtering the records based on CALDAY, Below is the code which is used for calculating the last years first day and current years latest period last day. Code is working fine to populate the CALDAY with required dates, but it is throwing shortdump.

SELECT * FROM /bic/pzgpcvmper

INTO TABLE it_pcvmper

WHERE objvers = 'A'.

IF sy-subrc = 0.

READ TABLE it_pcvmper INTO wa_pcvmper

WITH KEY /bic/zgpcvmper = 'P1'. "Previous Year

IF sy-subrc = 0.

lv_p_first_day = wa_pcvmper-/bic/zpfirstdy.

lv_p_last_day = wa_pcvmper-/bic/zplastday.

ENDIF.


READ TABLE it_pcvmper INTO wa_pcvmper

WITH KEY /bic/zgpcvmper = 'P2'. "Current Year

IF sy-subrc = 0.

lv_c_first_day = wa_pcvmper-/bic/zpfirstdy.

lv_c_last_day = wa_pcvmper-/bic/zplastday.

ENDIF.

ENDIF.

READ TABLE l_t_range

WITH KEY fieldname = i_fieldnm. "'CALDAY'.

l_idx = sy-tabix.

l_t_range-sign = 'I'.

l_t_range-iobjnm = '0CALDAY'.

l_t_range-fieldname = 'CALDAY'.

l_t_range-option = 'BT'.

l_t_range-low = lv_p_first_day.

l_t_range-high = lv_c_last_day.


IF l_idx <> 0.

MODIFY l_t_range INDEX l_idx.

ELSE.

l_t_range-fieldname = 'CALDAY'.

APPEND l_t_range.

ENDIF.

p_subrc = 0.

When i trigger the DTP in Debug mode i am getting below dump which is related to Table Index Issue. And below is the short dump,

Category ABAP Programming Error

Runtime Errors TABLE_INVALID_INDEX

ABAP Program GP00O2SNJ0T4TH4P5HDP3Z303GL

Application Component Not Assigned

Date and Time 14.10.2014 19:15:45

Error analysis
When changing or deleting one or more lines of the internal table
"\PROGRAM=GP00O2SNJ0T4TH4P5HDP3Z303GL\DATA=G_T_SELFIELDS" or when inserting in
the table "\PROGRAM=GP00O2SNJ0T4TH4P5HDP3Z303GL\DATA=G_T_SELFIELDS", 0 was
used as
the line index. An index less than or equal to zero is not
allowed.

The error can occur when using the following options:
1. "INDEX idx" for specifying the line number in the table
"\PROGRAM=GP00O2SNJ0T4TH4P5HDP3Z303GL\DATA=G_T_SELFIELDS"
where you want to change, insert or delete.
2. "FROM idx" for specifying the start index when deleting a line
area from or inserting a line area into the table
"\PROGRAM=GP00O2SNJ0T4TH4P5HDP3Z303GL\DATA=G_T_SELFIELDS".
3. "TO idx" for specifying the end index when deleting a line
area from or inserting a line area into the table
"\PROGRAM=GP00O2SNJ0T4TH4P5HDP3Z303GL\DATA=G_T_SELFIELDS".

At the time of the interruption the table contained 75 lines.

Can any one help me in sorting the above mentioned issue,

Thanks,

Ramana Tarapatla

Message was edited by: Ramana Prasad Tarapatla