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

regarding select single statement

Former Member
0 Likes
778

hi experts,

select single MIN( punchdate ) from pa9777 into (r_punchdate)

where pernr = peras-pernr and

punchdate gt P_WA_TEVEN_LDATE

group by punchdate.

i m using this select single statement in my report ,i want to know that will it give me right result,means here i m using select single n MIN function together.

1 ACCEPTED SOLUTION
Read only

arjun_subhash
Active Participant
0 Likes
747

hi,

according to my knowledge,adding MIN wont affect select statement,but ORDER BY cannot be used with select single.

regards

Arjun

7 REPLIES 7
Read only

Former Member
0 Likes
747

May be you can consider adding the ORDER BY punchdate as well.

regards,

Advait

Read only

0 Likes
747

Hi Rajat!!

I think it wont work.

Select single fetches only one record at a time.SO how will MIN function work.

So :

select MIN( punchdate ) from pa9777 into (r_punchdate)

where pernr = peras-pernr and

punchdate gt P_WA_TEVEN_LDATE

group by punchdate.

Hope this helps.

Read only

arjun_subhash
Active Participant
0 Likes
748

hi,

according to my knowledge,adding MIN wont affect select statement,but ORDER BY cannot be used with select single.

regards

Arjun

Read only

0 Likes
747

Hi Rajat,

I think it is not logically correct to use both MIN and SINGLE. Selecting single means getting a first hit where the condition is true (and only one). As this will result only in one hit you cannot tell the system to get MIN value of this(these). To do this there has to be at least two hits, which you would get by using select but without single addtion.

Regards

Marcin

Read only

Former Member
0 Likes
747
Read only

Subhankar
Active Contributor
0 Likes
747

Hi....

Please check this ...

DATA: l_blanz TYPE blanz.

SELECT SINGLE MIN( blanz )

FROM mara

INTO l_blanz

WHERE ersda LE sy-datum

GROUP BY ersda.

It is working successfully. No problem using select single min and group by together.

Edited by: Subhankar Garani on Dec 12, 2008 12:05 PM

Read only

Former Member
0 Likes
747

from ur answer what i came to know that if we use punchdate = P_WA_TEVEN_LDATE group by punchdate ,then the select single and MIN function will work but if we use punchdate gt P_WA_TEVEN_LDATE group by punchdate then it wont work.

correct me if i m wrong,