0% found this document useful (0 votes)
186 views1 page

Select EndSelect

1. Using SELECT-ENDSELECT loops can cause issues if statements within the loop trigger a database commit, such as CALL SCREEN or MESSAGE, as this will destroy the cursor and cause a runtime error. 2. Statements like CALL SCREEN, CALL DIALOG, CALL TRANSACTION are not allowed within SELECT-ENDSELECT loops because they automatically generate a database commit, destroying the cursor. 3. For processing data only once, a SELECT-ENDSELECT loop is preferable to collecting data in an internal table to avoid using more memory.

Uploaded by

Ram Praneeth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
186 views1 page

Select EndSelect

1. Using SELECT-ENDSELECT loops can cause issues if statements within the loop trigger a database commit, such as CALL SCREEN or MESSAGE, as this will destroy the cursor and cause a runtime error. 2. Statements like CALL SCREEN, CALL DIALOG, CALL TRANSACTION are not allowed within SELECT-ENDSELECT loops because they automatically generate a database commit, destroying the cursor. 3. For processing data only once, a SELECT-ENDSELECT loop is preferable to collecting data in an internal table to avoid using more memory.

Uploaded by

Ram Praneeth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Select Endselect has one major drawback, as anyone who's debugged a program with such a construct will
know... a commit work, such as the debugger does every now and then, will destroy the cursor of the
select/endselect, thereby triggering a short dump.

2. If one of the statements in a SELECT ... ENDSELECT loop results in a database commit, the cursor
belonging to the SELECT ... ENDSELECT loop is lost and the processing terminates with a runtime error.
Since each screen change automatically generates a database commit, statements such as CALL SCREEN ,
CALL DIALOG , CALL TRANSACTION or MESSAGE are not allowed within a SELECT ...
ENDSELECT loop.

3. If you process your data only once, use a SELECT-ENDSELECT loop instead of collecting data in an
internal table with SELECT ... INTO TABLE. Internal table handling takes up much more space.

4. If a SELECT - ENDSELECT loop contains a statement that triggers a database commit, the cursor
belonging to the loop is lost and a program termination and runtime error occur. Remote Function Calls and
changes of screen always lead to a database commit. The following statements are consequently not
allowed wihtin a SELECT-ENDSELECT loop: CALL FUNCTION ... STARTING NEW TASK , CALL
FUNCTION ... DESTINATION , CALL FUNCTION ... IN BACKGROUND TASK , CALL SCREEN,
CALL DIALOG, CALL TRANSACTION, and MESSAGE.

Eg :
Data : int_dath type table occurs 0 with header line. "with header line
Table : key1 key2 key3 Var1 Var2 Var3
Record 1 : X Y Z 1 2 3
Record 2 : X Y M 4 5 6

In our program we need to pass just key1 and key2 and get all relevant records
..that means if we write …
Select * from table into int_dath where key1 = 'X' and Key2 = 'Y'
just one record will come....but more than one records are there for the key combination....If you do a syntax
check then it will ask for "endselect"
because we are trying to pass multiple records into the header line
One Alternative Solution:
Select * from table into table int_dath where key1 = 'X' and Key2 = 'Y'.
if we mention table keyword before the internal table….then the select statement will pass all the records
with key1 = 'X' and Key2 = 'Y' to int_dath

There we can do a READ operation or Looping whichever is suitable for the requirement
SAP never recommends select endselect and it is total Performance disaster if we use loops or nested
selects inside a select...endselect

5. Select ... endselect is not advisible to use in ABAP program. It will affect ur system performance. Instead
use into table internal.

You might also like