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

date selection in background

Former Member
0 Likes
478

Hi,

i have to run a repot on 15th of every month in a part in the report i want to select the data from table bkdf with the foolwinf condition

The field is BKDF-DBEDT All items with a date in the next 4 month should be

included on the report.

for eg : On September report (run 09/15) all entries with an end date in the range

of 10/01 through 01/31.

October report (run 10/15) would include the date range of 11/01 through

02/28.

Please suggest for what condition should i run select query on table bkdf.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
441

Hi Richs

I wrote a small program...check this code..


REPORT test.

DATA : date1 LIKE sy-datum,
       date2 LIKE sy-datum.
RANGES : s_date FOR sy-datum.


CALL FUNCTION 'MONTH_PLUS_DETERMINE'
  EXPORTING
    months  = '1'
    olddate = sy-datum
  IMPORTING
    newdate = date1.
date1+6(2) = '01'.
WRITE :/ date1.

CALL FUNCTION 'MONTH_PLUS_DETERMINE'
  EXPORTING
    months  = '5'
    olddate = sy-datum
  IMPORTING
    newdate = date2.
date2+6(2) = '01'.
date2  = date2 - 1.
WRITE :/ date2.

s_date-low = date1. "append date1 and date2 to ranges s_date
s_date-option ='BT'.
s_date-sign = 'I'.
APPEND s_date.

s_date-high = date2.
s_date-option ='BT'.
s_date-sign = 'I'.
APPEND s_date.

SELECT .......FROM BKDF  WHERE "Use s_date in select statement.
DBEDT IN s_date.

3 REPLIES 3
Read only

Former Member
0 Likes
441

add 15 days .

current date add 15 days.

Read only

Former Member
0 Likes
442

Hi Richs

I wrote a small program...check this code..


REPORT test.

DATA : date1 LIKE sy-datum,
       date2 LIKE sy-datum.
RANGES : s_date FOR sy-datum.


CALL FUNCTION 'MONTH_PLUS_DETERMINE'
  EXPORTING
    months  = '1'
    olddate = sy-datum
  IMPORTING
    newdate = date1.
date1+6(2) = '01'.
WRITE :/ date1.

CALL FUNCTION 'MONTH_PLUS_DETERMINE'
  EXPORTING
    months  = '5'
    olddate = sy-datum
  IMPORTING
    newdate = date2.
date2+6(2) = '01'.
date2  = date2 - 1.
WRITE :/ date2.

s_date-low = date1. "append date1 and date2 to ranges s_date
s_date-option ='BT'.
s_date-sign = 'I'.
APPEND s_date.

s_date-high = date2.
s_date-option ='BT'.
s_date-sign = 'I'.
APPEND s_date.

SELECT .......FROM BKDF  WHERE "Use s_date in select statement.
DBEDT IN s_date.

Read only

0 Likes
441

Perez C ,

Thanks a lot for your reply

Regards,

Richs

Message was edited by:

richs