web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Error 5046 Invalid Memory Array Handle Passed to Kernel - Object Model

(0) ShareShare
ReportReport
Posted on by 27

I have a simple project to creating a PO from SALES Order screen. Dynamics SL already has that feature , but it creates a linked PO. So I need to customize SO and PO screen so that lines from SO are simply copied to grid of PO screen with "goods for inventory" as line type.  I have run into several issues trying to use Object Model for this:

1.  I am able to launch the PO screen using Launch command and pass sales order number as a parmeter.

2. The PO screen opens and retrieves the lines from SOLINE based on this paramter , but when I issue the command  

sivMyApp.Controls("cpurchtype") = "Goods for Inventory"

I get  the error Error 5046 Invalid Memory Array Handle Passed to Kernel - Object Model

This error  does not occur if I invoke the PO screen directly from menu and press a button to auto-insert a line in the grid.  Aparently the sivMyApp object does not get initialized with new screen when it is called with "launch" method.

I tried to replace my Launch command on SO screen with startappandautomate but that does not allow interactive user to input other fields on PO and save it.  Then I also tried to use setobjectvalue calls instead of sivmyapp calls on PO screen to insert lines in grid, but it disables the Qty column and creates (actualy saves) bad data in Purchase order detail table.  Apparently the setobjectvalue for first colunm in the grid (purchase type) causes swimapi to disable the order qty.

Any help  will be appreciated.

Thanks. 

 

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hey Sam,

    Did you figure out why were you getting this error? Any root causes? I am new to SL and have been getting this error on a customized page. It runs fine when i log in as SYSADMIN but fails to run when logged in as user.

  • Erich Strelow F Profile Picture
    16 on at

    I've had this same error. Just as you say, the lvalue in the assingment isn't initialized yet.

    I usually end up with a workaround. You probably want the PO screen to be spawned from iside the SO screen and show the pre-loaded grid. I really think SL's design is not well suited for this and that's why there are very few "drill down" kind of screens.

    Check out the logic between inventory inquery (1022000) and inventory transactions (1022300). You can spawn the transactions from within the inventory, but the child screen gets loaded only with a predefined search criteria. You have to actually click a CmdButton to show the grid. It's like "click here to see what you expected to have seen already".

    What I'm trying to say: try to insert a button that say "pre-load lines from passed SO". Inside the button event you will be able to use sivmyapp calls. It may annoy the users, but gets the job done.

  • Community Member Profile Picture
    on at

    Thank you Erich for your response.

    My issue isn't in Inventory module, its on Vendor Maintenance page (Customized). I have couple of dropdowns in the form which are populated using the cursor.

    Everything is fine for SYSADMIN, the dropdowns populate but when i try to open the form for other users, the page just hangs without logging any error in Windows Event Viewers. I suppose it's something to do with cursor(used to populate dropdown) or permissions.

    Also, I would like to know how do we change the vba code and debug the application/form? Because when we change the code, save it and close the customization mode. Then, running the application/form doesn't really reflect the changes. The changes doesn't seem to be saved.

  • Erich Strelow F Profile Picture
    16 on at

    If you are running SL with Windows Authentication, there's some tweaking required. SL is indeed compatible with Windows Authentication, but in some runtime scenarios SL establish database sessions using wildcard users. These are the so called E8F575915A2E4897A517779C0DD7CE and 07718158D19D4f5f9D23B55DBF5DF1 users.

    To be honest, I don't really understand nor make any sense out of this. The point is if you create custom database objects, such as stored procedures and views, you should follow the tweaks. If not, only SYSADMIN users will be able to access them. SL does provide a tool for these. Please research the "Synchronizing Ownership and Security" tool. Some users freak out on doing this. There are a couple of good blog articles on this to help you through.

    In short, GRANT sentences are needed:

    grant EXECUTE ON [dbo].[your-favorite-sp] TO [E8F575915A2E4897A517779C0DD7CE]
    GO
    grant control ON [dbo].[your-favorite-sp] TO [MSDSL]
    GO 
    grant control ON [dbo].[your-favorite-sp] TO [TrustedWebService]
    GO
    

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans