Limitation to COM interface method name
hav
Member Posts: 299
Hi,
I am using NAV 2009 NA SP1.
I have created an ATL COM class CWMSalesHeaders using VC++ and it has a method called "UpdateSalesOrderStatusToInDespatch".
I have written a codeunit in which i have declard an Automation var. SALESHEADERS oF type CWMSalesHeaders COM and there is code which calls SALESHEADERS.UpdateSalesOrderStatusToInDespatch().
When i compile the codeunit, the code SALESHEADERS.UpdateSalesOrderStatusToInDespatch() gets replaced with SALESHEADERS.UpdateSalesOrderStatusToInDesp() and it gives error saying UpdateSalesOrderStatusToInDespatch().method cannot be found. Note that the method name is truncated to UpdateSalesOrderStatusToInDesp(),
Is there any limitation in giving the method name for an ATL COM class that is used in NAV?
or ami i missing something?
Regards,
Hemant
I am using NAV 2009 NA SP1.
I have created an ATL COM class CWMSalesHeaders using VC++ and it has a method called "UpdateSalesOrderStatusToInDespatch".
I have written a codeunit in which i have declard an Automation var. SALESHEADERS oF type CWMSalesHeaders COM and there is code which calls SALESHEADERS.UpdateSalesOrderStatusToInDespatch().
When i compile the codeunit, the code SALESHEADERS.UpdateSalesOrderStatusToInDespatch() gets replaced with SALESHEADERS.UpdateSalesOrderStatusToInDesp() and it gives error saying UpdateSalesOrderStatusToInDespatch().method cannot be found. Note that the method name is truncated to UpdateSalesOrderStatusToInDesp(),
Is there any limitation in giving the method name for an ATL COM class that is used in NAV?
or ami i missing something?
Regards,
Hemant
Regards,
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
0
Answers
-
Did you use interface when you declared class and method in VC ++. If possible please post that code.0
-
Below is the VC++ code for the ATL COM dll:-
WMObject.idl - Interface Definiition Fileinterface IWMSalesHeaders : IDispatch{ .................. [id(7), helpstring("method UpdateSalesOrderStatusToInDespatch")] HRESULT UpdateSalesOrderStatusToInDespatch([in] BSTR SalesHeaderType, [in] BSTR SalesHeaderNo); }
WMSalesHeaders.h - Class Declaration File// CWMSalesHeaders class ATL_NO_VTABLE CWMSalesHeaders : public CComObjectRootEx<CComSingleThreadModel>, public IDispatchImpl<IWMSalesHeaders, &IID_IWMSalesHeaders, &LIBID_WMObjectLib, /*wMajor =*/ 1, /*wMinor =*/ 0> { public: ................ // Interface functions STDMETHOD(UpdateSalesOrderStatusToInDespatch)(BSTR SalesHeaderType, BSTR SalesOrderNo); }
WMSalesHeaders.cpp - Class Definition File//Function to updates the Job status to InDespatch. STDMETHODIMP CWMSalesHeaders::UpdateSalesOrderStatusToInDespatch(BSTR SalesHeaderType, BSTR SalesOrderNo) { ............ return S_OK; }
In NAV, I have created a codeunit "WM Interface" with below definition:
VAR
SALESHEADERS Automation IWMSalesHeaders
SalesHeaderRec Record SalesHeader
BEGIN
.................
SALESHEADERS.UpdateSalesOrderStatusToInDespatch(SalesHeaderRec."Document Type"::Order, SalesHeaderRec."Document No.")
..............
END
When i open the symbol menu, the SALESHEADERS var shows the method name as UpdateSalesOrderStatusToInDesp(). It does not show the full name of the method UpdateSalesOrderStatusToInDespatch(). See below image
I have double-checked the class declaration and definition but i don't think i have made any mistake in giving the method name.
Hope that helps.
Regards,
HemantRegards,
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)0 -
You have unfortunately run into a classic limitation of the AL symbol name length. All symbol names used for functions etc, are limited to 30 characters which is why you see the truncated method name in the editor. To enable your COM object for the AL environment, you will have to ensure that the length of all methods and properties is less than or equal to 30._________________
Niels-Henrik Sejthen
Senior Software Developer
Microsoft Dynamics NAV
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.0 -
Hi,
Thanks for your immediate response
I will rename my COM interface method to UpdateOrderStatusToInDespatch() which counts to 29 char's and hopefully this should comply with the symbol size limitation.
Regards,
HemantRegards,
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions