Template Programming
Template Programming
T24 Applications
Allows input of data
Stores data in database
Performs a business functionality
Example: Funds Transfer, Money Market
T24 Tables
Allows input of data
Stores data in database
Holds static data used by other applications
Performs no business functionality on its own
Example: Category, Currency
Slide 1
Applications in T24
Slide 2
Functions in T24
There are different functions that can be used with these applications
I Input
A Authorise
S See
L List
V Verify
C Copy
D Delete
R Reverse
H History Restore
2 Second Authoriser
P Print
Slide 3
Application Classification
CUS – F<MNE>.<APPLICATION>{$<SUFFIX}
INT – F. <APPLICATION>{$<SUFFIX}
Slide 4
Definitions from T24
What is a Product?
One or more applications and tables that work together to perform a
business functionality
Slide 5
Before Creating An Application
Slide 6
Application flow in T24 – Always the same
When we enter data and hit the edit button, the function is taken as I and the
data is validated as an ID of the application
3. Open record
Checks if record exists with same ID, if yes read from file and load into cache
5. Authorise Record
Slide 7
We have decided
Business Functionality
When and What we must do
Other Features
-Functions My new
-Product Information Application
-Type of Application H, U. L etc.,
-Classification FIN, CUS, INT etc.,
Slide 8
Code…
Slide 9
What now…
Business Functionality
When and What we must do
METHODS
Other Features
-Functions My new
-Product Information Application
-Type of Application H, U. L etc.,
-Classification FIN, CUS, INT etc.,
Properties defined in TEMPLATE
Slide 10
Common Variables
Variables in T24
Global
Local
Slide 11
A Must Know
ID.NEW
ID.OLD
ID.NEW.LAST
R.NEW()
R.OLD()
R.NEW.LAST()
Slide 12
What Happens When A New Record Is Created In T24?
Slide 13
ID.NEW
Slide 14
R.NEW
ID.NEW holds the ID of the currently opened record, while R.NEW holds the
actual record. ‘R’ in the variable name stands for ‘Record’
Inference : Since the size of R.NEW is now restricted to 500 it implies that
no application in T24 has more than 500 fields. The day it exceeds 500,
C$SYSDIM’s value will be increased
Slide 15
When Happens When A Record Is Authorized?
Values from R.NEW only are written into the database when record is COMMITTED/AUTHORISED
Slide 16
ID.NEW.LAST
You may ask, ‘Will the ID of a live record and a unauthorized record
ever be different?”
No. This variable enables us to know, programmatically whether an
unuathorised record exists for the currently opened record
Slide 17
R.NEW.LAST
Slide 18
What Happens When An Authorized Record Is Amended?
Values from R.NEW only are written into the database when record is COMMITTED/AUTHORISED
Slide 19
ID.OLD
Slide 20
R.OLD
Slide 21
What Happens When A Change On An Authorized Record Is Authorized?
The old authorized record (With Sector 1100) goes to history (FBNK.SECTOR$HIS)
Slide 22
Common Variables – I_COMMON
AF, AV, AS – Holds the field position, multi value position and sub
value position respectively
Slide 23
Some more Common Variables
R.USER - Loaded as soon as the user logs in, holds the USER profile
LCCY, LNGG
Holds Local Currency as defined in company
Holds the language from the USER profile
Slide 24
The TEMPLATE Subroutine
Slide 25
Other Component of an Application
What does T24 do with all the properties of the application we define in
the TEMPLATE subroutine?
PGM.FILE Entry
Type of application
Special properties (additional info)
FILE.CONTROL Entry
File suffixes available
Classification
Slide 26
Other Component of an Application
STANDARD.SELECTION Entry
Actual field names
Field properties
Slide 27
Getting Started
Each application that we create, must have its own copy of the
TEMPLATE
Slide 28
Table Objects
Slide 29
How are the properties used?
Slide 30
I_Table
COMMON/OBJECT.TEMPLATE/Table.fieldNeighbourArray(C$SYSDIM),Table.name,
Table.title,
Table.stereotype,
Table.product,
Table.subProduct,
Table.idPrefix,
Table.blockedFunctions,
Table.systemClearFile,
Table.relatedFiles,
Table.isPostClosingFile,
Table.equatePrefix,
Table.triggerField,
Table.classification,
Table.noInputFields,
Table.inputtableFields,
Table.lastApplication,
Table.idPrefix,
Table.blockedFunctions,
Table.systemClearFile,
Table.relatedFiles,
Table.isPostClosingFile,
Table.equatePrefix,
Table.triggerField,
Table.lastCompany,
Slide 31
How is TEMPLATE and THE.TEMPLATE related?
Slide 32
EB.EXECUTE.APPLICATION
SUBROUTINE EB.EXECUTE.APPLICATION(APPLICATION.NAME)
Table.name = ''
CALL @APPLICATION.NAME
IF Table.name THEN
CALL THE.TEMPLATE ;* We need to call the central template routine
END ELSE
Table.lastApplication = "" ;* We've called a non central template
END
Slide 33
THE.TEMPLATE Subroutine
Slide 34
Methods in Template Programming
Slide 35
Methods
Slide 36
I_METHODS.AND.PROPERTIES
Slide 37
I_METHODS.AND.PROPERTIES
Slide 38
Methods in Template Programming
INITIALISE
FIELDS
FUNCTION
ID
RECORD
VALIDATE
PREVIEW
OVERRIDES
PROCESS
AUTHORISE
RUN
Slide 39
THE.TEMPLATE
Slide 40
Behind the Scenes – THE.TEMPLATE
Initialise
The first method to be executed when an application is launched
Fields
The next method to be executed
Function
This is executed after a function is entered by the user. If no function is
entered, the default is Input.
ID
Executed after the function entered is validated. Validated ID, can modify ID
if required
Slide 41
Behind the Scenes – THE.TEMPLATE
Record
Executed before the record requested (existing or new) is displayed to the
user
Validate
After values are defaulted (if any) all data is validated
Preview
After data is validated, a delivery preview is available
Overrides
Overrides if any are generated now
Slide 42
Behind the Scenes – THE.TEMPLATE
Process
If all overrides are accepted, then this method is called before the record is
written to the $NAU file
Validate
All data is validated twice, once during commit and once during authorise
Authorise
This is executed after the Authorise button is clicked
Slide 43
Using the Template Methods – Common Variables Available
INITIALISE
Anything that needs to be done as soon as an application is launched can
be done here. It is not a mandatory method
FIELDS
This is the method in which an applications fields are defined. This is a
mandatory method as an application must have at least one field
FUNCTION
Code that need to be executed depending on the function entered,
manipulation of the function itself can be done here (V$FUNCTION)
ID
Special editing to the ID entered, special validations to the ID (ID.NEW)
RECORD
Editing of the requested record before display to the user (R.NEW,
R.NEW.LAST,R.OLD)
Slide 44
Using the Template Methods
VALIDATE
Special validation of data
R.NEW, R.NEW.LAST, R.OLD, E, Subroutine ERR
OVERRIDES
Overrides if any, must be raised here
R.NEW, R.NEW.LAST, R.OLD, ETEXT, Subroutine STORE.OVERRIDE
PROCESS
Processing that has to be done before the record is written to the $NAU file
Limits
Accounting
Charges
Slide 45
Using the Template Methods
AUTHORISE
Processing to be done before record is written into LIVE file
Accounting
Delivery
Updating associated applications
RUN
This method is called only for W type applications that use the Verify
function
Slide 46
T Array
Slide 47
T Array
T(FieldPosition)<3> - NOINPUT/NOCHANGE/EXTERN
NOINPUT – Field never available for input
NOCHANGE – Field not inputtable after record is authorised
EXTERN – Field is cleared if record is copied
T(FieldPosition)<5> - Justification
Default Left justified, no need to specify T(FieldPosition)<5>
Right justified (R) and center justified (C ) are the other 2 options
Slide 48
T Array
T(FieldPosition)<8> - NOMODIFY/NODELETE/NOEXPAND
No Modification or changes allowed to multi value set after first
authorisation
Multi value set cannot be deleted after record is authorised
Multi value set cannot be expanded further after authorisation
T(FieldPosition)<9> - HOT.FIELD/HOT.VALIDATE/WEB.VALIDATE
HOT.FIELD causes field to be validated immediately
HOT.VALIDATE causes all fields to be validated
WEB.VALIDATE triggers validation at web server level
Slide 49
Built-in Data Types
Slide 50
I_Datatypes
COMMON/DataTypeCommon/DataType.list,
DataType.nArrays,
DataType.tArrays,
DataType.checkFiles
Slide 51
TableUtil.loadFieldTypes
IF NOT(DataType.list) THEN
CALL TableUtil.loadFieldTypes
END
Slide 52
TableUtil.loadFieldTypes
SUBROUTINE TableUtil.loadFieldTypes
id = "T24.STRING"
length = 35
type = "A"
file = ''
GOSUB addBasicType
addBasicType:
typePos +=1
DataType.list<typePos> = id
DataType.nArrays<typePos> = length
DataType.tArrays<typePos> = LOWER(type)
DataType.checkFiles<typePos> = file
RETURN
Slide 53
Field Definitions
Field Definitions
Slide 54
Defining Fields – API’s
Slide 55
Table.defineId
Table.defineId(idName, dataType)
It takes 2 parameters, the id name (ID.F item) and the data type of the
key
Slide 56
Table.defineIdProperties
Table.defineIdProperties(idName, dataType)
SUBROUTINE EB.DEBIT.CARD.PARAMETER.FIELDS
dataType = ''
dataType<2> = 16.1
dataType<3> = ''
dataType<3,2> = 'SYSTEM'
CALL Table.defineId("DB.PARAMETER.ID",dataType)
Slide 57
Table.addField
CALL Table.addField("XX.LL.DESCRIPTION",T24_String,‘‘,‘‘)
Slide 58
Table.addFieldDefinition
CALL Table.addFieldDefinition("XX.LL.DESCRIPTION",35,‘A‘,‘‘)
Slide 59
Table.processArgs
Slide 60
Field.setAttributes
Slide 61
Table.addFieldWithEbLookup
Slide 62
Table.addVirtualTableField
Slide 63
Field.setDefault
CALL Table.addField("START.DATE",T24_Date,Field_NoInput,'')
CALL Field.setDefault(TODAY) ;* Assign default value
Slide 64
CHECKFILES
Slide 65
Field.setCheckFile
CALL Table.addField("CUSTOMER",T24_Customer,Field_Mandatory,'')
CALL Field.setCheckFile("CUSTOMER")
Slide 66
Table.addAmountField
Slide 67
Table.addOptionsField
CALL Table.addOptionsField("WITHDRAW.SWIPE","S_W",'','')
Slide 68
Table.addYesNoField
Slide 69
Table.setAttributeOnFields
Table.setAttributeOnFields(attribute, fieldList)
Loops through each field in fieldList and sets the atribute in the third
field of the T array. Loops through each field in fieldList and sets the
atribute in the third field of the T array
Slide 70
Table.addReservedField
All new applications must define a set of reserved fields that can be
used to add extra fields to the application without the need to change
the layout of the data
Slide 71
Table.addDeliveryReferenceField
Applications that raise delivery events must define a field to hold the
delivery references
CALL Table.addDeliveryReferenceField(neighbour)
Slide 72
Table.addLocalReferenceField
Local reference fields allows T24 clients to add user definable fields to
the application.
CALL Table.addLocalReferenceField(neighbour)
Slide 73
Table.addStatementNumbersField
Applications that raise accounting entries must define a field to hold the
entry ids that have been raised
CALL Table.addStatementNumbersField(neighbour)
Slide 74
Table.addOverrideField
CALL Table.addOverrideField
Slide 75
How to create additional components?
Slide 76
How to create additional components?
Slide 77
EB.DEV.HELPER
Verify record
Slide 78
When to create which additional component?
Slide 79
Workshop
Slide 80