Register new Object

An Object presents a SQL Table. BSL is always only a Bridge between ODATA and the SQL Server.

The table Name is mandatory. For every Object you can add function calls or POST command.

 

In Area [register collections] you can add own objects.

 

In this area you can define the collection / object  with property: primary-key, description,key-mandatory

 
for example SAP Activity for work order call. We use the SAP Activity

[register collections]

CompanyWorkOrderActivity=primary=ActivityCode/i<tab>description=Activity for Work order

[/register collections]

 

Property

Description

Name

On first place you define the name of the object. The name must be unique!

primary

Define the primary key (the object field name, not the sql field name) / Field Type (c for char or i for integer/number)

in case of  more than one field, define fieldname, fieldname, example: DocEntry/i,LineNumber/i or ItemCode/c

description

Description for this object name

keymandatory

Mandatory key fields. Example: In warhouse object the warehouse id is mandatory.
In normal case you don't need to define it.

 

All additional details described in the same name area

// Define all Columns, Functions, Table and other properties

[register CompanyWorkOrderActivity]

table=OCLG

post=true

column=name=ActivityCode<tab>sql="OCLG"."ClgCode"<tab>fieldtype=i

column=name=Details<tab>sql="OCLG"."Details"<tab>maxlength=20<tab>fieldtype=c

function=name=CountOfEntries<tab>description=Return count of existing activities

[/register CompanyWorkOrderActivity]

 

 

This returns the following result:

GET CompanyWorkOrderActivity
{
    "value": [
        {   "ActivityCode": 467,
            "Details": "item changed: 2-uom-test2 from manager"
        }, // and all other entries...
   ]
}

 

You can use the object with $select, $filter, $order and all other existing BSL functions.

Note: Always insert the company as suffix, otherwise naming conflicts can occur.

 

The following properties are available:

Property

Description

table={tablename}

Define the table, which is related to this object. This is mandatory.

Example OCLG

post=true/false

Define if the

POST

command is possible.

If you define this as true you must define an area:

[objectname/post]

mainfilter=[sql filter]

You can define a main filter, which is always active, if you execute a get command.

aliasname

You can define an alias name for the SQL statement. Use this, if you work with join and you  need a table more than once.

column

Add a column / property to the Object

function

Add a function with the following properties.

mainfilter

join

filter_[xxx]

Define filter, if property xxx is defined.

Follow properties supported: docentry, linenumber, linenumber2, docentry, personnelid, whscode

filterbranch

Define filter for using $branch

filtertransaction

Define filter for using $transaction

fitertransaction[xxx]

joincollection