*&---------------------------------------------------------------------*
* & Report zqwe
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
Report zqwe.
Data: date1 like SY-DATUM,
Date2 like SY-DATUM,
Date3 like SY-DATUM,
Date4 like SY-DATUM,
Date5 like SY-DATUM,
Date6 like SY-DATUM,
Date7 like SY-DATUM.
Data: week1 like SCAL-WEEK,
Week2 like SCAL-WEEK.
Data: days type I.
Data: Sund type P.
Data: date_l like SY-DATUM,
Time_l like SY-UZEIT.
Parameters: gjahr type gjahr obligatory,
Monat type Monat obligatory,
Time like SY-UZEIT.
"Search for help
At selection-screen on value-request for gjahr.
Call function 'f4 _ date'
Exporting
Date_for_first_month = SY-DATUM
Importing
Select_date = date_l
Exceptions
Calendar_buffer_not_loadable = 1
Date_after_range = 2
Date_before_range = 3
Date_invalid = 4
Factory_calendar_not_found = 5
Holiday_calendar_not_found = 6
Parameter_conflict = 7
Others = 8
.
If SY-SUBRC = 0.
Gjahr = date_l + 0 (4 ).
Endif.
Start-of-selection.
"First day of a month
Concatenate gjahr Monat '01 'into date1.
"Last day of a month
Call function 'rp _ last_day_of_months'
Exporting
Day_in = date1
Importing
Last_day_of_month = date2
Exceptions
Day_in_no_date = 1
Others = 2.
"Number of days between two dates
Days = date2-date1.
"Year, month, number of days, forward and backward
Call function 'rp _ calc_date_in_interval '"get a date three months before the current date
Exporting
Date = date2
Days = 0
Months = 1
SIGNUM = '+'
Years = 0
Importing
Calc_date = date3.
"Weeks retrieved by date
Call function 'date _ get_week'
Exporting
Date = date3
Importing
Week = week1
Exceptions
Date_invalid = 1
Others = 2.
"Get the first day of the week
Call function 'Week _ get_first_day'
Exporting
Week = week1
Importing
Date = date4
Exceptions
Week_invalid = 1
Others = 2.
"Obtain the number of weeks of the next week based on the number of weeks.
Call function 'Next _ week'
Exporting
Current_week = week1
Importing
Next_week = week2
Monday = date5
Sunday = date6.
"Get the day of the week by date
"The return value is a number, and the number corresponds to tables such as week X or Monday: t246.
Call function 'day _ in_week'
Exporting
Datum = date4
Importing
Wotnr = Sund.
Write:/date1, date2, days, date3, week1, date4, Sund, week2, date5, date6.
Convert a date from an internal format to an external format. For example, '123456' is converted to '192. 1234568', which may be used in BDC.
Convert_date_to_external
Convert a date from an external format to an internal format.
Convert_date_to_internal