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

query does not retrieves the correct values

Former Member
0 Likes
476

Hi,

pls look into the code.

clear: wf_etenr,

vbep.

  • To get the Scheduled Loading date and Scheduled Arrival Date.

SELECT MAX( etenr ) FROM vbep INTO wf_etenr

WHERE vbeln = tvbdpl-vgbel

AND posnr = wl_posnr.

IF sy-subrc EQ 0.

clear vbep.

SELECT SINGLE * FROM vbep "R02

WHERE vbeln = tvbdpl-vgbel "R02

AND posnr = tvbdpl-vgpos "R02

AND etenr = wf_etenr.

IF sy-subrc EQ 0.

when i see the values at dictionary level using the same wher conditions are mismatching with the query excution result in the program.

here in the second query ( SELECT SINGLE * ) it giving the wrong results .

if i compare the results at table level ,some of the field values are missing after excuting the above second query.

pls can any one give me ur suggestion on this !

rgds

sanjay reddy

3 REPLIES 3
Read only

Former Member
0 Likes
440

Hi,

are these the same?

wl_posnr and tvbdpl-vgpos

try

SELECT SINGLE * FROM vbep

WHERE vbeln = tvbdpl-vgbel

AND posnr = wl_posnr

AND etenr = wf_etenr.

IF sy-subrc EQ 0.

to make somewhat consistent querys.

regards

Message was edited by: Zlatko

Zlatko Stracenski

Read only

Former Member
0 Likes
440

declare the workarea similar to vbep and do the select single from vbep into wa_vbep and give the conditions.

whereas for first query select that field without max function and then sotr it accordingly and get the first record.

Read only

Former Member
0 Likes
440

Hi,

DATA WA type VBEP.

SELECT VBELN POSNR MAX( ETENR ) FROM vbep INTO WA

WHERE vbeln = tvbdpl-vgbel

AND posnr = wl_posnr.

IF sy-subrc EQ 0.

clear vbep.

SELECT SINGLE * FROM vbep "R02

WHERE vbeln = WA-VBELN "R02

AND posnr = WA-POSNR "R02

AND etenr = WA-ETENR.

IF sy-subrc EQ 0.

Trythis,

KC