Make your own free website on Tripod.com
 

SAP ABAP Programming, Functional and Basis Components Books


To find out the Previous Saturday for a given date

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.

Back to Previous

Return to SAP Hints and Tips on Configuration and ABAP/4 Programming