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

extended program check

Former Member
0 Likes
994

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
943

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.

9 REPLIES 9
Read only

sachin_mathapati
Contributor
0 Likes
943

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.

Read only

Former Member
0 Likes
943

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

Read only

Former Member
0 Likes
943

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

Read only

Former Member
0 Likes
944

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.

Read only

Former Member
0 Likes
943

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

Read only

Former Member
0 Likes
943

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.

Read only

0 Likes
943

Pass all the key fields in the where clause of the Select statement.

Raghav

Read only

Former Member
0 Likes
943

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.

Read only

Former Member
0 Likes
943

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.