09-15-2010 12:35 PM
hi all,
i have to use MAX keyword in my coding, so i have write this code:
SELECT SINGLE MAX( bedat ) badat
FROM eban
INTO gi_reqdate
WHERE EBELN IN S_EBELN
AND banfn eq gi_eban-banfn
AND ekorg eq p_ekorg
AND spras eq 'E'
GROUP BY bedat badat.
when i execute it will give me dump at SELECT SINGLE MAX( bedat ) badat .I can't understand why it is given me Dump...
Thanks.
09-15-2010 12:37 PM
Remove "Single" from Select Statement.
Edited by: abapuser on Sep 15, 2010 1:38 PM
09-15-2010 12:40 PM
hi abapuser,
i have remove SINGLE keyword but still getting dump.do you have any other suggestion..?
Thanks
09-15-2010 12:48 PM
well you are selecting two fields from the table into one variable, i dont really wonder that this dumps.
09-15-2010 12:51 PM
but in such cases system gives syntax error.How the program got activated is a surprise to me..
09-15-2010 12:59 PM
Hi abapuser,
If you give single into clause for two selected fields, the system won't give syntax error when you use GROUP BY.But when you execute it, you'll get dump. So he has to use two variable in INTO clause, otherwise he'll get dump.
Regards,
Selva M
09-15-2010 1:16 PM
hi selva,
i have tried it the code which had two internal table.following is the code:
SELECT SINGLE MAX( bedat ) badat
FROM eban
INTO (gi_reqdate , gi_reqdate1)
WHERE EBELN IN S_EBELN
AND banfn eq gi_eban-banfn
AND ekorg eq p_ekorg
AND spras eq 'E'
GROUP BY bedat badat
At gi_reqdate1 i also declare it but after execution i got dump again,can't understand what is the problem in my code.
Thanks.
09-15-2010 1:18 PM
yes you are right..never noticed that this would not raise any syntax error.
09-15-2010 1:19 PM
09-15-2010 1:26 PM
Hi,
What is gi_eban-banfn that you used in the select query. If gi_eban is an internal table then use FOR ALL ENTRIES.
I think this is what u made mistake. Check this.
or
I think you are using this select query inside the loop... End loop or inside the select ... Endselect.
If you paste ur code, then it'll be easy for us to find the solution.
Regards,
Selva M
09-15-2010 1:52 PM
hi selva,
when i use FOR ALL ENTRIES, it give me this error:
The addition "FOR ALL ENTRIES IN" is not allowed for SELECT SINGLE.
and this is my code after using FOR ALL ENTRIES:
SELECT SINGLE MAX( bedat ) badat
FROM eban
INTO gi_reqdate FOR ALL ENTRIES IN gi_eban
WHERE EBELN IN S_EBELN
AND banfn eq gi_eban-banfn
AND ekorg eq p_ekorg
AND spras eq 'E'
GROUP BY bedat.
Thanks.
09-15-2010 2:03 PM
Hi,
Yes you can't use FOR ALL ENTRIES when you use Select Single. I said if you use gi_eban-banfn in where condition then you should use FOR ALL ENTRIES or you should use this select query in loop...endloop or Select....Endselect.
Try this,
SELECT SINGLE MAX( bedat ) badat
FROM eban
INTO ( gi_reqdate , gi_reqdate1)
WHERE EBELN IN S_EBELN
AND ekorg eq p_ekorg
AND spras eq 'E'
GROUP BY bedat badat.
If you don't get any error, then problem is with your gi_eban-banfn. Then analyze according to that.
Regards,
Selva M
09-16-2010 7:14 AM
hi Selve,
i have tried the coding which you have given me but still it giving me DUMB.Following are the codes:
gi_reqdate1 type eban,
SELECT SINGLE MAX( bedat ) badat
FROM eban
INTO (gi_reqdate , gi_reqdate1)
WHERE EBELN IN S_EBELN
AND ekorg eq p_ekorg
AND spras eq 'E'
GROUP BY bedat badat.
and this is the DUMB:
Error Analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught
in
procedure "F_GET_DATA" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
In a SELECT access, the read file could not be placed in the target
field provided.
Either the conversion is not supported for the type of the target field,
the target field is too small to include the value, or the data does not
Source Code
-
SELECT SINGLE MAX( bedat ) badat
FROM eban
INTO (gi_reqdate , gi_reqdate1)
WHERE EBELN IN S_EBELN
AND ekorg eq p_ekorg
AND spras eq 'E'
GROUP BY bedat badat.
have the format required for the target field.
Thanks.
09-16-2010 7:17 AM
really sad, that you dont see it yourself by now, the error message from dumP is quite telling.
It tells you that what you select doesnt fit in the field into which you select it, so you may want to rethink your declarations of
gi_reqdate and gi_reqdate1.
09-16-2010 7:19 AM
Hi,
The problem is , declare like this
Data: gi_reqdate1 type eban-bedat. not like this gi_reqdate1 type eban,
Regards,
Selva M
09-16-2010 7:24 AM
I really should have locked this thread yesterday. I suggest you take a course in ABAP and English.
pk
Edited by: kishan P on Sep 16, 2010 11:54 AM
09-15-2010 12:47 PM
Hi,
write as :
SELECT SINGLE MAX( bedat ) badat
FROM eban
INTO (gi_reqdate , gi_reqdate1) <-- declare another field and pass here .. Dump says "Too few fields in INTO clause."
WHERE EBELN IN S_EBELN
AND banfn eq gi_eban-banfn
AND ekorg eq p_ekorg
AND spras eq 'E'
GROUP BY bedat badat.
Regards,
Srini.
09-15-2010 1:13 PM
If you have only one variable in into clause and you are selecting more that one variable, it will not prompt you any error but it will give you a dump saying "Few parameters in INTO clause".
If this is the dump you are getting then add one more variable. or give us what kind of dump you are getting.
09-15-2010 1:20 PM
Hi,
Please Check the following Sample Code. I think something is wrong with gi_reqdate use INTO CORRESPONDING
DATA: it_eban LIKE STANDARD TABLE OF eban.
SELECT-OPTIONS: s_ebeln FOR eban-ebeln,
s_banfn FOR eban-banfn,
s_ekorg FOR eban-ekorg.
SELECT MAX( bedat ) badat
FROM eban
INTO CORRESPONDING FIELDS OF TABLE it_eban
WHERE ebeln IN s_ebeln
AND banfn IN s_banfn
AND ekorg IN s_ekorg
AND spras EQ 'E'
GROUP BY bedat badat.
Thanks and Regards,
Faisal
09-15-2010 1:48 PM
hi faisal,
thank for your reply but issue is that i don't want to use EBAN in selection option that's way i have write my code as this:
SELECT SINGLE MAX( bedat ) badat
FROM eban
INTO gi_reqdate FOR ALL ENTRIES IN gi_eban
WHERE EBELN IN S_EBELN
*AND banfn eq gi_eban-banfn*
*AND ekorg eq p_ekorg*
AND spras eq 'E'.
GROUP BY bedat.
do you have any other suggestion.
Thanks.
09-15-2010 1:53 PM
i have the suggestion that you move your mouse over the "FOR ALL ENTRIES" statement and hit F1.
you'd be surprised what will happen once your syntax errors are corrected.