REPORT ZPREVIOUS.
* To find out the Previous Saturday for a given date
DATA: L_DATE LIKE SY-DATUM.
PARAMETERS: PREVDAY(2) TYPE N DEFAULT 7.
L_DATE = SY-DATUM.
L_DATE = L_DATE - ( ( ( L_DATE MOD 7 ) + PREVDAY ) MOD 7 ).
CASE PREVDAY.
WHEN 7. WRITE:/ 'Previous Saturday ', L_DATE.
WHEN 6. WRITE:/ 'Previous Sunday ',
L_DATE.
WHEN 5. WRITE:/ 'Previous Monday ',
L_DATE.
WHEN 4. WRITE:/ 'Previous Tuesday ', L_DATE.
WHEN 3. WRITE:/ 'Previous Wednesday', L_DATE.
WHEN 2. WRITE:/ 'Previous Thursday ', L_DATE.
WHEN 1. WRITE:/ 'Previous Friday ',
L_DATE.
ENDCASE.
Return to :-
SAP ABAP/4 Programming, Basis Administration,
Configuration Hints and Tips
(c) www.sap-basis-abap.com All material on this site is
Copyright.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
All product names are trademarks of their respective
companies. The site www.sap-basis-abap.com is in no way affiliated
with SAP AG.
Any unauthorised copying or mirroring is prohibited.