Register new Object

A Object present a SQL Table. BSL is always only a Bridge between ODATA and 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)

if more then 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 return follow 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.

 

Follow properties available

Property

Description

table={tablename}

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

Example OCLG

post=true/false
delete=true/false

put=true/false

Define, if the

POST

DELETE

PUT

command is possible.

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

[objectname/post] [objectname/delete] and so on

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

Allow to define a general main filter

Example: This is only for items starting with "A"

 

mainfilter=substring("OITM"."ItemCode",1,1)='A'

join

Allow to create join for the Tables

 

example:

table=BEAS_FTHAUPT

column=name=DocEntry<tab>sql="BEAS_FTHAUPT"."DocEntry"<tab>fieldtype=i
column=name=ItemCode<tab>sql="BEAS_FTPOS"."ItemCode"<tab>fieldtype=c
// define join, which you need for main SQL Statement (all in one line, linebreak not allowed)
join=INNER JOIN "BEAS_FTPOS" on "BEAS_FTPOS"."BELNR_ID"="BEAS_FTHAUPT"."BELNR_ID" INNER JOIN "OITM" on "OITM"."ItemCode"="BEAS_FTLPSO.ITEMCODE"

 

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]

Follow transaction types supported: issue, issuewo, receipt, receiptwo, timereceipt

example:

Work order filter for $transaction=timereceipt

filtertransactiontimereceipt=coalesce("BEAS_FTPOS"."STARTTIMEREQUEST",0) <> 1

joincollection

Support follow properties

Property

Description

name

Name of target object

join

SQL command for Join

Example: Join from Work order position Production UoM to UoM Table

joincollection=UoM<tab>join=inner join "BEAS_ME" on "BEAS_ME"."ME_ID"="BEAS_FTPOS"."ME_VERBRAUCH"<tab>

 

Note: Special case is Object Item, because this can create additional relation to other tables. Here you must define only the source field

joincollection=name=Item<tab>join="BEAS_FTPOS"."ItemCode"<tab>relation=ItemCode

 

Examples:

Relation between Work order Position and Warehouse (here you need always OWHS and BEAS_WHS)

(Note: write all in one line!)

joincollection=name=WareHouse<tab>LEFT OUTER JOIN "OWHS"  on "OWHS"."WhsCode"="BEAS_FTPOS"."WhsCode" 

    LEFT OUTER JOIN "BEAS_WHS" on "BEAS_WHS"."WhsCode"="OWHS"."WhsCode"<tab>relation=WhsCode

Relation

Field Name for Link for the $expand function

FieldName (for both sides)

or "Target field name" = "Source field name"

or "FieldName","FieldName",...

Note: object field name, not database field name

 

Example: Relation between Work order Position and Work order BoM:

... relation=DocEntry,LineNumber