On sales order invoice items can successfully use BOI to retrieve the SO_Invoice items, and for each item access the lines, however have not been able to collect item serial numbers for each line. For reference a screen capture showing these serial numbers in the UI. Using C#, however an example showing how to access these for any language would be most helpful. Our basic flow is:
- Create the authenticated session
- Set the session date to today, the module to "S/O", the session program to "SO_Invoice_ui" (using sess.nLookupTask("SO_Invoice_ui")),
- Create the BOI object using var comObject = sess.oNewObject("SO_Invoice_bus") - using the business object here as want to retrieve lines as well
- Select the desired invoice using comObject.nFind("my-full-key"); -- collect the desired header field values from here
- Select the lines collection using
- comObject.oLines.nSetBrowseFilter(comObject.sGetKey()); -- this gives me access to the collection of lines from this invoice, then
- comObject.oLines.nMoveFirst(); -- collecting the desired line field values -- then calling comObject.oLines.nMoveNext(); -- repeat for all lines
All this works well, can get all needed data from header and line level. However for each line want to collect the serial number(s). So, have tried like this
- Get a reference to the distribution object, which I believe to be the place to source serial numbers from:
- var comDistributionObject = comObject.oLines.oDistribution;
- Set the browse filter to try to get the collection of distribution rows for this line:
- int nSetBrowseFilterForDists = comDistributionObject.nSetBrowseFilter(comLinesObject.sGetKey());
- Moving to the first distribution record:
- int nMoveNextDists = comDistributionObject.nMoveFirst();
At this point the comDistributionObject always reports EOF (i.e. comDistributionObject.nEOF is always = 1) even though the UI shows distributions for this invoice line.
Have attempted many variations when setting the browse filter on the Distribution object, trying using the line key key padded/not padded/truncated to 7+6=13 characters, by explicitly setting the index using nSetIndex, hard coding the nSetBrowseFilter value to a 13 char string that represents the zero padded 7 char invoice number with the 0 padded 6 char line number. Seem to get the EOF and message on the comDistributionObject reports:
The file is empty or does not match filter.
At this stage I suspect my strategy for retrieving these serial numbers is incorrect. How can I get them? Thanks!