Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Description
Retrieves a single inventory variance object based on the inventory key value supplied.
Parameters
Parameter |
Type |
Description |
|---|---|---|
key |
An inventory key object that specifies the inventory variance object to retrieve. |
|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetInventoryVarianceByKeyResult |
An inventory variance object. |
Interfaces
- Dynamics GP
- Inventory
Examples
The following C# example retrieves the inventory variance object with a key of "ADJ00045". A message box displays the site ID for the first inventory variance line associated with the specified inventory variance object.
** Legacy endpoint**
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
InventoryKey inventoryKey;
InventoryVariance inventoryVariance;
// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();
// Be sure the default credentials are used
wsDynamicsGP.UseDefaultCredentials = true;
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Create the inventory key object to specify the inventory variance
inventoryKey = new InventoryKey();
inventoryKey.Id = "ADJ00045";
// Retrieve the inventory variance object
inventoryVariance = wsDynamicsGP.GetInventoryVarianceByKey(inventoryKey, context);
// Display the location associated with the first line of the variance object
MessageBox.Show("Location of the variance: " + inventoryVariance.Lines[0].WarehouseKey.Id);
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
InventoryKey inventoryKey;
InventoryVariance inventoryVariance;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Create the inventory key object to specify the inventory variance
inventoryKey = new InventoryKey();
inventoryKey.Id = "ADJ00045";
// Retrieve the inventory variance object
inventoryVariance = wsDynamicsGP.GetInventoryVarianceByKey(inventoryKey, context);
// Display the location associated with the first line of the variance object
MessageBox.Show("Location of the variance: " + inventoryVariance.Lines[0].WarehouseKey.Id);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}