Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

delete from rssdlinit

Former Member
0 Likes
1,053

Hi, I wanna delete something from table rssdlinit. But I can't

In the Form I first read entries from the table. All found entries with the first selection shall be deleted via the rnr.

Somebody can say whats wrong with the delete statement?

FORM delete_init.

DATA: ls_rssdlinit like rssdlinit occurs 0 with header line.

DATA: lt_rssdlinit LIKE TABLE OF ls_rssdlinit.

select * from rssdlinit into CORRESPONDING FIELDS OF TABLE lt_rssdlinit WHERE

OLTPSOURCE = '8ZCCICA01' AND

LOGSYS = 'BDECLNT820'.

LOOP AT lt_rssdlinit into ls_rssdlinit.

DELETE FROM rssdlinit WHERE

RNR = ls_rssdlinit-rnr.

endloop.

endform.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
859

Probably because there is nothing selected at first. Try:

FORM delete_init.
  DATA: ls_rssdlinit LIKE rssdlinit OCCURS 0 WITH HEADER LINE.
  DATA: lt_rssdlinit LIKE TABLE OF ls_rssdlinit.
  SELECT * FROM rssdlinit
    INTO CORRESPONDING FIELDS OF TABLE lt_rssdlinit
    WHERE oltpsource = '8ZCCICA01' AND
          logsys = 'BDECLNT820'.

  IF sy-subrc = 0.
    LOOP AT lt_rssdlinit INTO ls_rssdlinit.
      DELETE FROM rssdlinit WHERE
      rnr = ls_rssdlinit-rnr.
    ENDLOOP.
  ELSE.
    WRITE : /001 'Nothing to delete'.
  ENDIF.

ENDFORM.                    "delete_init

Rob

5 REPLIES 5
Read only

Former Member
0 Likes
859

its an db table... maybe that helps?

Read only

Former Member
0 Likes
860

Probably because there is nothing selected at first. Try:

FORM delete_init.
  DATA: ls_rssdlinit LIKE rssdlinit OCCURS 0 WITH HEADER LINE.
  DATA: lt_rssdlinit LIKE TABLE OF ls_rssdlinit.
  SELECT * FROM rssdlinit
    INTO CORRESPONDING FIELDS OF TABLE lt_rssdlinit
    WHERE oltpsource = '8ZCCICA01' AND
          logsys = 'BDECLNT820'.

  IF sy-subrc = 0.
    LOOP AT lt_rssdlinit INTO ls_rssdlinit.
      DELETE FROM rssdlinit WHERE
      rnr = ls_rssdlinit-rnr.
    ENDLOOP.
  ELSE.
    WRITE : /001 'Nothing to delete'.
  ENDIF.

ENDFORM.                    "delete_init

Rob

Read only

Former Member
0 Likes
859

Hi Ezachiael,

pls always check the value of sy-subrc before loop...endloop ...


IF sy-subrc = 0.
loop at itab.
delete statement...
endloop.

ELSE.
message ...
ENDIF.

Thanks & Regards

ilesh 24x7

Read only

Former Member
0 Likes
859

data: lt_rssdlinit type table of rssdlinit with HEADER LINE.

select rnr from rssdlinit into CORRESPONDING FIELDS OF TABLE lt_rssdlinit where oltpsource = '8ZCCICA01' AND LOGSYS = 'BDECLNT820'.

loop at lt_rssdlinit.

delete from rssdlinit where rnr = lt_rssdlinit-rnr.

if sy-dbcnt ne 0.

write:/ lt_rssdlinit-rnr , ' Record deleted'.

endif.

endloop.

Read only

0 Likes
859

Thanks for your hints. But it does not help.

sy-dbcnt is 1 and subrc is 0. So it seems that everything works fine.

looking in se11 rssdlinit, no records are deletet....

Is it possible that the table is blocked or s.th. like that?