- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Using ABAP, changing a value in itab by getting data from database table
You should do this using a Modify statement as in below −
LOOP AT itab. SELECT SINGLE matnr INTO itab-matnr FROM zlldet WHERE palet = itab-palet. MODIFY itab. ENDLOOP.
Also note that when you have an internal table itab with a header line, it means that you have a table itab and structure itab and usage of this depends on the situation. Few of the commands like MODIFY and LOOP AT uses both at the same time.
DATA itab TYPE TABLE OF [something]. DATA wa TYPE [something]. LOOP AT itab INTO wa. " copies each line into wa SELECT SINGLE matnr INTO wa-matnr FROM zlldet WHERE palet = itab-palet. MODIFY itab FROM wa. " writes the changed line back to the table ENDLOOP.
Also, note the below points.
- You can also use field symbol instead of using MODIFY.
- To keep your code performance optimize, avoid using Select statement inside the loop. You should use range tables and use Select statement only before the loop.
- Finding a particular value in internal table itab in ABAP
- Retrieving data from a table in SAP ABAP
- Getting number of rows in table in an itab in SAP
- Sending an itab to SAP Spool using ABAP method
- Getting data in front-end tools from SAP HANA database
- In SAP ABAP, mapping two database table fields
- How can I update a field in a MySQL database table by adding a value in the second table with a value from the first table?
- Getting data from Vibration sensor using Arduino
- Changing storage type of table in SAP HANA database
- Select some data from a database table and insert into another table in the same database with MySQL
- IMPORTING, EXPORTING and CHANGING Keywords in ABAP
- Getting unauthorized exception in SAP ABAP
- How to get the table definition in a database from AWS Glue Data Catalog using Boto3
- Getting data from temperature and humidity sensor using Arduino
- How to drop a table from a database using JDBC API?