Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SELECT AND ENDSELECT

Former Member
0 Likes
6,461

Hi friends,

I am debugging one report.

In that report some select statements are there.

If itab is initial.

Select * from tsp03l where padest = l_device.

exit.

endselect.

Please tell me its meaning.

What is the purpose of exit statement here.

Thanks in Advance,

Anil.........

7 REPLIES 7
Read only

Former Member
0 Likes
2,387

hi,

exit will come out of the select statement

ravi

Read only

Former Member
0 Likes
2,387

HI,

In the Select, it is checking for a reocrd which is equal to l_device, if that is success then it will exit from that select and in the header of the table TRP03L will contain a record which is equals to L_DEVICE.

Regards

Sudheer

Read only

Former Member
0 Likes
2,387

Hi

When a record is found , then it comes out of the loop of select..endselect.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
2,387

If itab[] is initial.

Select * from tsp03l where padest = l_device.

exit.

endselect.

EXIT statement will exit from the select statement when it had found the value of l_device in the table tsp03l

Read only

Former Member
0 Likes
2,387

select * ...

what does it actually means ...

it select all the records from all the field accoring to the where condition that you have given....

and endselect....is just acts as a loop for selecting all the records... so using exit... if you write then the executuion of the select query will be ended if the record is found out...

Regards,

Jayant

Please award if helpful

Read only

Former Member
0 Likes
2,387

Hi Anil,

If the record is found.

i.e. if sy-subrc = 0.

exit statement will be executed and compiler

will come out from select...endselect loop.

this means that it will check for any other value further.

Exit statement bring the compiler out of loop.

If sy-subrc <> 0

then select...endselect loop will be continue...........

Reward points if helpful.

Regards,

Hemant

Read only

Former Member
0 Likes
2,387

Hi,

This statements are used to get Long/short device names for Spools.

if itab is inital it is checking db table comparing variable l_device

for it is getting db fields if found and then exiting the select. means if data is selected tsp03l stru will contain data, this data would have used in further codes.

Hope this helps u.

Jogdand M B