Inventory transfer macro is failing when negative levels allowed

I have a client who needs to run their inventory with negative levels allowed. We are running Sage 300 2021 with update 2

I recorded a macro of doing an inventory transfer from location 1 to 2 with a qty=5.

Location 1 had zero of these items and so it went to -5 and location 2 went to +5 as you would expect. But when I try to run the macro, exactly as recorded, it errors out because the source location has no inventory.

I proved this by running the macro with source and dest locations swapped and no error. In the view IC0730 there is a field called FUNCTION and in the macro this field gets set to "100" just before the process command that fails.

ICTRE1detail1Fields("FROMLOC").Value = "1" ' From Location
ICTRE1detail1Fields("TOLOC").Value = "2" ' To Location
ICTRE1detail1Fields("QTYREQ").Value = "5.0000" ' Quantity Requested
ICTRE1detail1Fields("FUNCTION").PutWithoutVerification ("100") ' Function
ICTRE1detail1.Process

Maybe this "100" function is telling it to check inventory levels? I don't know.

Has anyone experienced this and solved it?

Parents
  • I haven't come across this before. Can you add another line to your macro under the QTYREQ line:

    ICTRE1detail1Fields("QUANTITY").Value = "5.0000"

    And see if that helps?

  • in reply to Django

    Thanks for your comment.

    Actually I just tried something else and it appears to have worked. I moved the "FUNCTION" line after the Process and before the insert and it generated the expected transfer document.  Strange.  

    ICTRE1detail1Fields("FROMLOC").Value = "1" ' From Location
    ICTRE1detail1Fields("TOLOC").Value = "2" ' To Location
    ICTRE1detail1Fields("QTYREQ").Value = "5.0000" ' Quantity Requested

    ICTRE1detail1.Process

    ICTRE1detail1Fields("FUNCTION").PutWithoutVerification ("100") ' Function

    ICTRE1detail1.Insert
    ICTRE1headerFields("PROCESSCMD").PutWithoutVerification ("1") ' Process Command
    ICTRE1header.Process

  • in reply to JohnWilliamTodd

    The 100 isn't documented as far as I've been able to find but changing the order means that the function call isn't going to be made.  So if 100 turns out to be important, then you're missing that step. But it might be something benign.

Reply
  • in reply to JohnWilliamTodd

    The 100 isn't documented as far as I've been able to find but changing the order means that the function call isn't going to be made.  So if 100 turns out to be important, then you're missing that step. But it might be something benign.

Children
No Data