‎2008 Feb 14 9:45 PM
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.
‎2008 Feb 14 9:52 PM
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.
‎2008 Feb 14 9:50 PM
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
‎2008 Feb 14 10:00 PM
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
‎2008 Feb 14 10:14 PM
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
‎2008 Feb 14 9:52 PM
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.
‎2008 Feb 14 10:20 PM
Hi
if you always need a date 7 days before, you can get it by sy-datum - 7
Cheers
~Arun