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):

  1. Prepare a scenario step with Inboud:void (timer triggered), Outbound:void (or n.a.)
  2. In that scenario prepare atoms as follows:
    1. SQL Call (to retrieve the DocEntry list)
    2. Branch with path and always atoms (to pass all the relevant headers of MSGs) — do NOT use the otherwise variant for this solution
    3. In Path: For-Each atom
    4. In Path: To Queue atom
    5. In Path: Join (For-Each closing)
    6. Unbranch
    7. Final XSL (to return the “R” payload otherwise you might get error messages)
  3. Prepare a sub-scenario with Inbound:Queue (use the scenario name in reference in atom definition from 2.4.) and Outbound:SAPB1(close method)
  4. In that scenario use following atoms:
    1. 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.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Agneesh Jain

    Hi,

    We always have setting to cancel document automatically in adminstration->document setting in B1.

    Do you have business requirement to close partially closed sales order.

    Regards,

    Agneesh

    (0) 

Leave a Reply