
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Change Value in ITAB Using Database Table in ABAP
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.
Advertisements