Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAS 200 BOI (Business Object Interface) Examples. 1

Status
Not open for further replies.

sactowngirl

Programmer
May 30, 2008
18
Does anyone have some code examples of how to create Sales Orders or accessing MAS 200 objects using the BOI. I already entered the Object Interface Key in the System Configuration module, but I don't see any difference. I'm trying to do it for a C# app (ASP.NET). I already have the MAS90ObjectInterface manual but it doesn't help me that much. I'm looking for some code examples... and I can't wait for the next BOI class since it's until the end of the next month.

Any help will be really appreciated,

A.
 
I did see some posts with links that doesn't work anymore or

both links redirect to listech.net and they don't work. I also saw some post where people were suggesting taking the class instead and I wish I can take one.. but I already looked on it and it's until July 20 or 23...

If you know where is that example, I'll really appreciated if you send me the link.

Thanks.
 
Sorry about that, they are my links and I have since done some things to that site. Let me find those files and update the link.

-Adam
 
Alright here are updated links, by the way these took a extremely long time to find and track down. One is the course curriculum and the other is a set of examples in various languages. The interface isn't hard to work with, but if you have some specific questions post here and I will do my best to help.


-Adam
 
Wow... THANK YOU very much for your great (and fast) help :) I can imagine how hard was for you to get them since I've been spending a lot of days on it and I was feeling so frustrated after my lack of success.

You just made my day (and probably my whole week) :D

I'll start working with them right away.

Ale
 
Adam,

I ran the C# BOI Examples and I keep getting an exception where it tries to instantiate the AR_Customer_svc object:

InnerException: {"<NewObject Error: 200>" }
Source: "ProvideX.Script"
Message:"Exception has been thrown by the target of an invocation."

StackTrace " at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)\r\n at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)\r\n at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)\r\n at CSharp_Example_1.Class1.Main(String[] args) in c:\\*******\\csharp example 1\\class1.cs:line 42" string

Do you why this is happening?

Btw, thanks again for your help,

Ale.
 
Honestly not to sure, for sake of speed I only ran through the VB and got those to work. I don't know as much about C# and I ran out of time to learn. I was going to pick it back up but sorry I can't help. I looked at that line and to me it seems right, my guess is a parameter in there isn't correct, passing something it shouldn't.

-Adam
 

Adam,

Thanks so much for your help. I was able to resolve my problem. Since you told me that the VBScript examples worked fine I started trying those, then I got one problem... but the example was really well commented that I found out that my original problem was that my Company wasn't allowing "External Access", so I went to my company profile and checked the "Allow External Access" option and all the examples started to work!!!!

I'm so happy :D

Thanks again,
Ale.
 
I'm getting closer but I'm still not there: I'm trying to create a Customer record in MAS using BOI. I'm using C#, so I have to use late binding. When I call "nWrite" I get the following error (sLastErrorMsg):

"CA SAC" is not numeric.

First off, I'm not even specifying a Tax Schedule but I think It's grabbing it from the Zip Code. Second, Tax Schedule doesn't have a numeric field... It's just the Tax Abbrev and the description. Even if I specify the TaxSchedule$ I get the same error. This is my code:

using (DispatchObject oARCustomerEntry = new DispatchObject(pvx.InvokeMethod("NewObject", "AR_Customer_bus", oSS.GetObject())))
{
try
{
object[] nextCustomerNumber = new object[] { "CustomerNo$" };

//Getting Next Customer Number
oARCustomerEntry.InvokeMethodByRef("nGetNextCustomerNo", nextCustomerNumber);

Console.WriteLine(nextCustomerNumber[0].ToString());

object retVal = 0;

retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "ARDivisionNo$", "60" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "CustomerNo$", nextCustomerNumber[0].ToString() });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetKey", new object[] { "" });

Console.WriteLine(retVal.ToString());

retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "CustomerName$", "JOHN SMITH JR" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "AddressLine1$", "1234 LONG DREAM ST" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "AddressLine2$", "" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "AddressLine3$", "" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "City$", "CITRUS HEIGHTS" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "State$", "CA" });

Console.WriteLine(retVal.ToString());

retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "ZipCode$", "95621" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "CountryCode$", "USA" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "SalespersonDivisionNo$", "60" });
Console.WriteLine(retVal.ToString());

retVal = oARCustomerEntry.InvokeMethodByRef("nWrite", new object[] { "" });

string customerNumber = nextCustomerNumber[0].ToString();

Console.WriteLine(retVal.ToString());

Console.Read();
}
catch (Exception ex)
{
object errorMsg = oARCustomerEntry.GetProperty("sLastErrorMsg");
Console.WriteLine(errorMsg.ToString());
Console.WriteLine(ex.Message);
Console.Read();
}
finally
{
oARCustomerObject.Dispose();
}
}

The console is displaying the Next Number then 2 and 1 and 1 and it breaks when I called nWrite.

Any ideas... I know the code is really ugly but since I'm working with C# I have to use late binding.

Thanks
 
I figured out... I'm posting the right code and it might help all the C# developers that are as confused as I'm with the MAS BOI:

using (DispatchObject oARCustomerEntry = new DispatchObject(pvx.InvokeMethod("NewObject", "AR_Customer_bus", oSS.GetObject())))
{
try
{
object[] nextCustomerNumber = new object[] { "CustomerNo$" };

//Getting Next Customer Number
oARCustomerEntry.InvokeMethodByRef("nGetNextCustomerNo", nextCustomerNumber);

Console.WriteLine(nextCustomerNumber[0].ToString());

object retVal = 0;

retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "ARDivisionNo$", "60" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "CustomerNo$", nextCustomerNumber[0].ToString() });
retVal = oARCustomerEntry.InvokeMethod("nSetKey");

Console.WriteLine(retVal.ToString());

retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "CustomerName$", "ROSE DAWSON" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "AddressLine1$", "1234 LONG DREAM ST" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "AddressLine2$", "" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "AddressLine3$", "" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "City$", "CITRUS HEIGHTS" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "State$", "CA" });

Console.WriteLine(retVal.ToString());

retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "ZipCode$", "95621" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "CountryCode$", "USA" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "SalespersonDivisionNo$", "60" });
retVal = oARCustomerEntry.InvokeMethodByRef("nSetValue", new object[] { "SalespersonNo$", "RAP" });
Console.WriteLine(retVal.ToString());

retVal = oARCustomerEntry.InvokeMethod("nWrite");

if (retVal.ToString() == "0")
{
object errorMsg = oARCustomerEntry.GetProperty("sLastErrorMsg");
Console.WriteLine(errorMsg.ToString());
Console.Read();
}

string customerNumber = nextCustomerNumber[0].ToString();

Console.WriteLine(retVal.ToString());

Console.Read();
}
catch (Exception ex)
{
object errorMsg = oARCustomerEntry.GetProperty("sLastErrorMsg");
Console.WriteLine(errorMsg.ToString());
Console.WriteLine(ex.Message);
Console.Read();
}
finally
{
oARCustomerObject.Dispose();
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top