Working with Beas Service Layer
 
declare this with
 
declare=b=ue_bsl
or
instance bsl b
 
with this object you can use the beas service layer as object
Example: Get information from Item
 
instance bsl b
b.get=Item("RM")
messagebox=<b.jstring>
 
Save result in JSON String
instance bsl b
instance json j
b.get=Item("RM")
j.parse=b
 
More see
 beas service layer command GET with beas script
 beas service layer command POST with beas script
 
Methodes
Function 
 | 
Result 
 | 
b.get 
 | 
instance bsl b 
b.get=Item("RM") 
  
messagebox=<b.jstring>  <= return result as JSON string 
messagebox=<b.ItemName> <= return ItemName from first row 
messagebox=<b.code> <b.text> <= return return code and return text (status/Error text 
  
json j 
j.parse=b  <= move result to a json object 
 | 
 
 
 
 | 
b.getstring 
 | 
The result is in property <b.value> 
if result has only 1 line 
{"value":{{"ItemCode":"RM","ItemName":"Raw Material / Normal"}} 
if result has > 1 line 
{"value":  
[ 
{"ItemCode":"RM","ItemName":"Raw Material / Normal"},{"ItemCode":"RM_B","ItemName":"Raw Material / Batch"},{"ItemCode":"RM_B_N","ItemName":"Raw Material / Batch"}, 
] 
} 
  
Example: 
instance bsl b 
b.getstring=Item("RM")?$select=ItemCode,ItemName 
messagebox=<b.value> 
=> {"value": {"ItemCode":"RM","ItemName":"Raw Material / Normal"}} 
  
 | 
 
 
 
 | 
b.post 
 | 
With post command you can execute the ODATA Post  
post=[command]=[json string] 
  
Example: Create Sales Delivery document in sap 
instance bsl b 
b.post=SalesDelivery=& 
  {"CardCode":"S001","DocumentLines": [& 
  {"ItemCode": "RM","WhsCode":"01", "Quantity":2 }]} 
messagebox=<b.code>, <b.text>, <b.value> 
  
Return follow information 
0 = all ok 
79 = the created docentry number 
{"DocEntry":79,"DocNum":79,"TransactionId":7000} all information as json string 
 | 
 
 
 
 | 
b.select 
 | 
This command is faster as b.get 
But with follow limitation 
- return only 1 line 
- you can't parse this in json object 
  
Example 
instance bsl b 
b.select=Item("RM")/ItemName/Value 
messagebox=<b.value>     => return item name 
messagebox=<b.ItemName>  => return item Name 
  
instance bsl b 
b.select=Item("RM") 
messagebox=<b.value>     => return empty string 
messagebox=<b.ItemName>  => return item Name 
 | 
 
 
 
 | 
 
 
Properties
Property 
 | 
Result 
 | 
<b.code> 
 | 
return code from last get/post command  
instance bsl b 
b.get=Item("wrongitemcode") 
messagebox=<b.code> / <b.text> 
=>  "404 / The requerst resource is not found" 
 | 
<b.text> 
 | 
return text from last get/post command 
 | 
<b.value> 
 | 
return value from last get/post command 
 | 
<b.jstring> 
 | 
return complete result in json format from last get command 
 | 
<b.[fieldname]> 
 | 
return field name from last get/select command 
Example 
instance bsl b 
b.get=Item("RM") 
messagebox=<b.ItemName> 
 |