Skip to Content

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

ABAP query help

hi folks,

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'.

else.

exit.

endif.

append rec.

endselect.

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.

Vinu

Tags:
Former Member
Former Member replied

Vinu,

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.

Regards,

Ravi

Note : Please close the thread if this solves the issue.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question