cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in DTP Routine

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

FloS
Discoverer
0 Kudos

Hi Ramana,

could you solve the problem?

What is the cause for the dump?

Best Regards

Florian

Former Member
0 Kudos

Hi Ramana,

There is a issue in your code. I have corrected the code. Please let me know if this solves.

Thanks

Amit

  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.

READ TABLE l_t_range

    WITH KEY fieldname = i_fieldnm"'CALDAY'.

  l_idx = sy-tabix.

IF sy-subrc EQ 0.

  IF l_idx <> 0.

    MODIFY l_t_range INDEX sy-tabix l_idx.

  ELSE.

    l_t_range-fieldname = 'CALDAY'.

    APPEND l_t_range.

  ENDIF.

  p_subrc = 0.

Former Member
0 Kudos

Hi Amit,

Thanks for your response.

I have tried the options mentioned by you, but still it is not working in debugging mode.

When i executed the DTP directly without any debug mode it is working fine as expected. But when i tried to debug the DTP Routine or expert routine, it is going to dump.

Please suggest..

Thanks,

Ramana Tarapatla

0 Kudos

Hi,

as per shortdump, the below line of code is  giving short dump.

MODIFY l_t_range INDEX l_idx.

Please check once again, above line of code working correctly or not.

Regards,
Nagaraju K