Extended Code must be smaller then 2^16
SeKo
Hi,I'm running into the boundaries of the extended code limits. You can have max 65536 characters in the extended code part. Since I'm building several forms this is not enough (easily 5-600 lines of code per form). I need to build these forms in the extended part since the customer wants to be able to call them from different locations, so I've put them in functions.
In the database the field is ntext, which should allow 2^30-1 characters, which is more then enough
Can I do something in the short term to get this fixed?
Maybe a long term solution could be to allow multiple code fragments in the extended code so you can group them together.
This problem was already reported in 2009: http://forum.coresystems.ch/topic/3206-extended-code-wird-nicht-mehr-gespeichert/
Thanks!
Sebastiaan
Michael Egloff
Hi Sebastiaan,the restriction of the field size is from the DI of SAP Business One. Although there would be more space, SAP doesn't allow to put more characters into the field. But there's a workaround.
coresuite customize is able to load external dlls. So you can basically copy your extended code to an external dll.
To achieve that you have to do the following steps:
- create an own code project (e.g. in visual studio)
- link needed dlls to this project (e.g. SwissAddOnFramework, SAP Dlls, etc)
- create a new class (e.g. 'SeKoHelper')
- copy your methods from the extended code to this class
- compile it (.Net framework 2.0)
After sucessful compilation you can copy the newly created DLL to the folder 'DLL' of coresuite customize (on my machine 'C:\Program Files (x86)\SAP\SAP Business One\AddOns\COR\coresuite\COR_Customize\DLL'). After a restart of coresuite you can access your external code in the customize moduls.
Some hints:
- only put code into the external dll which you most probably don't want to change anymore. otherwise you have to recompile it everytime again
- if possible make your external code static to easy access it within customize. If not everytime you want to access it you have to create an instance of this class
- for distributing the dll to all clients, have a look at the manual of the [url="http://www.coresystems.ch/downloads"]skype plugin[/url]
SeKo
Thanks! I was considering to do it in the DLL, but since I'm in developing mode this is a bit of a pain in the ass since changes to the code take a some effort to get into B1Maybe the multiple code snippets could be interesting for a future version of Coresuite (allowing more then 1 entry in the Extended Code)?
For now I'll do it like this..
thank you for the quick reply!
SeKo
Hi Michael,I'm having a problem compiling the DLL. In the code I need to use DI objects such as oCompany and oItems. If I write the code in Coresuite Customize Extended Code, I don't need a link to the DLL SAPBobsCOM since Coresuite is doing this for me. If I write the same code, Visual Studio is complaining that he doesn't find the link to this object, but if I add a reference to the SAPBobsCOM object, Coresuite is complaining when I load the SIP file (since the DLL is already referenced).
How can I compile the code in Visual Studio without adding the reference?
This is one line where he's complaining:
SAPbobsCOM.Company oCompany = SwissAddonFramework.B1Connector.GetB1Connector().Company;
Paolo Manfrin
Hi SeKo,what's exactly the exception that get raised?
If you don't want to include dlls you have to use reflection.
kind regards,
paolo
SeKo
Hi Paolo,If I use the SAPbobsCOM objects in the DLL I need the reference to the sapbobscom.dll, but if I load the sip file into SAP B1, coresuite gives me an error that the SAPbobsCOM.DLL is already linked (through Coresuite itself).
If I remove the reference in the Visual Studio project, I can't compile the file.
I'm not using the Extended Code as much anymore, so this is not urgent. But it would be nice to have a solution.
Paolo Manfrin
Hi SeKo,in order to look up for a solution I need to know exactly the error message raised by the compailer.
If you can provide me this info then I can give you a more detailed answer.
It might be that the Version number of the dlls you're referencing in your project is different from the one used in customize.
that's why you get the compilation error.
hth
paolo
Michael Egloff
Hi Sebastiaan,just to be sure: when you create the sip with your own created dll you must not include the SAPbobsCOM in the sip.
0
Please sign in to leave a comment.
Comments
0 comments