DATE_CONVERT_TO_FACTORYDATE - Returns factory calendar date for a date
Calculates and returns factory calendar date for a date (if CorrectOption = '+');
Checks if the date is work day (if CorrectOption = '-').
DATE_GET_WEEK - Returns week in which a date lies
Import : YYYYMMDD; Export : YYYYNN, where NN is # of week.
WEEK_GET_FIRST_DAY - Return first day for a week
Import week in format YYYYNN where NN is # of week.
DATE_COMPUTE_DAY - Returns day of week for a date
Import : YYYYMMDD; Export : 1-Monday, ...
DAY_IN_WEEK - Returns day of week for a date
GET_WEEK_INFO_BASED_ON_DATE
Import : YYYYMMDD; Export : YYYYNN - week # for the date, Monday and Sunday of the week.
LAST_WEEK
Import : YYYYNN (week #);
Export : YYYYNN - previous week #, Monday and Sunday of the previous week.
NEXT_WEEK
Import : YYYYNN (week #);
Export : YYYYNN - next week #, Monday and Sunday of the next week.
DATA: L_OUT_DATE LIKE sy-datum,
L_OUT_TIME LIKE sy-uzeit,
DATA: l_time TYPE sy-uzeit.
l_time = '050000'.
CALL FUNCTION 'C14B_ADD_TIME'
EXPORTING
I_STARTTIME = SY-UZEIT
I_STARTDATE = SY-DATUM
I_ADDTIME = l_time
IMPORTING
E_ENDTIME = L_OUT_TIME
E_ENDDATE = L_OUT_DATE
EXCEPTIONS
OTHERS = 1.
* В функции есть баг. Если прибавить 1 час к 23 часам, то дату не переведет.
CATT_ADD_TO_TIME - Add time to date
Code:
DATA: l_end_date TYPE sy-datum,
l_end_time TYPE sy-uzeit,
l_start_date TYPE sy-datum,
l_start_time TYPE sy-uzeit.
DATA: l_add_time TYPE p2012-anzhl VALUE '1'.
CONVERT_DATE_TO_ALPHA_NUMERIC - Converts internal date to DD Mon YY
Import : YYYYMMDD, Language;
Export : DD Mon YY.
CONVERT_DATE_TO_INTERNAL - Converts internal date to user-specific format string and vice versa.
Import/Export : YYYYMMDD;
Export/Import : user specific date string. Can be for import either without or within delimiters, but for export only without delimiters.
See field DATFM in the USR01 table. Can be set up via System -> User Profile -> User Defaults or using su50.
Code:
data :var3 type sy-datum.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = '11092008'
IMPORTING
date_internal = var3
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
write var3.
PERIOD_AND_DATE_CONVERT_INPUT - Input conversion for a date with period.
Import : country specific date|period string (External Date), External or Internal Periods;
Export : YYYYMMDD (Internal Date - concrete date or first day of period), Internal Period;
PERIOD_AND_DATE_CONVERT_OUTPUT - Conversion of a date with period specification with output.
Import : YYYYMMDD (Internal Date), Language, Country, Internal Period;
Export : country specific date|period string (External Date), External Period, External Period Text.
RS_VARI_V_1_ACTUAL_MONTH
RS_VARI_V_1_LAST_MONTH
RS_VARI_V_1_NEXT_MONTH - Returns first day of the actual/last/next month.
RS_VARI_V_ACTUAL_MONTH
RS_VARI_V_LAST_MONTH - Returns selection range for the actual/last month.
Output: 1st line in table P_DATETAB
RS_VARI_V_DAYS_UP_TO_NOW - Returns selection range from today-a_days to today+b_days.
Input: 1st line in P_INTRANGE (a=P_INTRANGE-LOW, b=P_INTRANGE-HIGH);
Output: 1st line in table P_DATETAB
RS_VARI_V_WDAYS_UP_TO_NOW - Returns selection range from today-a_work_days to today+b_work_days.
Input: a=P_INTRANGE-LOW, b=P_INTRANGE-HIGH (if P_INTRANGE-SIGN <> 'C');
Fact.Calendar Id = P_INTRANGE-OPTION (if P_INTRANGE-SIGN = 'C')
Output: 1st line in table P_DATETAB
RS_VARI_V_MONTH_XXX_YYY - Returns selection range for the actual month [-a_months +b_months].
Input: 1st line in P_INTRANGE (a=P_INTRANGE-LOW, b=P_INTRANGE-HIGH);
Output: 1st line in table P_DATETAB
RS_VARI_V_L_LAST_MONTH - Returns last day of last month.
RS_VARI_V_MONTH_UP_TO_NOW - Returns selection range for the actual month up to now.
Output: 1st line in table P_DATETAB
RS_VARI_V_QUARTER1XXXX
RS_VARI_V_QUARTER2XXXX
RS_VARI_V_QUARTER3XXXX
RS_VARI_V_QUARTER4XXXX - Returns selection range for the Quarter of the given year.
Input: 1st line in P_INTRANGE (Year=P_INTRANGE-LOW);
Output: 1st line in table P_DATETAB
RS_VARI_V_TODAY - Today
RS_VARI_V_TODAY_X - Returns Today + P_INTRANGE-LOW days
RS_VARI_V_XWD_ACTUAL_MONTH - Returns 1st day of the actual month + P_INTRANGE-LOW work_days
Input: work_days = P_INTRANGE-LOW (if P_INTRANGE-SIGN <> 'C');
Fact.Calendar Id = P_INTRANGE-OPTION (if P_INTRANGE-SIGN = 'C')
DATUMSAUFBEREITUNG - Country-specific date formatting for the current user. Examples of output: MM/YY, MM/YYYY, DD.MM, M/D/YYYY, DD/MM/YYYY, WW/YY, WW/YYYY.
CCM_GO_BACK_MONTHS - Module to go back specified number of months Funny module: 03/31/2002 - 1 month = 02/31/2002 J
HR_PT_ADD_MONTH_TO_DATE - HR-PT: Add or subtract months to a date DMM_OPER can be '+', '-' or '='. if '=', then
DMM_POS = 'BEG' - return 1st day of the DMM_COUNT month of the same year. Use MM format (e.g. 02) otherwise you can get date like '2 /12/2002' for February L.
DMM_POS = 'END' - returns the (DMM_COUNT month + 1), (day - 1) for the input date DMM_DATIN.
Bug: try DMM_DATIN = MM/31/YYYY, DMM_COUNT = 1 L.
Code:
* End date is Begin date + 10 years i.e. 120 months
CALL FUNCTION 'HR_PT_ADD_MONTH_TO_DATE'
EXPORTING
DMM_DATIN = BEGDA
DMM_COUNT = '120'
DMM_OPER = '+'
DMM_POS = ' '
IMPORTING
DMM_DAOUT = ENDDA
EXCEPTIONS
UNKNOWN = 1
OTHERS = 2.
Code:
data: var1 type sy-datum.
CALL FUNCTION 'HR_PT_ADD_MONTH_TO_DATE'
EXPORTING
dmm_datin = sy-datum
dmm_count = '6'
dmm_oper = '-' " Operation (add/subtract)
dmm_pos = 'B' " Set date in the beginning or end of month
IMPORTING
DMM_DAOUT = VAR1
EXCEPTIONS
UNKNOWN = 1
OTHERS = 2.
write:/ sy-datum.
write:/ var1.
RE_ADD_MONTH_TO_DATE - This module really can add/subtract months to/from date.
RP_LAST_DAY_OF_MONTHS - HR-D: Determine last day of month
Code:
*&---------------------------------------------------------------------*
*& Form GET_LAST_DAY_OF_MONTH
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_YEAR Year *
* -->P_MONTH Month *
* -->P_DAY Day *
* <--P_ENDDA Last day *
*----------------------------------------------------------------------*
FORM GET_LAST_DAY_OF_MONTH USING P_YEAR LIKE PN-PABRJ
P_MONTH LIKE PN-PABRP
VALUE(P_DAY)
CHANGING P_ENDDA TYPE D.
DATA: L_BEGDA TYPE D.
MOVE P_YEAR TO L_BEGDA(4).
MOVE P_MONTH TO L_BEGDA+4(2).
MOVE P_DAY TO L_BEGDA+6(2).
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = L_BEGDA
IMPORTING
LAST_DAY_OF_MONTH = P_ENDDA
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE E070 WITH P_MONTH.
ENDIF.
ENDFORM. " GET_LAST_DAY_OF_MONTH
PRICING_DETERMINE_DATES - Returns Days/Weeks/Months/Years between two dates (float values)
MONTHS_BETWEEN_TWO_DATES_NEW - Most universal FM to determine months (both integer and float values)
MONTH_NAMES_GET - Returns list of months (for a language)
DAY_NAMES_GET - Returns list of days (for a language)
FACTORY_CALENDAR_GET - Returns list of factory calendars (for a language)
HOLIDAY_CALENDAR_GET - Returns list of holiday calendars (for a language)
FACTORY_CALENDAR_ATTRIBUTE_GET - Returns attributes of the factory calendar
HOLIDAY_GET
Input: Factory calendar; Holiday calendar; Date range
Returns: list of all holidays in the date range
DAY_ATTRIBUTES_GET
Input: Factory calendar; Holiday calendar; Date range
Returns: list of all days with attributes in the date range
GET_CURRENT_YEAR - Get the current fiscal year.
Code:
CALL FUNCTION 'GET_CURRENT_YEAR'
EXPORTING
BUKRS = '1000' " Company Code
DATE = SY-DATUM " Date to find fiscal year for
IMPORTING
CURRM = w_currm " Current Fiscal Month
CURRY = w_curry " Current Fiscal Year
PREVM = w_prevm " Previous Fiscal Month
PREVY = w_prevy. " Previous Fiscal Year
HOLIDAY_CHECK_AND_GET_INFO - Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.
Code:
data: ld_date like scal-datum default sy-datum,
lc_holiday_cal_id like scal-hcalid default 'CA',
ltab_holiday_attributes like thol occurs 0 with header line,
lc_holiday_found like scal-indicator.
if sy-subrc = 0 and
lc_holiday_found = 'X'.
write: / ld_date, 'is a holiday'.
else.
write: / ld_date, 'is not a holiday, or there was an error calling the function'.
endif.
MONTH_PLUS_DETERMINE - Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
Code:
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -5 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.
write: / new_date.
SD_DATETIME_DIFFERENCE - Give the difference in Days and Time for 2 dates
DATE_CHECK_PLAUSIBILITY - Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
RH_GET_DATE_DAYNAME - return the day based on the date provied
RP_CALC_DATE_IN_INTERVAL - Add/subtract years/months/days from a date
COPF_DETERMINE_DURATION - Use this function module to calculate the duration of time intervals.
The calculation is carried out on the basis of the valid calendar, that is, public holidays and weekends are not indcluded in the duration.
In the function call, you transfer the following information to the function module:
The start date of the time interval (parameter I_START_DATE)
The start time of the time interval (parameter I_START_TIME)
The end time of the time interval (parameter I_END_TIME)
The time unit of the duration if it is not to be calculated in days (parameter I_UNIT_OF_DURATION)
A factory calendar if you do not want to use the Gregorian calendar (parameter I_FACTORY_CALENDAR)
Using these parameters, the function module calculates the duration and transfers it to the PI sheet in the time unit you have specified (parameter E_DURATION).
SWI_DURATION_DETERMINE - Time between 2 events in seconds
HR_99S_DATE_ADD_SUB_DURATION - Add/Subtract months(M)/days(D)/years(Y) to given date to get the future date
HR_99S_DATE_MINUS_TIME_UNIT - Subtract months(M)/days(D)/years(Y) to given date to get the future date
HR_99S_DATE_PLUS_TIME_UNIT - Add months(M)/days(D)/years(Y) to given date to get the future date
HR_99S_INTERVAL_BETWEEN_DATES - Gives the difference between the dates in days, weeks, years
HR_99S_MONTHS_BETWEEN_DATES - Returns months between two dates. Both dates are included in the computation. An individual prorata is made for each month. Meaning of parameter p_compl:
* 'B' accumulate all complete months and in/complete first month
* 'E' accumulate all complete months and in/complete last month
* ' ' accumulate all months (incomplete and complete)
* 'X' accumulate only complete months
'CTCV_CONVERT_DATE_TO_FLOAT' - Convert date to float
Code:
DATA z_date TYPE ausp-atwrt.
DATA ls_allocvaluesnum TYPE bapi1003_alloc_values_num.
z_date = i_mkpf-budat.
CALL FUNCTION 'CTCV_CONVERT_DATE_TO_FLOAT'
EXPORTING
date = z_date
IMPORTING
float = lis_allocvalueschar-value_from.
'DURATION_DETERMINE'
Code:
DATA: days TYPE p DECIMALS 1,
lv_time TYPE sy-uzeit,
lv_date TYPE sy-datum.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.