Customization Library Template

Template code for the cc library is generated in the sb library. The template contains assisting defines to invoke the tlbctinterface library, including error handling. Additionally, some (commented) example code is included to demonstrate how to use the customization library. All data types that can be used are documented.

For example, when generating the runtime for a ppmmm800 business object the template can contain:
|##############################################################################
|################### Customization Library part ###############################
|##############################################################################

| Customization library for the Order business object.
| Do not use compile flag CUSTOMIZATION_LIBRARY. This flag is used to escape
| the code below, because it is not a part of the ppmmmbl800sb00 library.
| You copy the code below to the ppmmmbl800cc00 in your customization VRC
| and use it as a starting point for a customization library.

#ifdef CUSTOMIZATION_LIBRARY

|------------------- DO NOT CHANGE THIS PART ----------------------------------

| Template for ppmmmbl800cc00 (Order)
| Template generation date: 26-Feb-2009 16:45:25

#pragma used dll "otlbctinterface"

#define initialize()
^	retl = tlbctinterface.cust.initialize(o.xml)
^	if retl <> 0 then
^		return(retl)
^	endif

#define addTableField(elementName, tableCode, columnName, dataType)
^	retl = tlbctinterface.cust.add.element(o.xml, elementName,
^					tableCode, columnName, dataType)
^	if retl <> 0 then
^		return(retl)
^	endif

#define addCdfField(elementName, tableCode, cdfName, dataType)
^	addTableField(elementName, tableCode, "cdf_" & cdfName, dataType)

| Use addTableField to include data for a table field as defined in the
| data model. This could be a customer-specific table field, or a table
| field that exists in the standard, but is not yet used in the business object.
| Use addCdfField to include data from a customer-defined field in the
| business object. Customer-defined fields are maintained in the
| Customer-Defined Fields (ttadv4194m000.) session.
|
| The parameters to be used are:
| 1. elementName (string): the name that must be used to identify the
|    element in the business object data XML.
| 2. tableCode (string): the code of the table that contains the custom
|    data to be included.
| 3. columnName or cdfName (string): the name of the table column or
|    customer-defined field. Note that customer-defined fields have a
|    prefix ('cdf_') in the table column name; this prefix must NOT be
|    included in the cdfName.
| 4. dataType (string): the data type of the column or customer-defined
|    field.
|    The following data types can be used:
|    - "String"
|    - "Integer"
|    - "Numeric"
|    - "Date"
|    - "DateOnly"
|    - "Checkbox"
|
| Some examples:
| addTableField("CustomDate", "ppmmm001", "cdat", "Date")
| addCdfField("CustomNote", "ppmmm001", "note", "String")
| addTableField("CustomAmount", "ppmmm001", "camn", "Numeric")
| addCdfField("NumberOfDeviations", "ppmmm001", "cdev", "Integer")
| addTableField("Checked", "ppmmm001", "cchk", "Checkbox")

|------------------- Custom implementation ------------------------------------

function extern long ppmmm.bl800cc00.get.additional.elements(
	const	string	i.component.path,
	ref	long	o.xml)
{
DLLUSAGE
Desc	Define the additional elements (columns) for a component.
Input	i.component.path - the component path.
Output	return value - 0 (OK) or DALHOOKERROR (one or more DAL error
		messages are set)
	o.xml - if return value is = 0: an xml structure containing
		the details on custom fields (if any)
ENDDLLUSAGE

	long	retl		| return value to be checked

	initialize() | do not remove this line

	on case i.component.path

	case "Order":
		| Custom data element for this component is Order.Header.UserArea.
		| Fill in your table fields here.
		| You can use data from one of the following table(s):
		| ppmmm800.
		| For example:
		|addTableField("CustomDate", "ppmmm800", "cdat", "Date")
		|addCdfField("AdditionalNote", "ppmmm800", "note", "String")
		break

	case "Order.OrderLine":
		| Custom data element for this component is Order.OrderLine.UserArea.
		| Fill in your customized table fields here.
		| You can use data from one of the following table(s):
		| ppmmm801, ppmmm802.
		| Custom data from the ppmmm802 table will only be used when a
		| corresponding row exists in that table.
		| For example:
		|addTableField("CustomDate", "ppmmm801", "cdat", "Date")
		|addCdfField("AdditionalNote", "ppmmm801", "note", "String")

		break

	| no custom data location available for component "Order.OrderLine.SubLine"

	default:
		| Nothing
	endcase

	return(0) | OK
}