Finance Automation SAP REL Functions
The following SAP REL functions are used in the SAP flavors. The functions reside in the Redwood_FCA
library.
You call these functions by specifying =<partition>.Redwood_FCA.<function>
in the Simple Constraint Data field of constraints of type Expression
.
The examples on this page assume the definition which calls these functions resides in the same partition as the library, specified as $
.
The default partition of the library is FCA
. The REL functions can be accessed via RedwoodScript from the
com.redwood.scheduler.custom.fl.sap.rel.FlSapRel
class.
caCalculateFiscalPeriod
Return the fiscal period after period calculation from current (+1/-1) controlling area level; with company code, fiscal year, and period as specified.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.caCalculateFiscalPeriod(Long jobId, String inCalc, String inKOKRS, String inFY, String inPeriod)
Example
=$.Redwood_FCA.caCalculateFiscalPeriod(jobId, -1, parameters.KOKRS, parameters.GJAHR, parameters.PERIOD)
Result
Returns 008
on this system.
caCalculateFiscalPeriodJob
Return the Return Period after period calculation from current (+1/-1) controlling area level; company code, fiscal year, and period are retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.caCalculateFiscalPeriodJob(Long jobId, String inCalc)
Example
=$.Redwood_FCA.caCalculateFiscalPeriodJob(jobId, -1)
Result
Returns 008
on this system.
caCalculateFiscalPeriodParameter
Return the specified parameter from the FiscalPeriod table, controlling area level, with an offset; company code, fiscal year, and period are retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.caCalculateFiscalPeriodParameter(Long jobId, String inCalc, String inParameter, String inKOKRS, String inFY, )
Example
=$.Redwood_FCA.caCalculateFiscalPeriodParameter(jobId, '3', 'FirstDayFiscalYear', parameters.KOKRS, parameters.GJAHR, parameters.PERIOD)
Result
Returns 20230101
on this system.
caCalculateFiscalPeriodParameterJob
Return the specified parameter from the FiscalPeriod table, controlling area level, with an offset; company code, fiscal year, and period are retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.caCalculateFiscalPeriodParameterJob(Long jobId, String inCalc, String inParameter)
Example
=$.Redwood_FCA.caCalculateFiscalPeriodParameterJob(jobId, '3', 'FirstDayFiscalYear')
Result
Returns 20230101
on this system.
caCalculateFiscalYear
Return the fiscal year after period calculation from current (+1/-1) controlling area level; with company code, fiscal year, and period as specified.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.caCalculateFiscalYear(Long jobId, String inCalc, String inKOKRS, String inFY, String inPeriod)
Example
=$.Redwood_FCA.caCalculateFiscalYear(jobId, -1, parameters.KOKRS, parameters.GJAHR, parameters.PERIOD)
Result
Returns 2023
on this system.
caCalculateFiscalYearJob
Return the fiscal year after period calculation from current (+1/-1) controlling area level, with company code, fiscal year, and period retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.caCalculateFiscalYearJob(Long jobId, String inCalc)
Example
=$.Redwood_FCA.caCalculateFiscalYearJob(jobId, -1)
Result
Returns 2023
on this system.
caFiscalPeriodParameter
Return the specified parameter from the FiscalPeriod table controlling area level; company code, fiscal year, and period are specified.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.caFiscalPeriodParameter(Long jobId, String inParameter, String inKOKRS, String inFY, String inPeriod)
Example
=$.Redwood_FCA.caFiscalPeriodParameter(jobId, 'FirstDayFiscalYear', parameters.KOKRS, parameters.GJAHR, parameters.PERIOD)
Result
Returns 20230101
on this system.
caFiscalPeriodParameterJob
Return the specified parameter from the FiscalPeriod table controlling area level; company code, fiscal year, and period are retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.caFiscalPeriodParameterJob(Long jobId, String inParameter)
Example
=$.Redwood_FCA.caFiscalPeriodParameterJob(jobId, 'FirstDayFiscalYear')
Result
Returns 20230101
on this system.
calculateQuarter
This function calculates the quarter according to the offset.
Syntax
Redwood_FCA.calculateQuarter(String inCalc, String inQUARTER)
Example
=$.Redwood_FCA.calculateQuarter(-1, parameters.FiscalQuarter)
Result
Returns 3
on this system at this moment in time.
ccCalculateFiscalPeriod
Return the fiscal period after period calculation from current (+1/-1) company code level, with company code, fiscal year, and period as specified.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccCalculateFiscalPeriod(Long jobId, String inCalc, String inBUKRS, String inFY, String inPeriod)
Example
=$.Redwood_FCA.ccCalculateFiscalPeriod(jobId, -1, parameters.BUKRS, parameters.GJAHR, parameters.PERIOD)
Result
Returns 008
on this system.
ccCalculateFiscalPeriodJob
Return the Return Period after period calculation from current (+1/-1) company code level, company code, fiscal year, and period are retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccCalculateFiscalPeriodJob(Long jobId, String inCalc)
Example
=$.Redwood_FCA.ccCalculateFiscalPeriodJob(jobId, -1)
Result
Returns 008
on this system.
ccCalculateFiscalPeriodParameter
Return the specified parameter from the FiscalPeriod table company code level; company code, fiscal year, and period are specified.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccCalculateFiscalPeriodParameter(Long jobId, String inCalc, String inParameter, String inBUKRS, String inFY, )
Example
=$.Redwood_FCA.ccFiscalPeriodParameter(jobId, 'FirstDayFiscalYear', '3', parameters.BUKRS, parameters.GJAHR, parameters.PERIOD)
Result
Returns 20230101
on this system.
ccCalculateFiscalPeriodParameterJob
Return the specified parameter from the FiscalPeriod table, company code level, with an offset; company code, fiscal year, and period are retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccCalculateFiscalPeriodParameterJob(Long jobId, String inCalc, String inParameter)
Example
=$.Redwood_FCA.ccCalculateFiscalPeriodParameterJob(jobId, '3', 'FirstDayFiscalYear')
Result
Returns 20230101
on this system.
ccCalculateFiscalYear
Return the fiscal year after period calculation from current (+1/-1) company code level; with company code, fiscal year, and period as specified.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccCalculateFiscalYear(Long jobId, String inCalc, String inBUKRS, String inFY, String inPeriod)
Example
=$.Redwood_FCA.ccCalculateFiscalYear(jobId, -1, parameters.BUKRS, parameters.GJAHR, parameters.PERIOD)
Result
Returns 2023
on this system.
ccCalculateFiscalYearJob
Return the fiscal year after period calculation from current (+1/-1) company code level, with company code, fiscal year, and period retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccCalculateFiscalYearJob(Long jobId, String inCalc)
Example
=$.Redwood_FCA.ccCalculateFiscalYearJob(jobId, -1)
Result
Returns 2023
on this system.
ccFiscalPeriodNow
Return the period of today for the provided company.Range is current year and previous year.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccFiscalPeriodNow(Long jobId, String inBUKRS)
Example
=$.Redwood_FCA.ccFiscalPeriodNow(jobId, parameters.BUKRS)
Result
Returns 009
on this system.
ccFiscalPeriodNowJob
Return the period of today, company code-based. The company code is retrieved from BUKRS.Range is current year and previous year.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccFiscalPeriodNowJob(Long jobId)
Example
=$.Redwood_FCA.ccFiscalPeriodNowJob(jobId)
Result
Returns 009
on this system.
ccFiscalPeriodParameter
Return the specified parameter from the FiscalPeriod table; company code, fiscal year, and period are specified.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccFiscalPeriodParameter(Long jobId, String inParameter, String inBUKRS, String inFY, String inPeriod)
Example
=$.Redwood_FCA.ccFiscalPeriodParameter(jobId, 'FirstDayFiscalYear', parameters.BUKRS, parameters.GJAHR, parameters.PERIOD)
Result
Returns 20230101
on this system.
ccFiscalPeriodParameterJob
Return the specified parameter from the FiscalPeriod table company code-level; company code, fiscal year, and period are retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccFiscalPeriodParameterJob(Long jobId, String inParameter)
Example
=$.Redwood_FCA.ccFiscalPeriodParameterJob(jobId, 'FirstDayFiscalYear')
Result
Returns 20230101
on this system.
ccFiscalYearNow
Return the fiscal year of today for the provided company code.Range is current year and previous year.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccFiscalYearNow(Long jobId, String inBUKRS)
Example
=$.Redwood_FCA.ccFiscalYearNow(jobId, parameters.BUKRS)
Result
Returns 2023
on this system.
ccFiscalYearNowJob
Return the fiscal year of today, company code-based. The company code is retrieved from BUKRS.Range is current year and previous year.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.ccFiscalYearNowJob(Long jobId)
Example
=$.Redwood_FCA.ccFiscalYearNowJob(jobId)
Result
Returns 2023
on this system.
checkBalanceInRange
Precondition function that returns true
when a balance is within a range.
Syntax
Redwood_FCA.checkBalanceInRange(Long jobId, String inBalance, String inLow, String inHigh)
Example
=$.Redwood_FCA.checkBalanceInRange(jobId, '123, 45', '100, 00', '124, 00')
Result
Returns true
on this system.
checkSapBalanceInRange
Precondition function that returns true
when a SAP balance is within a range.
Syntax
Redwood_FCA.checkSapBalanceInRange(Long jobId, String inBalance, String inLow, String inHigh)
Example
=$.Redwood_FCA.checkSapBalanceInRange(jobId, '123, 45', "100, 00", "124, 00")
Result
Returns true
on this system.
convertGlobal2LocalSAPUser
Convert global user to local SAP user.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.convertGlobal2LocalSAPUser(Long jobId, String inSapSystemName, String inClient, String inUserName)
Example
=$.Redwood_FCA.convertGlobal2LocalSAPUser(jobId, parameters.SAP_SYSTEMS, parameters.CLIENT, parameters.SAP_CC_EXECUTIVE)
Result
Returns JDOE
on this system.
convertGlobal2LocalSAPUserJob
Convert global user to local SAP user. SAP System and client are taken from the standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.convertGlobal2LocalSAPUserJob(Long jobId, String inUserName)
Example
=$.Redwood_FCA.convertGlobal2LocalSAPUserJob(jobId, parameters.SAP_CC_EXECUTIVE)
Result
Returns JDOE
on this system.
convertGlobal2LocalUser
Convert global user to local user.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.convertGlobal2LocalUser(Long jobId, String inSapSystemName, String inClient, String inUserName)
Example
=$.Redwood_FCA.convertGlobal2LocalUser(jobId, parameters.SAP_SYSTEMS, parameters.CLIENT, parameters.SAP_CC_EXECUTIVE)
Result
Returns JDOE
on this system.
convertGlobal2LocalUserJob
Convert global user to local user.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.convertGlobal2LocalUserJob(Long jobId, String inUserName)
Example
=$.Redwood_FCA.convertGlobal2LocalUserJob(jobId, parameters.SAP_CC_EXECUTIVE)
Result
Returns jdoe
on this system.
convertSAPFieldInternal
Convert list with values from external to internal value If an extValue can not be converted, then the input values is returned.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.convertSAPFieldInternal(Long jobId, String tabField, String extValue)
Example
=$.Redwood_FCA.convertSAPFieldInternal(jobId, 'PROJ-PSPNR', '0-1000')
Result
Returns 0-1000
on this system.
formatAmountSAPUser
Return formatted amount from user format to specified format.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.formatAmountSAPUser(Long jobId, String in, String outFormat)
Example
=$.Redwood_FCA.formatAmountSAPUser(jobId, '100001', '#, ##0.00;#, ##0.00')
Result
Returns 100.001, 00
on this system.
formatDateSAPUser
Return formatted date in user format.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.formatDateSAPUser(Long jobId, String in)
Example
=$.Redwood_FCA.formatDateSAPUser(jobId, '20231101')
Result
Returns 01.11.2023
on this system.
formatSapDate
Format a SAP Date using Java SimpleDateFormat as a string.
Syntax
Redwood_FCA.formatSapDate(String in, String format)
Example
=$.Redwood_FCA.formatSapDate('20230923', 'yyyy-MM-dd')
Result
Returns 2023-09-23
on this system.
formatSapDateLanguage
Format a SAP Date using Java SimpleDateFormat as a string, with language support.
Syntax
Redwood_FCA.formatSapDateLanguage(String in, String format, String language)
Example
=$.Redwood_FCA.formatSapDateLanguage('20230923', 'EEE, d MMM yyyy HH:mm:ss Z', 'de')
Result
Returns So, 23 Sep 2023 00:00:00 +0200
on this system.
formatTimeSAPUser
Return formatted time in user format.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.formatTimeSAPUser(Long jobId, String in)
Example
=$.Redwood_FCA.formatTimeSAPUser(jobId, '101259')
Result
Returns 10:12:59
on this system.
getCurrentSapSid
Return the SID of the SAP system (only valid for an SAP Job).
note
Parameter must be Runtime!
Syntax
Redwood_FCA.getCurrentSapSid(Long jobId)
Example
=$.Redwood_FCA.getCurrentSapSid(parameters.SAPjobId)
Result
Returns PR1
on this system.
getFiscalYearPeriodOfDate
Retrieve a fiscal year-period combination (yyyyPPP) for a given date.
Syntax
Redwood_FCA.getFiscalYearPeriodOfDate(Long jobId, String inBukrs, String inDate)
Example
=$.Redwood_FCA.getFiscalYearPeriodOfDate(jobId, parameters.BUKRS, parameters.DATE)
Result
Returns 2023009
on this system.
getPostingPeriodVariant
Convert list of company codes to List with Posting Period Variants.
Syntax
Redwood_FCA.getPostingPeriodVariant(Long jobId, String inListCompanies)
Example
=$.Redwood_FCA.getPostingPeriodVariant(jobId, parameters.BUKRS)
Result
Returns 0001, 0002, 0003
on this system.
getPseudoVariantName
This function generates a pseudo variant name based on a jobId
. Note that no checks are performed if the specified id ran in an SAP system.
Syntax
Redwood_FCA.getPseudoVariantName(Long jobid)
Example
=$.Redwood_FCA.getPseudoVariantName(12345)
Result
Returns ~JCS0000012345
on this system.
getSapJobOutputId
Retrieve spool-id of an SAP output file.
Syntax
Redwood_FCA.getSapJobOutputId(Long jobId, String sapJobId, String fileName)
Example
=$.Redwood_FCA.getSapJobOutputId(jobId, '', 'step3/spool2')
Result
Returns 19002600
on this system.
getSapReplacement
Return the Replaced input using SAP replacements.
Syntax
Redwood_FCA.getSapReplacement(Long jobId, String repl)
Example
=$.Redwood_FCA.getSapReplacement(jobId, '${F:BATCH_USER}')
Result
Returns JDOE
on this system.
getSapSid
Return the SID of the specified SAP system (only valid for an SAP Job).
Syntax
Redwood_FCA.getSapSid(Long jobId, String sap)
Example
=$.Redwood_FCA.getSapSid(parameters.SAPjobId, 'FCA.PR1')
Result
Returns PR1
on this system.
getSAPUserDetails
Retrieve SAP user details.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.getSAPUserDetails(Long jobId, String inParameter, String inSAPSystem, String inClient, String inUser)
Example
=$.Redwood_FCA.getSAPUserDetails(jobId, 'language', parameters.SAP_SYSTEMS, parameters.CLIENT, parameters.SAP_USER_NAME)
Result
Returns D
on this system.
getSAPUserDetailsJob
Retrieve SAP user details.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.getSAPUserDetailsJob(Long jobId, String inParameter)
Example
=$.Redwood_FCA.getSAPUserDetailsJob(jobId, 'language')
Result
Returns D
on this system.
getSAPUserEmail
Retrieve email addresses of SAP users. Note that the userlist
takes a comma-separated list of SAP usernames.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.getSAPUserEmail(Long jobId, String sid, String client, String userlist)
Example
=$.Redwood_FCA.getSAPUserEmail(jobId, parameters.SAP_SYSTEMS, parameters.CLIENT, parameters.SAP_USER_NAME)
Result
Returns jdoe@example.com
on this system.
getSAPUserPhoneNumber
Retrieve telephone number of SAP user.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.getSAPUserPhoneNumber(Long jobId, String sid, String client, String user)
Example
=$.Redwood_FCA.getSAPUserPhoneNumber(jobId, parameters.SAP_SYSTEMS, parameters.CLIENT, parameters.SAP_USER_NAME)
Result
Returns +31 555 123 456
on this system.
getT001Field
Retrieve a parameter from table T001 a company, defaults to the current company when BUKRS is not specified.
Syntax
Redwood_FCA.getT001Field(Long jobId, String inBukrs, String inField)
Example
=$.Redwood_FCA.getT001Field(jobId, parameters.BUKRS, 'WAERS')
=$.Redwood_FCA.getT001Field( , parameters.BUKRS, 'WAERS')
=$.Redwood_FCA.getT001Field(jobId, , 'WAERS')
Result
Returns USD
on this system.
orgStructureParameter
Return the parameter value from the OrgStructure table with the specified controlling area, company code, and plant code.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.orgStructureParameter(Long jobId, String inParameter, String inKOKRS, String inBUKRS, String inWERKS)
Example
=$.Redwood_FCA.orgStructureParameter(jobId, 'ChartAccount', parameters.KOKRS, parameters.BUKRS, parameters.WERKS)
Result
Returns INT
on this system.
orgStructureParameterJob
Return the parameter value from the OrgStructure table. Controlling area, company code, and plant code are retrieved from standard parameters.
note
Parameter must be Runtime!
Syntax
Redwood_FCA.orgStructureParameterJob(Long jobId, String inParameter)
Example
=$.Redwood_FCA.orgStructureParameterJob(jobId, 'ChartAccount')
Result
Returns INT
on this system.
sapDateExpression
Calculate a SAP Date using an expression.
Syntax
Redwood_FCA.sapDateExpression(String inDate, String inExpression)
Example
=$.Redwood_FCA.sapDateExpression('20230923', 'truncate month')
Result
Returns 20230901
on this system.
setSapJobName
Set the SAP Job Name of the current SAP Job.
Syntax
Redwood_FCA.setSapJobName(Long jobId, String in)
Example
=$.Redwood_FCA.setSapJobName(jobId, 'Closing ' + parameters.KOKRS)
Result
Returns Closing 1001
on this system.
toSapDate
Return the Date portion of DateTimeZone as string for SAP use.
Syntax
Redwood_FCA.toSapDate(DateTimeZone dtz)
Example
=$.Redwood_FCA.toSapDate(parameters.CLS_DATE)
Result
Returns 20190401
on this system.
toSapTime
Return the time portion of DateTimeZone as string for SAP use.
Syntax
Redwood_FCA.toSapTime(DateTimeZone dtz)
Example
=$.Redwood_FCA.toSapTime(parameters.CLS_DATE)
Result
Returns 094515
on this system.
tvarvCalendarDateDay
Return the date as YYYYMMDD for variant processing; uses first day of current month with an offset of open days of a calendar time window.
Syntax
Redwood_FCA.tvarvCalendarDateDay(int xthDay, String twName)
Example
=$.Redwood_FCA.tvarvCalendarDateDay(2, 'System_Week_WorkDays')
Result
Returns 20231111
on this system.
tvarvCalendarDateOffset
Return the current date as YYYYMMDD for variant processing with an offset in days in a calendar time window.
Syntax
Redwood_FCA.tvarvCalendarDateOffset(int offset, String twName)
Example
=$.Redwood_FCA.tvarvCalendarDateOffset(2, 'System_Week_WorkDays')
Result
Returns 20231111
on this system.
tvarvCurrentDate
Return the current date as YYYYMMDD for variant processing.
Syntax
Redwood_FCA.tvarvCurrentDate()
Example
=$.Redwood_FCA.tvarvCurrentDate()
Result
Returns 20230915
on this system.
tvarvCurrentDateOffset
Return the current date as YYYYMMDD for variant processing with an offset in days.
Syntax
Redwood_FCA.tvarvCurrentDateOffset(int offset)
Example
=$.Redwood_FCA.tvarvCurrentDateOffset(12)
Result
Returns 20230927
on this system.
tvarvDateFirstDayCurrrentMonth
Return the first day of current month as YYYYMMDD for variant processing.
Syntax
Redwood_FCA.tvarvDateFirstDayCurrrentMonth()
Example
=$.Redwood_FCA.tvarvDateFirstDayCurrrentMonth()
Result
Returns 20230901
on this system.
tvarvDateFirstDayNextMonth
Return the first day of next month as YYYYMMDD for variant processing.
Syntax
Redwood_FCA.tvarvDateFirstDayNextMonth()
Example
=$.Redwood_FCA.tvarvDateFirstDayNextMonth()
Result
Returns 20231001
on this system.
tvarvDateFirstDayPreviousMonth
Return the first day of previous month as YYYYMMDD for variant processing.
Syntax
Redwood_FCA.tvarvDateFirstDayPreviousMonth()
Example
=$.Redwood_FCA.tvarvDateFirstDayPreviousMonth()
Result
Returns 20230801
on this system.
tvarvDateLastDayCurrrentMonth
Return the last day of current month as YYYYMMDD for variant processing.
Syntax
Redwood_FCA.tvarvDateLastDayCurrrentMonth()
Example
=$.Redwood_FCA.tvarvDateLastDayCurrrentMonth()
Result
Returns 20230930
on this system.
tvarvDateLastDayPreviousMonth
Return the last day of previous month as YYYYMMDD for variant processing.
Syntax
Redwood_FCA.tvarvDateLastDayPreviousMonth()
Example
=$.Redwood_FCA.tvarvDateLastDayPreviousMonth()
Result
Returns 20230831
on this system.
financeTopic