Retrieve table from automation to Navision

ferrysbferrysb Member Posts: 14
Hi All,

I'm using NAV 2009 SP 1, and I'm creating class library using VS.NET 2003 C# and SAP .NET Connector.

I'm creating function to retrieve table from SAP, and send it to Navision. I've already created the function and Navision can recognized it as automation.

Below is my code on c#, I'm using output value as .NET datatable.

public DataTable SAPInvCheck(string strProdCode, string strPlant)
{
//code to call some function on SAP... ...


DataTable dt = new DataTable();

dt = a.ToADODataTable();
return dt;
}



My question is how can i received the table from my automation to navision ?

Any help is appreciated.

Many Thanks,
Ferry

Comments

  • rdebathrdebath Member Posts: 383
    The only complex type you can get through automation is an automation object. The most obvious way to do this is to serialise your DotNET data structure into an XML document and pass that to Navision in an MS DOMDocument com object.

    One thing I would like to know is how to do this quickly, eg: how do I serialise a DotNET data structure, from code running on a web site, without it calling the C# compiler at runtime.
  • ferrysbferrysb Member Posts: 14
    I have found the solution for this.
    Blog by Tim Larson helping me a lot for this, you can check it out on :
    http://adventuresindotnet.blogspot.com/ ... ation.html

    Thanks,
    Ferry
  • rdebathrdebath Member Posts: 383
    Yup passing COM objects around, it works very well. You may need to beware a little if doing lots of method calls from code running on the Service tier though as a method call from the DotNET compiled code to a COM object seems to take a tremendously long time compared to the same call running on the Classic client or NAS.

    It's so slow that it makes the DomDocument+XMLport solution seem fast. Now that's some achievement. :shock:
  • ferrysbferrysb Member Posts: 14
    rdebath wrote:
    Yup passing COM objects around, it works very well. You may need to beware a little if doing lots of method calls from code running on the Service tier though as a method call from the DotNET compiled code to a COM object seems to take a tremendously long time compared to the same call running on the Classic client or NAS.

    It's so slow that it makes the DomDocument+XMLport solution seem fast. Now that's some achievement. :shock:


    Hi rdebath,

    i want to ask your advise, previously i've succesfully created the function to receive the table from .net automation.
    But currently i'm struggling about how can i send navision table to .NET automation.

    I'm thinking to send XML, but don't know how I should do it.
    Any one, Please kindly help to advise me on this, how can I send navision table ( with many records, and many columns ) to .net Automation ?

    Thank you,
    Ferry
  • rdebathrdebath Member Posts: 383
    I'd say use an XMLPort to create the xml, stream it into a BLOB then stream the blob into an MS-XML DomDocument (MS-XML can 'load' a Navision Stream).

    On the .net side you should be able to open the XML as a record set or similar.
Sign In or Register to comment.