Hi,
I'm new to GP web services and trying to perform CreateSalesInvoice thru the web service but keep getting on the error.
Procedure or function 'taSopSerial' expects parameter '@I_vLNITMSEQ', which was not supplied.
Please help and let me know which information I'm missing? Below is the XML from the Exception console.
*This post is locked for comments
Hi Sandip,
Finally made it to work. I was using the wrong salesInvoiceLine property. I should have used salesInvoice.Key instead of salesInvoice.Serials. Here's the code.
salesInvoiceLine.Key = new SalesLineKey { LineSequenceNumber = 16384};
Appreciate your help.
Hi,
var salesLineSerialKey = new SalesLineSerialKey { SalesLineKey = salesLineKey, SequenceNumber = 16384, CompanyKey = _companyKey, QuantityType = QuantityType.OnHand };
This line is problem..!!! You should not use SequenceNumber, SequenceNumber is for Lot Instance.
Use SalesLinkeKey. Checkout this link: msdn.microsoft.com/.../cc508399.aspx
Let me know how it goes.
Thanks
Sandip
Here you go Sandip. I appreciate the effort you're putting into this. I'm really stuck with this issue and it's a dependency for our new project.
private void CreateSalesInvoice()
{
CompanyKey _companyKey;
Context _context;
// Create an instance of the web service want to do this
//asynchronously.
using (var wsDynamicsGP = new DynamicsGPClient())
{
_context = new Context();
// Specify which company to use (sample company)
_companyKey = new CompanyKey { Id = 2 }; //Hautelook
// Set up the context object
_context.OrganizationKey = _companyKey;
_context.CultureName = "en-US";
// Create a sales invoice object
SalesInvoice salesInvoice = new SalesInvoice();
// Create a sales document type key for the sales invoice
SalesDocumentTypeKey salesInvoiceType = new SalesDocumentTypeKey { Type = SalesDocumentType.Invoice };
// Populate the document type key for the sales invoice
salesInvoice.DocumentTypeKey = salesInvoiceType;
// Create a customer key
CustomerKey customerKey = new CustomerKey { Id = "MEMBER" };
// Set the customer key property of the sales invoice
salesInvoice.CustomerKey = customerKey;
// Create a batch key
BatchKey batchKey = new BatchKey { Id = "TEST_020915" };
// Set the batch key property of the sales invoice object
salesInvoice.BatchKey = batchKey;
salesInvoice.CustomerPONumber = "PO_02092015";
salesInvoice.CreatedDate = DateTime.Now;
//salesInvoice.WarehouseKey = new WarehouseKey { Id = "TESTWH1" };
// Create a sales invoice line to specify the invoiced item
SalesInvoiceLine salesInvoiceLine = new SalesInvoiceLine();
// Create an item key
ItemKey invoiceItem = new ItemKey { Id = "3655949" };
// Set the item key property of the sales invoice line object
salesInvoiceLine.ItemKey = invoiceItem;
//Set Warehouse
salesInvoiceLine.WarehouseKey = new WarehouseKey { Id = "VERNON" };
// Create a sales invoice quatity object
Quantity invoiceCount = new Quantity { Value = 2, DecimalDigits = 0 };
// Set the quantity of the sales invoice line object
salesInvoiceLine.Quantity = invoiceCount;
//Set the Sequence Number ////16384
var salesLineKey = new SalesLineKey
{
LineSequenceNumber = 16384
,
SalesDocumentKey = new SalesDocumentKey { Id = "IV1" }
,
CompanyKey = _companyKey
};
var salesLineSerialKey = new SalesLineSerialKey { SalesLineKey = salesLineKey, SequenceNumber = 16384, CompanyKey = _companyKey, QuantityType = QuantityType.OnHand };
var salesLineSerials = new[]
{new SalesLineSerial{
SerialNumber = "16384"
,DateReceived=DateTime.Now
,Key = salesLineSerialKey
,DateSequenceNumber=1
}
};
salesInvoiceLine.Serials = salesLineSerials;
// Create an array of sales invoice lines
// Initialize the array with the sales invoice line object
SalesInvoiceLine[] invoiceLines = { salesInvoiceLine };
// Add the sales invoice line array to the sales line object
salesInvoice.Lines = invoiceLines;
try
{
// Get the create policy for the sales invoice object
Policy salesInvoiceCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateSalesInvoice", _context);
// Create the sales invoice
wsDynamicsGP.CreateSalesInvoice(salesInvoice, _context, salesInvoiceCreatePolicy);
}
catch (Exception ex)
{
}
}
}
Do you mind to post your .Net code over here or you can email me :sandipdjadhav@hotmail.com
Hi Sandip,
eConnect event viewer log shows the same error message.
Log Name: eConnect
Source: Microsoft.Dynamics.GP.eConnect
Date: 2/9/2015 10:16:20 PM
Event ID: 0
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: DEV-GPWEB1
Description:
Action:
Create
Current User Name:
DEV-GPWEB1\jun
Input parameters:
Exception type:
System.Data.SqlClient.SqlException
Exception message:
Procedure or function 'taSopSerial' expects parameter '@I_vLNITMSEQ', which was not supplied.
Stack Trace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) ...
Hi Jun,
Can you check eConnect event viewer log in GP Web server. It may give you some logical error explanation.
Thanks
Sandip
HI Sandip,
Thanks for the feedback. Tried the fix you suggested but it didn't resolve the issue. Still getting the same error. Also played around with the policy to for CreateSalesInvoice to set the "Allocate Serials Behavior" to Manual but it didn't work as well. Let me know if there's any other configuration I can try. Thanks
Jun,
I think your Line Squence Number and Serial Number Sequence is problem.
Assume that you have following line Items in SOP transaction :-
1) Item No: ABC LineItemSQ No is: 16384 , then you need to pass LineSequenceNumber = 16384 into Serial Number Method.
2) Item XYZ = 32768 (16384+16384) , then pass LinSequneceNumber = 32768 to Serial Number Method.
<SerialNumber>16384</SerialNumber> It seems to be here your Item No Serial Number not Item Squence No.
<LineSequenceNumber>32768</LineSequenceNumber> this should be 16384.
Check this out: msdn.microsoft.com/.../cc508136.aspx
Let me know how it goes.
Thanks
Sandip
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,134 Super User 2024 Season 2
Martin Dráb 229,928 Most Valuable Professional
nmaenpaa 101,156