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 Issue

Former Member
0 Likes
620

Hey folks,

I have a requiremnet where i have to extract the sales data for current year and the date we have to consider the docs are suppose i ran the report today then it would be from 01/01/2008 to last week's date.

i am selecting the data from billing table VBRK where gjahr shud be in this date range.

How wud i write a select to achieve this kinda scenario.

Thanks in advance

Regards

Rock.

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
600

PARAMETER: pa_end LIKE veda-venddat DEFAULT sy-datum.

AT SELECTION-SCREEN OUTPUT.

IF pa_older = 'X'.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = pa_end   "<<<<<<<< from selection screen
days = '00'        " no. of days to add
months = '06'    " no. of months to add
signum = '-'       " add or remove period
years = '00'       " add or remove year..
IMPORTING
calc_date = pa_end.       " calculated date...
ENDIF.
5 REPLIES 5
Read only

Former Member
0 Likes
600

What exactly do you mean by "last week's date"? Seven days ago? The first day of last week? The last day of last week?

Rob

Read only

0 Likes
600

Hey Rob,

Seven days ago and there is no selection screen . The day it is ran it shud consider the from 01/01/2008 to seven days minus todays date.

i mean when we select the billing doc the date range shud be from 01/01/current year to seven days minus the current date.

i have to write a select for this how wud i do it.

Regards

Rock

Read only

0 Likes
600

HI rock,

there r some function modules which gives u a date 7 days before of current day.

u need to pass current date and how many days u want.

then store that output in variable

and in select statement u can use BETWEEN ...

hope this logic will help u....

i dont have sap access to provide for FM and sample code... but u can search with DAYS

Regards

SAB

Read only

former_member156446
Active Contributor
0 Likes
601

PARAMETER: pa_end LIKE veda-venddat DEFAULT sy-datum.

AT SELECTION-SCREEN OUTPUT.

IF pa_older = 'X'.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = pa_end   "<<<<<<<< from selection screen
days = '00'        " no. of days to add
months = '06'    " no. of months to add
signum = '-'       " add or remove period
years = '00'       " add or remove year..
IMPORTING
calc_date = pa_end.       " calculated date...
ENDIF.
Read only

Former Member
0 Likes
600

Hi

if you always need a date 7 days before, you can get it by sy-datum - 7

Cheers

~Arun