Recently I’ve had a task to prepare a solution which would automatically close SAP Business One order documents of certain type. After a short analysis I’ve decided to use B1iF for this purpose. I must admit – I am a novice at B1iF, so my solutions (the whole thing I was trying to do and am writing about now) might seem trivial to You. Anyway…
At first it all seemed pretty straightforward: Get a list of DocEntry of documents that meet my criteria and call B1 Object update method on each of them. Apparently the DocStatus field is read only – updating the object was a no-go.
Approach no. 2: get the list of DocEntry, run those through XLS to prepare a <b1mutlimsg>-style message to pass to SAP B1 outbound channel ready to run and update (or – close) method. But I kept getting errors.
Approach no. 3 proved to be successful and it was not so obvious to me (hence this post):
- Prepare a scenario step with Inboud:void (timer triggered), Outbound:void (or n.a.)
- In that scenario prepare atoms as follows:
- SQL Call (to retrieve the DocEntry list)
- Branch with path and always atoms (to pass all the relevant headers of MSGs) — do NOT use the otherwise variant for this solution
- In Path: For-Each atom
- In Path: To Queue atom
- In Path: Join (For-Each closing)
- Final XSL (to return the “R” payload otherwise you might get error messages)
- Prepare a sub-scenario with Inbound:Queue (use the scenario name in reference in atom definition from 2.4.) and Outbound:SAPB1(close method)
- In that scenario use following atoms:
- Final XSL transforming the incoming DocEntry into BOM/BO od B1out style xml to pass to outbound channel in “R” Payload
That’s it – configure the necessary SysIDs, time trigger intervals and set your scenario package running.