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

dynamic date in a selection ???

Former Member
0 Likes
599

dear all,

i have a program which run follwing variable will have following value

d_date1 = 22072003, d_date2 = 23072003

variable are declare like this

d_date1 like vbap-aedat,

d_date2 like vbap-aedat,

select is build like this.

Select VBELN POSNR

into corresponding fields of table ITAB

from VBAP

where AEDAT between d_date1 and d_date2.

like that no value are selected.

therefore

Select VBELN POSNR

into corresponding fields of table ITAB

from VBAP

where AEDAT between 22072003 and 23072003.

3000 records are selected.

Why ? what's happen ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
553

Hi luminy13,

1. The date format should ALWAYS BE be YYYYMMDD.

2. give like this.

<b>date1 = 20030722, d_date2 = 20030723</b>

(and not date1 = 22072003, d_date2 = 23072003)

regard,

amit m.

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
553

I think that something is happening with the formatting. All date fields in the system are stored as YYYYMMDD. Your dates must be in this format.

I think that this may be a better way to do your selection.


select-option: s_aedat for vbap-aedat.

Select VBELN POSNR
into corresponding fields of table ITAB
from VBAP
where AEDAT in s_aedat.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
554

Hi luminy13,

1. The date format should ALWAYS BE be YYYYMMDD.

2. give like this.

<b>date1 = 20030722, d_date2 = 20030723</b>

(and not date1 = 22072003, d_date2 = 23072003)

regard,

amit m.

Read only

Former Member
0 Likes
553

Select VBELN POSNR

into corresponding fields of table ITAB

from VBAP

where AEDAT between 20030722 and 20030723.

3000 records are selected.

now check above select code it gives d same as ur 1st selection.

date has to passed as like yyyymmdd

Ramesh.

Read only

Former Member
0 Likes
553

Hi,

Case 1:

select-option: s_date for vbap-aedat.

Use "s_date" in the select query in the IN clause.

Case 2:

select-option: s_date for sy-datum.

Use "s_date" in the select query in the IN clause.

Note:

In case 2, user need to enter the date like 31.12.9999.

Regs,

Venkat Ramanan

Message was edited by: Venkat Ramanan Natarajan

Message was edited by: Venkat Ramanan Natarajan