With this object you've access to the SAP Business one Datainterface (DI-API)
Note: If it possible: User Beas Service Layer. This is the new interface for creating documents and support all Beas Rules.
How to use ue_api_sbo:
You can declare it with
declare=[objektname]=ue_api_sbo
Now you can access the DI-API directly via Object Names.
Example: change item-entry
declare=myitem=ue_api_sbo
myitem=getbusinessobject=oitem
myitem=getbykey=A001
myitem=itemname=new itemname
myitem=update
destroy=myitem
You can access almost any Property with api_sbo. api_sbo will not perform any checks.
More information can be found within the SAP SDK Documentation.
don't work with declare=b1=ue_api_sbo declare=b2=ue_api_sbo
because you can have problems with special variables as example "<getlasterror>" After using the DI-API object: Destroy it! Otherwise you can produce bad mirror effects. |
Error handling
The Object return values in the return object
Return code: <objectname.ret_code> -1 = error, 1 = ok
Return Text: <objectname.ret_text> Return last error
Additional information about error you can read with <objectname.getlasterror>.
vdoc.add
if <vdoc.ret_code> = -1 then
message=fehler$error create Order: <vdoc.getlasterror>
end if
Functions like add, getbusinessobject, update, getbykey and so on will return "value"
vdoc.ret_code = 1 = ok
vdoc.ret_code = -1 = error
Additional examples
declare=di_doc=ue_api_sbo di_doc=getbusinessobject=59 di_doc=lines=itemcode=Jesús di_doc=lines=quantity=1 di_doc=add
if <di_doc.ret_code> = -1 then message=error$item not found <di_doc.getlasterror> return failure end if destroy=di_doc |
//Create goods receipt with UserFields declare=di_doc=ue_api_sbo di_doc=getbusinessobject=59 di_doc=lines=itemcode=RM di_doc=lines=quantity=1 di_doc=lines=userfield=U_test2=N di_doc=add
if <di_doc.ret_code> = -1 then message=error$item not found <di_doc.getlasterror> return failure end if destroy=di_doc |
declare=di_doc=ue_api_sbo di_doc=getbusinessobject=59 di_doc=lines=itemcode=RAWMAT_NORMAL di_doc=lines=quantity=100 di_doc=lines=add di_doc=lines=itemcode=RAWMAT_BATCH di_doc=lines=quantity=100 di_doc=lines=batchnumber=batchnumber=<today,yyyymmdd> di_doc=lines=batchnumber=quantity=100 di_doc=lines=add di_doc=lines=itemcode=RAWMAT_SERIAL di_doc=lines=quantity=5 di_doc=lines=serialnumbers=internalserialnumber=<today,yyyymmdd><now,hhmmss>_1 di_doc=lines=serialnumbers=quantity=1 di_doc=lines=serialnumbers=add di_doc=lines=serialnumbers=internalserialnumber=<today,yyyymmdd><now,hhmmss>_2 di_doc=lines=serialnumbers=quantity=1 di_doc=lines=serialnumbers=add di_doc=lines=serialnumbers=internalserialnumber=<today,yyyymmdd><now,hhmmss>_3 di_doc=lines=serialnumbers=quantity=1 di_doc=lines=serialnumbers=add di_doc=lines=serialnumbers=internalserialnumber=<today,yyyymmdd><now,hhmmss>_4 di_doc=lines=serialnumbers=quantity=1 di_doc=lines=serialnumbers=add di_doc=lines=serialnumbers=internalserialnumber=<today,yyyymmdd><now,hhmmss>_5 di_doc=lines=serialnumbers=quantity=1 di_doc=add
if <di_doc.ret_code> = -1 then message=error$item not found <di_doc.getlasterror> return failure end if destroy=di_doc |
//Work with Purchase order declare=di_doc=ue_api_sbo di_doc=getbusinessobject=22 di_doc=cardcode=P001 di_doc=lines=itemcode=Jesús di_doc=lines=quantity=1 di_doc=add
if <di_doc.ret_code> = -1 then message=error$item not found <di_doc.getlasterror> return failure end if
destroy di_doc |
//Create Goods receipt PO based on a purchase order declare=di_doc=ue_api_sbo di_doc=getbusinessobject=20 di_doc=lines=itemcode=Jesús di_doc=lines=quantity=2 di_doc=lines=basetype=22 di_doc=lines=baseentry=1371 di_doc=lines=baseline=0 di_doc=add if <di_doc.ret_code> = -1 then message=error$item not found <di_doc.getlasterror> return failure end if
destroy di_doc |
//Create SAP receipt from production declare=di_doc=ue_api_sbo di_doc=getbusinessobject=59 //di_doc=lines=itemcode=SAP_BOM di_doc=lines=quantity=1 di_doc=lines=basetype=202 di_doc=lines=baseentry=34 di_doc=lines=baseline=0 di_doc=add if <di_doc.ret_code> = -1 then message=error$item not found <di_doc.getlasterror> return failure end if
destroy di_doc |
declare=di_doc=ue_api_sbo di_doc=getbusinessobject=16 di_doc=cardcode=C001 di_doc=lines=itemcode=batchitem di_doc=lines=quantity=2 di_doc=lines=whscode=02 di_doc=lines=batchnumber=batchnum=test di_doc=lines=batchnumber=quantity=1 di_doc=lines=batchnumber=add di_doc=lines=batchnumber=batchnum=test2 di_doc=lines=batchnumber=quantity=1 di_doc=add
if <di_doc.ret_code> = -1 then message=error$item not found <di_doc.getlasterror> return failure end if
setvar=newkey=<di_doc.getnewobjectkey>
destroy di_doc |
declare=di_doc=ue_api_sbo di_doc=getbusinessobject=16 di_doc=lines=itemcode=Jesús di_doc=lines=quantity=1 di_doc=lines=batchnumber=batchnum=111 di_doc=lines=batchnumber=quantity=1 di_doc=lines=basetype=5 di_doc=lines=baseentry=<ls_docentry> di_doc=lines=baseline=<ls_linenum> di_doc=add
//Create Inventory transfer declare=di_doc=ue_api_sbo di_doc=getbusinessobject=67 di_doc=lines=itemcode=RM_B di_doc=lines=quantity=1 di_doc=lines=batchnumber=batchnum=20190209 di_doc=lines=batchnumber=quantity=1 di_doc=lines=fromwhscode=01 di_doc=lines=whscode=02 di_doc=add
if <di_doc.ret_code> = -1 then message=error$item not found <di_doc.getlasterror> return failure end if
setvar=newkey=<di_doc.getnewobjectkey>
destroy di_doc |
debug=y |
extended Debugging |
connect_extern |
connect to external database. see connect_extern |
add |
add a document return variable "value" 0=failure, 1=ok
|
|
cancel |
cancel |
|
close |
close the document |
|
savetofile=<file> |
save document to file |
|
savexml=<file> |
save document to xmlfile |
|
getasxml=<file> |
get document from xml-file |
|
getbusinessobject=<documenttype> |
create business object (see examples). |
|
getbusinessobjectfromxml=<path> |
Load object from definition saved in "path" file |
|
update |
save In Silent-Mode return variable "errortext" with the current Error, only if value=0 |
|
getbykey |
get entry (only char. if numeric: getbykeynum) after loading you can get all information from the current object. Attention: only with correct lower / uppercase |
|
getbykey |
get entry (typ numeric) |
|
silent=true/false |
set silent-Mode in silent-mode beas set only variables and send no error-Meesage |