‎2008 Jul 09 7:45 AM
experts ,
assumption: work area declared ie gs_cdhdr of type cdhdr
i have coded a following statement
.
select single OBJECTCLAS
objectid
changenr
FROM CDHDR
INTO (gs_cdhdr-objectclas,
gs_cdhdr- bjectid,
gs_cdhdr-changenr)
WHERE objectclas = 'BELEG'
AND username IN s_uname
AND udate IN s_date
AND tcode = 'FB02'
AND change_ind = 'U'.
when i use extended program check
the following warning message is getting displayed.
In "SELECT SINGLE ...", the WHERE condition for the key field "CHANGENR" does not
test for equality. Therefore, the single record in question is possibly not unique.
where am i coding wrong.
thanks and regards
‎2008 Jul 09 7:59 AM
In a SELECT querry, the addition SINGLE is used only when the WHERE clause conatins the complete primary key of the table being hit. If we cannot include details of the complete primary key in the WHERE clause, the addition SELECT UP TO 1 ROWS is to be used. The same SELECT querry modified as shown here, will give no EPC checks.
SELECT objectclas
objectid
changenr
FROM cdhdr
INTO (gs_cdhdr-objectclas,
gs_cdhdr-objectid,
gs_cdhdr-changenr)
UP TO 1 ROWS
WHERE objectclas EQ 'BELEG'
AND username IN s_uname
AND udate IN s_date
AND tcode EQ 'FB02'
AND change_ind EQ 'U'.
ENDSELECT.
‎2008 Jul 09 7:49 AM
Hi Ramesh,
The key fields in CDHDR table are OBJECTCLAS ,OBJECTID and CHANGENR .
But your select statement has only OBJECTCLAS .. So there is a possibilty of multiple entries..
So try to include OBJECTID and CHANGENR in u r select statement.
Reward if Helpful.
‎2008 Jul 09 7:51 AM
HI
In CDHDR we three OBJECTCLAS
OBJECTID
CHANGENR
key fields and you are passing only one in Where clause. So it may be possible with one OBJECTCLAS we have more than one rcord in table.
Regards
Aditya
‎2008 Jul 09 7:52 AM
it is sying that untill you enter the changer value in where condition i cant able to retrive a unique single record from database , it may have mor than one entry
so specify the value of changer in where condition
‎2008 Jul 09 7:59 AM
In a SELECT querry, the addition SINGLE is used only when the WHERE clause conatins the complete primary key of the table being hit. If we cannot include details of the complete primary key in the WHERE clause, the addition SELECT UP TO 1 ROWS is to be used. The same SELECT querry modified as shown here, will give no EPC checks.
SELECT objectclas
objectid
changenr
FROM cdhdr
INTO (gs_cdhdr-objectclas,
gs_cdhdr-objectid,
gs_cdhdr-changenr)
UP TO 1 ROWS
WHERE objectclas EQ 'BELEG'
AND username IN s_uname
AND udate IN s_date
AND tcode EQ 'FB02'
AND change_ind EQ 'U'.
ENDSELECT.
‎2008 Jul 09 8:01 AM
Hello ramesh,
If you see table CDHDR you would fing the key fields are OBJECTCLAS, OBJECTID, CHANGENR.
When we want to use select single to retrieve data then all the key field should be specified in the selection criteria to get tthe proper result.As there is a violation to that rule,that is the reason why you are getting the warning in epc.
Your code should be:-
select single OBJECTCLAS
objectid
changenr
FROM CDHDR
INTO (gs_cdhdr-objectclas,
gs_cdhdr- bjectid,
gs_cdhdr-changenr)
WHERE objectclas = 'BELEG'
and objectid = 'xyz'
and changenr = '123'
AND username IN s_uname
AND udate IN s_date
AND tcode = 'FB02'
AND change_ind = 'U'.That would remove the error.
Best of luck,
Bhumika
‎2008 Jul 09 8:12 AM
tables cdhdr.
try this.
if ur unable to pass primary key to selection condition then we have to use up to rows statement
data: gs_cdhdr type cdhdr.
select-options: s_uname for cdhdr-username,
s_date for cdhdr-udate.
select OBJECTCLAS
objectid
changenr
up to 1 rows
FROM CDHDR
INTO (gs_cdhdr-objectclas,gs_cdhdr-objectid,gs_cdhdr-changenr)
WHERE objectclas = 'BELEG'
AND username IN s_uname
AND udate IN s_date
AND tcode = 'FB02'
AND change_ind = 'U'.
endselect.
‎2008 Jul 09 8:21 AM
Pass all the key fields in the where clause of the Select statement.
Raghav
‎2008 Jul 09 9:49 AM
Hi Ramesh,
This warning comes when you are not specifying all the primary keys in the database table. To remove the warning include all the primark keys in the table CDHDR in your SELECT SINGLE statement.
Regards,
Swapna.
‎2008 Jul 09 9:56 AM
Hi,
The key fields in CDHDR are
OBJECTCLAS
OBJECTID
CHANGER.
So when you use select single then check with all the key fields .
Regards,
Rajitha.