Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Hi everyone

i need to delete a record from an internal table comparing multiple fields .

Please let me know the syntax.

any help would be greatly appreciated.

Thanks in advance

suchitra

Tags:
Former Member
replied

Yep, you can do that. Here is a short sample program.


report zrich_0001 .

data: begin of itab occurs 0,
      matnr type mara-matnr,
      mtart type mara-mtart,
      mbrsh type mara-mbrsh,
      end of itab.
data: xt134 type t134.
data: xt137 type t137.

* Get some data for the ITAB
select matnr mtart mbrsh into table itab
       from mara up to 1000 rows.


* Get the value from the db that you want do filter on
select single * into xt134 from t134
       where mtart = 'ZROH'.

* Get the value from the db that you want do filter on
select single * into xt137 from t137
       where mbrsh = 'M'.



* Now delete the records accordingly.
delete itab where mtart = xt134-mtart
              and mbrsh = xt137-mbrsh.


* Of course you can do this too.
*delete itab where mtart = 'ZROH'
*              and mbrsh = 'M'.


check sy-subrc  = 0.


Regards,

Rich Heilman

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question