ABAP query help
I have a query that is giving me a Run time Error and reason is databse commit is being called before the databse selection is completed.
I understood the error but I do not know how to solve it.
select * from ZEDMSTR.
if sy-subrc = 0.
rec-businessunit = ZEDMSTR-ZBUSUNIT.
rec-tablename = ZEDMSTR-ZTABNAME.
rec-oldlegcode = ZEDMSTR-ZOLDLEGCODE.
rec-description = ZEDMSTR-ZDESCRIPTION.
rec-newlawsoncode = ZEDMSTR-ZNEWLAWCODE.
WRITE: ' tHE RECORDS GOT APPENDED INTO THE TABLE'.
The table ZEDMSTR HAS FIVE FIELDS (SAME NUMBER DECLARED FOR THE INTERNL TABLE 'REC') AND I HAVE TO PULL ALL THE RECORDS OF ALL THE FIELDS FROM THE TABLE INTO REC.
My question is how can I modify the select query to eliminate the runtime exception and without the use of select...endselect. because I shall be reading over 40,000 records from the query and it may raise a performance issue.
Thanks in advance for your help folks.
Ravikumar Allampallam replied
DATA : REC TYPE TABLE OF ZEDMSTR.
SELECT * FROM ZEDMSTR INTO CORRESPONDING FIELDS OF TABLE REC.
If you don't want to declare REC like that declare the way you want, but declare another table like the way I have done and loop at the table and move the records into REC table using a WORKAREA.
Note : Please close the thread if this solves the issue.