cancel
Showing results for 
Search instead for 
Did you mean: 

Selection Routine on DTP

Former Member
0 Kudos

Hi Guys,

I have a problem to upgrade an OSD-ODS selection routine to the new ABAP version embedded on an autoloop DTP that allow to update particular data in the same ODS.

TABLES: /bic/azgr_od8800.

  DATA: l_idx LIKE sy-tabix.

  break-point.
  READ TABLE l_t_range WITH KEY
       fieldname = 'NOTIFICATN'.
  l_idx = sy-tabix.
*....
  SELECT * FROM  /bic/azgr_od8800     WHERE
  ( /bic/zgr_ch158 = 'I0068' OR
    /bic/zgr_ch158 = 'I0070' OR
    /bic/zgr_ch158 = 'I0072' OR
    /bic/zgr_ch158 = 'I0073' )
  AND  /bic/zflag01 = '1'.
    MOVE 'I'                              TO l_t_range-sign.
    MOVE 'EQ'                             TO l_t_range-option.
    MOVE  /bic/azgr_od8800-notificatn     TO l_t_range-low.
    IF l_idx <> 0.
      MODIFY l_t_range INDEX l_idx.
    ELSE.
      APPEND l_t_range.
    ENDIF.
  ENDSELECT.

  SELECT * FROM  /bic/azgr_od8800     WHERE
  ( /bic/zgr_ch158 = 'I0068' OR
    /bic/zgr_ch158 = 'I0070' OR
    /bic/zgr_ch158 = 'I0072' OR
    /bic/zgr_ch158 = 'I0073' )
    AND ausbs = '00000000'.
    MOVE 'I'                              TO l_t_range-sign.
    MOVE 'EQ'                             TO l_t_range-option.
    MOVE  /bic/azgr_od8800-notificatn     TO l_t_range-low.
    IF l_idx <> 0.
      MODIFY l_t_range INDEX l_idx.
    ELSE.
      APPEND l_t_range.
    ENDIF.

  ENDSELECT.
  " IF l_idx <> 0.
  "  MODIFY l_t_range INDEX l_idx.
  "  ELSE.
  "    APPEND l_t_range.
  "  ENDIF.
  p_subrc = 0.

The problem is that the code works over all records processed NOT ONLY over the records with ausbs = '00000000' that I need change.

I tried to debug the code and I saw that the code select rightly the data, but lost the data in the end if the loop.

Can anybody help me?

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

sven_mader2
Active Contributor
0 Kudos

I have a problem with your code:

(1) you have two SELECT's. Witch one don't read with ausbs = '00000000'? the first one.

(2) In the second SELECT there is a condition. Is use problem the full table scan.

=> create a index for /bic/zgr_ch158 and ausbs.

(3) Don't use a SELECT-loop.

(4) Why you use MODIFY - do you want to create many conditions in L_T_RANGE?

=> use this coding

SELECT notificatn

into corresponding fields of table l_t_zgr_od8800

FROM /bic/azgr_od8800 WHERE

( /bic/zgr_ch158 = 'I0068' OR

/bic/zgr_ch158 = 'I0070' OR

/bic/zgr_ch158 = 'I0072' OR

/bic/zgr_ch158 = 'I0073' )

AND ausbs = '00000000'.

l_t_range-sign = 'I'.

l_t_range-option = 'EQ'.

loop at l_t_zgr_od8800 assigning <l_s_zgr_od8800>.

l_t_range-low-/bic/azgr_od8800-notificatn.

APPEND l_t_range.

endloop.

Sven

shanthi_bhaskar
Active Contributor
0 Kudos

IF l_idx 0.

MODIFY l_t_range INDEX l_idx.

ELSE.

APPEND l_t_range.

ENDIF.

instead of above please use

MODIFY l_t_range INDEX sy-tabix.