E: Close all documents

With follow example you can close all documents, example all sales orders

 

beasscript-logo-small

declare=vdoc=ue_api_sbo

// Create Sales order object
vdoc.getbusinessobject=17;
// Read all open documents
instance datastore r
r.select "ORDR"."DocEntry" from "ORDR" where "DocStatus"='O'
// Close all
for i=to <r.rowcount>
  r.setrow=<i>
  vdoc.getbykey=<r.docentry>
  vdoc.close
next
destroy=r
destroy=vdoc