Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Contributor
ebdeveloper
Posts: 15
Registered: 01-23-2012
0
Accepted Solution

BOI & Shipment

Can anybody point me to the right direction?

I need to get shipping information from MAS and only think I know is SalesOrderNo.

What BOI should I use and how to get correct record by SalesOrderNo?

 

Thank you in advance,

George

MAS90 4.40

Regular Contributor
Gator
Posts: 269
Registered: 12-05-2008
0

Re: BOI & Shipment

Welcome to the forums.

 

You will need to start with the SO_Invoice_bus object.  There are several ways to find the records by SalesOrderNo including looping through the records until a match is found, SetBrowseFilter function, or I believe there is a way to query against the object (I don't use this one, but have seen it before).

 

I would just start with looping through the records as this is easy to code and there shouldn't be a ton of Invoice records to go through.

Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: BOI & Shipment

George,

 

What kind of shipping information are you trying to get?

 

If you want to get invoice information about a sales order that is being invoiced/shipped, you can start with using the SO_SalesOrder_svc object to get the CurrentInvoiceNo$.  Then use SO_Invoice_svc (read only) or SO_Invoice_bus to get invoice details.

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP
Contributor
ebdeveloper
Posts: 15
Registered: 01-23-2012
0

Re: BOI & Shipment

Thank you guys for the quick answers.

I just need the basic info about shipping. I am going to try your ideas.

George

Contributor
ebdeveloper
Posts: 15
Registered: 01-23-2012
0

Re: BOI & Shipment

Hi again.

 

1. I could not figure out how to use SO_SalesOrder_svc. Any example would be appreciated.

 

2. I am currently using SO_SalesOrder_bus, here is the code

using (DispatchObject order = newDispatchObject(pvx.InvokeMethod("NewObject", "SO_SalesOrder_bus", oSS.GetObject())))

                        {

                            foreach (string ordernum in ordernumlist)

                            {

                                order.InvokeMethod("nSetKeyValue", "SalesOrderNo$", ordernum);

                                retVal = order.InvokeMethod("nFind");

                                LogMsg(string.Format("[Order# {0}] Exists? {1}", ordernum, retValText(retVal)));

 

                                if ((int)retVal == 0) //Error

                                {

                                    string serror = "[Order] Error: ";

                                    object errorMsg = order.GetProperty("sLastErrorMsg");

                                    if (errorMsg != null)

                                        serror += errorMsg.ToString();

 

                                    LogMsg(serror);

                                }

                                elseif ((int)retVal == 1) //Exists

                                {

                                    string invoice = string.Empty;

                                    retVal = order.InvokeMethod("nGetValue", "CurrentInvoiceNo$", invoice);

 

                                    LogMsg(string.Format("[nGetValue] OK? {0}", retValText(retVal)));

                                    LogMsg(string.Format("[Invoice#] {0}", invoice));

 

                                }

                            }

                        }

 

Here is the result I am getting:

[FindInvoices] Orders: 5,115

[Order# 5] Exists? Error

[Order] Error: The 0000005 is invalid.

[Order# 115] Exists? Yes

[nGetValue] OK? Yes

[Invoice#] 

 

Definitely there is a value in  CurrentInvoiceNo for order 115.

What am I doing wrong?

 

Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: BOI & Shipment

1. SO_SalesOrder_svc is very similar to SO_SalesOrder_bus.  The service class has fewer methods available because it is read only.  You can use the same nSetKeyValue(), nFind(), and nGetValue() methods.  However, you will need to zero-fill sales order number in the nSetKeyValue call (ie. 0000115, not 115).

 

2.  Someone else reported that nGetValue() returned blank last week in another post.  May be you are experiencing the same issue.  I don't know why.   I've never used C# with BOI. 

 

 

 

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP
Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: BOI & Shipment

I asked my colleagues.  Here is their suggestion:

 

When calling methods that pass parameters by ref they need to first setup a params object, and then use InvokeMethodByRef.

This would look something like this for GetValue:

 

object [] getValueParams1=new object[] {"ColumnName$",""};

oBusObj.InvokeMethodByRef(“nGetValue”, getValueParams1);

 

object [] getValueParams2=new object[] {"ColumnName",0};

oBusObj.InvokeMethodByRef(“nGetValue”, getValueParams2);

 

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP
Contributor
ebdeveloper
Posts: 15
Registered: 01-23-2012
0

Re: BOI & Shipment

 

Thank you so much Natasha. It is working now. :smileyhappy:

Contributor
ebdeveloper
Posts: 15
Registered: 01-23-2012
0

Re: BOI & Shipment

Hi again,
I have one more question regarding sGetColumns.

 

I am trying this
object[] getValueParams = new object[] { "MAIN", "" };
retVal = order.InvokeMethodByRef("sGetColumns", getValueParams);


and also this
string test = string.Empty;
retVal = order.InvokeMethod("sGetColumns", "MAIN", test);

and I am getting this error

Exception has been thrown by the target of an invocation.<Error: 548 in Method GetColumns$>

What is a proper syntax here?
George

Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: BOI & Shipment

You can try this (we didn't get a chance to test it):

 

object columnList = order.InvokeMethod(“sGetColumns”,”MAIN”);

Console.WriteLine(columnList.ToString());

 

Or:

string mystring = columnList.ToString();

 

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP