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

select statement

Former Member
0 Likes
951

Hi,

i want to write one select statement for getting the sales document numbers from vbak table where date from 1.02.2008 to 31.02.2008.

I have written code like this.

SELECT VBELN

FROM VBAK

INTO TABLE IT_VBAK

WHERE ERDAT-LOW = 'V_E_FDAY' AND ERDAT-HIGH = 'V_E_LDAY'.

it is showing error. please help me.(erdat field is there in the table vbak).How can i write the code

6 REPLIES 6
Read only

Former Member
0 Likes
918

hi use

SELECT VBELN

FROM VBAK

INTO TABLE IT_VBAK

WHERE ERDAT between V_E_FDAY and V_E_LDAY.

if it_vbap is type vbak than use

SELECT *

FROM VBAK

INTO TABLE IT_VBAK

WHERE ERDAT between V_E_FDAY and V_E_LDAY.

reward if useful

Read only

Former Member
0 Likes
918

Hi,

try this.

data : it_vbak type STANDARD TABLE OF VBAK.

PARAMETERS : V_E_FDAY TYPE SY-DATUM,

V_E_LDAY TYPE SY-DATUM.

SELECT *

FROM VBAK

INTO TABLE IT_VBAK

WHERE ERDAT >= V_E_FDAY

AND ERDAT <= V_E_LDAY.

Reward points if helpful..................

Read only

Former Member
0 Likes
918

SELECT VBELN

FROM VBAK

INTO TABLE IT_VBAK

WHERE ERDAT IN (V_E_FDAY, V_E_LDAY).

If this doesn't work then let me know how you have defined V_E_FDAYand V_E_LDAY.

I hope it helps.

Best Regards,

Vibha

Please mark all the helpful answers

Read only

Former Member
0 Likes
918

define a select option with name input and internal table itab with a field of type vbeln. then

select vbeln from vbak into itab where date in input.

reward if it is helpful.

Read only

Former Member
0 Likes
918

hi check this..

data: it_vbak type vbak occurs 0 with header line.

select-options: s_date for sy-datum.

SELECT VBELN

FROM VBAK

INTO TABLE IT_VBAK

WHERE ERDAT le s_date-low

AND ERDAT ge s_date-low

.

regards,

venkat

Read only

Former Member
0 Likes
918

hi friend

try this one

SELECT VBELN

FROM VBAK

INTO TABLE IT_VBAK

WHERE ERDAT BETWEEN 'date1' AND 'date2'.

or

SELECT VBELN

FROM VBAK

INTO TABLE IT_VBAK

WHERE ERDAT >= 'date1'

AND Hkont <= 'date2'.

Reward points if helpfull

.