on 09-22-2014 11:52 PM
Hi Gang,
I need some help. I need to create a variable on a DATS based InfoObject in a Bex query which selects the first Saturday prior to current calendar day as defined by sys-date. Day of Week is NOT available in the Time Dimension and client is reluctant to remodel at this time.
The perfect solution would be to create a variable which could read the sys-date and determine the calendar day of the previous Saturday as an output parameter for use a a single value selection.
My ABAP skills could be generously be described as "advanced novice". Please be a specific as possible, and hyperlinks to useful materials are greatly appreciated.
Thank you in advance for your help,
John Hawk
Hi Gang,
I like my code better
WHEN 'ZPRIORSAT'.
DATA: day_p TYPE p,
w_saturday TYPE SYDATUM.
CLEAR: L_S_RANGE.
CLEAR: day_p.
CLEAR: w_saturday.
I_STEP = 0. "No data entry
day_p = SY-DATUM MOD 7.
* DAY_P equals 0 for Saturday, 1 for Sunday, etc..
CASE day_p.
WHEN 0.
w_saturday = SY-DATUM.
WHEN 1.
w_saturday = SY-DATUM - 1.
WHEN 2.
w_saturday = SY-DATUM - 2.
WHEN 3.
w_saturday = SY-DATUM - 3.
WHEN 4.
w_saturday = SY-DATUM - 4.
WHEN 5.
w_saturday = SY-DATUM - 5.
WHEN 6.
w_saturday = SY-DATUM - 6.
ENDCASE.
L_S_RANGE-LOW = w_saturday.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I agree to Dhrubojyoti Saha. Other method can be as below.
FM DATE_COMPUTE_DAY returns the day number (l_day) of the given date (l_date).
You can subtract this value from the date to get the Saturday of previous week.
i.e. l_date - l_day
Regards,
Sucheta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Function Module DATE_TO_DAY is not found in my BW 7.4 system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can use the below two FMs
DATE_GET_WEEK
This function module returns the week for the date passed.
WEEK_GET_FIRST_DAY
This function module returns the first day of the week passed. (This is always a Monday, regardless of whether it is a working day or a holiday.)
Then you can subtract 2 from this day to get the saturday of the week before.
Regards
Hi,
I would definitively do this requirement with an user-exit type variable, although some "advanced novice ABAP" is needed.
You can search in the community for examples with "SAP Enhancement RSR00001".
Some preliminary links:
Customer Exit Variables in SAP BI - SAP NetWeaver Business Warehouse - SCN Wiki
Regards,
Miguel Varela
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.