BW contains many standard formulas which can be used in TRFN’s and RSPC’s. The main issue is that sometimes you need to know default values/data types.
All available formulas can be checked in class CL_RSAR_FUNCTION. Bellow, you can find a table with explained importing and returning parameters.
Formula / Method Name Description Importing
Types
(Example) Returning
Types
(Example
result) ABORT_PACKAGE Returns exception cx_rfso_abort_package to stop
processing N/A N/A ADD_TO_DATE Add days to the specified date DATS,INT
(20201201,1) DATS
20201202 ALPHA Add leading zeros base on
the provided length STRING,INT (123,5) STRING
00123 CALMONTH_FISCPER Convert calendar month to the fiscal period CONDENSE Trim text (left site) STRING
( 43) STRING
‘43’ CONDENSE_NO_GAPS Trim text + remove spaces inside STRING
( 43 55 33) STRING
‘435533’ DATECONV Change date format to internal CHAR10,CHAR10,CHAR1
(12/07/1992,
MM/DD/YYYY,/) DATS
19921207 DATE_DIFF Calculate differences between dates DATS,DATS
(20211212,20211215) INT
3 DATE_FISCPER DATE_FISCPER3 DATE_FISCYEAR DATE_HALFYEAR Check if the date is in the first or second part of the year DATS
(20210212) NUMC
1 DATE_MONTH Get the calendar month from the given date DATS
(20201201) NUMC
202012 DATE_MONTH2 Get the month number from the given date DATS
(20201201) NUMC
12 DATE_QUATER Get the quarter from the given date DATS
(20210909) NUMC
20213 DATE_QUATER1 Get the quarter number from the given date DATS
(20210909) NUMC
3 DATE_WEEK Get the week from the given date DATS
(20210731) NUMC
202130 DATE_WEEKDAY Get the day from the given date DATS
(20211220) STRING
Monday DATE_WEEKDAY1 Get the day number from given date DATS
(20211220) NUMC
1
more DATE_YEAR Get the year from the given date DATS
(20210101) NUMC
4 FIRST_WORKINGDAY_MONTH Get the first working day from the given date and calendar DATS,CHAR
(20210425,01) DATS
20210401 FIRST_WORKINGDAY_YEAR Get the first working day of the year
and calendar DATS,CHAR
(20210525,01) DATS
20210104 FISCPER_CALMONTH FISCPER_FISCPER3 FISCPER_FISCYEAR IF Check condition - If I_Arg1 = X then Arg2 else Arg3 BOOLEAN,ANY,ANY
(X,1,10) ANY
1 IS_INITIAL Check if the string is initial ANY
(’') BOOLEAN
X IS_INTEGER Check if the string contains only integers STRING
(9) BOOLEAN
X LAST_WORKINGDAY_MONTH Get the last working day from the given date DATS,CHAR
(20210101,01) DATS
20210129 LAST_WORKINGDAY_YEAR Get the last working day of the year from the date given DATS,CHAR
(20210101,01) DATS
20211231 LEFT Get the first X characters from the string INT,STRING
(4,123456) STRING
1234 LTRIM Trim text (left site), by given regexp STRING,STRING
( ABCD,\s) STRING
‘ABCD’ L_TRIM Trim text (left site) STRING
( ABCD) STRING
‘ABCD’ MAPPING Looks like deprecated - almost all code inside commented out
Result = Arg4 MONTH2_HALFYEAR Check if the month is in the first or second half of the year ANY
(202112) or (11) NUMC
2 MONTH2_QUARTER1 Check the quarter of the month ANY
(202208) or (08) NUMC
3 MONTH_HALFYEAR Check if the month is in the first or second half of the year. ANY
(202112) NUMC
2 MONTH2_QUARTER1 Get the quarter based on the given date ANY
(202106) or (06) NUMC
2 MONTH_HALFYEAR Check is given month in first or second half of the year ANY
(20211) NUMC
2 MONTH_QUARTER Check the quarter of the given month ANY
(202208) NUMC
202003 MONTH_QUARTER1 Check the quarter of the given month ANY
(202208) NUMC
3 MONTH_YEAR Check the month of the given date ANY
(202111) or (20211125) NUMC
2021 NEGATIVE Return number with negative sing F
(1) F
-1 QUARTER1_HALFYEAR Check if given quarter is in first or
second half of the year ANY
(202101) NUMC
1 QUARTER_HALFYEAR Check if given quarter is in first or second half of the year ANY
(20214) NUMC
2 QUARTER_QUARTER1 Get the quarter from the given quarter ANY
(20214) NUMC
4 QUARTER_YEAR Get the year from the given quarter ANY
(20211) NUMC
2021 REPLACE_ALL Replace selected charter to different one C,C,STRING
(4,9,A4B4C4) STRING
A9B9C9 REPLACE_FIRST Replace first occurrences of the charters to different one C,C,STRING
(4,9,A4B4C4) STRING
A9B4C4 RIGHT Get first few numbers from right I,STRING
(4,123456) STRING
3456 RTRIM Trim white charters from right based on provided regexp STRING,STRING
(ABC,\s) STRING
‘ABC’ R_TRIM ? C
(D) STRING
D SHIFT_LEFT Remove first few charters from the left site
of the string more I,STRING
(2,abcdef) STRING
cdef SHIFT_RIGHT Add few
charters from the left site
of the string more I,STRING
(2,abcdef) STRING
’ abcdef' SKIP_RECORD Raise CX_RSFO_SKIP_RECORD exception to skip processing of current record N/A N/A SKIP_RECORD_AS_ERROR Raise CX_RSFO_SKIP_RECORD
_AS_ERROR exception to skip current record processing with error N/A N/A STR_LEN Returns the length of the string STRING
abcdef INT
6 UNIT_CONVERSION Convert units UNIT,UNIT,ANY
(TO,KG,100) F
100000 UTC_LONG_TO_
LOCAL_DATE Convert timestamp based on selected timezone to get the date DEC,CHAR
(20161030053000,EST) DATS
20161030 UTC_LONG_TO_
LOCAL_TIME Convert timestamp based on selected timezone to get the hour DEC,CHAR
(20161030053000,EST) F
5.40 UTC_SHORT_TO_
LOCAL_DATE Convert timestamp based on selected timezone to get the date (same code like for long version) DEC,CHAR
(20161030053000,EST) DATS
20161030 UTC_SHORT_TO_
LOCAL_TIME Convert timestamp based on selected timezone to get the hour DEC,CHAR
(20161030053000,EST) TIMS
013000 WEEK_FIRST_DAY Get the first day of the week NUMC
(202104) DATS
20210125 WORKINGDAY_MONTH Get the number of working days based on month DATS,CHAR,CHAR
(20211220,01,+) INT
14 WORKINGDAY_YEAR Get the number of working day base on
year DATS,CHAR,CHAR
(20211220,01,+) INT
243 Explanations: DATE_WEEKDAY1(): 1 - Monday 2 - Tuesday 3 - Wednesday 4 - Thursday 5 - Friday 6 - Saturday 7 - Sunday ...