SAP Java / J2EE
Home > Ask the SAP Experts > Application development Questions & Answers > Deleting entries from a dynamic table
Ask The SAP Expert: Questions & Answers
EMAIL THIS

Deleting entries from a dynamic table

Matthew Billingham EXPERT RESPONSE FROM: Matthew Billingham

Pose a Question
Other SAP Categories
Meet all SAP Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 14 April 2008
I have dynamic internal table . I want to delete entries from this table on the basis of some condition. How do i do this?

>
EXPERT RESPONSE
Well, you can't use DELETE WHERE with dynamic tables, but it is still possible to delete records. Consider a situation where you want to delete all entries in where FIELD1 (one of the fields in the table) is equal to 'X'.

DATA. lp_data TYPE REF TO DATA.
FIELD-SYMBOLS:  TYPE ANY,
                TYPE ANY.

CREATE DATA lp_data LIKE LINE OF .
ASSIGN lp_data->* to .

ASSIGN COMPONENT 'FIELD1' OF STRUCTURE  TO .

LOOP AT  INTO .
  CHECK  EQ 'X'.
  DELETE TABLE  FROM .
ENDLOOP.

Another possibility is to use, for example, with a table that has key fields kf1 and kf2:
DELETE TABLE WITH TABLE KEY ('KF1') = val1 ('KF2') = val2.

With fully specified keys this is very efficient for HASHED tables, somewhat efficient for SORTED tables, and not very efficient, usually, for STANDARD tables.

As ever, what you actually write depends on precisely what you are trying to achieve.


Sound Off! -   


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Application development
Is there a 'load of program' option in report generation?
Defining a structure in a report
Validating table fields
The difference between field groups and internal tables
Unicode check error fix
Creating a screen for grid display
Migrating test programs from ECC 4.6 to 6.0
Creating a field exit for a data element
Methods for uploading SAP data
Error when reading XML files in SAP

SAP ABAP
Is this the quickest way to find a BADI?
ABAP Objects in SAP Workflow to provide improved performance
Easily debug error messages in SAP processes
Accessing private attributes in ABAP Objects
Is there a 'load of program' option in report generation?
Defining a structure in a report
How can ABAP developers survive in a NetWeaver era?
Validating table fields
The difference between field groups and internal tables
What SAP says about ABAP's future
SAP ABAP Research

SAP Front-ends
SAP exec discusses Imagineering, the future of development
Is there a 'load of program' option in report generation?
Defining a structure in a report
The stars of TechEd: SAP application demos
Error when reading XML files in SAP
A parameter with no record available
Interface a locally developed application with SAP
SAP Muse graphical interface could be next business browser
How do I add an Excel spreadsheet to a workflow?
SAP aims at ISVs with on-demand model

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
ABAP  (SearchSAP.com)
ABAP Objects  (SearchSAP.com)
ABAP Workbench  (SearchSAP.com)
BAPI  (SearchSAP.com)
CATT  (SearchSAP.com)
R/3 Repository  (SearchSAP.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsBlogsTipsAsk the ExpertsWebcastsWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2000 - 2008, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts