Web Services and Purchase Invoice RTC line items?

Hello everyone.

I am working on a web services project, creating a record and inserting it via their architecture. I’ve been able to insert a header record, but I cannot seem to get lines to import. Everything right now is hard coded. Could anyone give me example code in how I would enter a couple line items for my header record? And I’m also trying to find any good sdk or book via Amazon or something I could buy to study about specifically Web Services development in NAV 2013 or NAV 2009R2? I don’t need so much on C/Side because I know that, but I couldn’t find much on Web Services NAV development. Thank you so much.

namespace PurchaseInvoiceStamp
{
using NAVSystemService;
using NAVPurchaseINVService;

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
// GET COMPANIES OF NAV 2013
SystemService s = new SystemService();
s.UseDefaultCredentials = true;
s.Url = “”>localhost:7047/…/SystemService";

var companies = s.Companies();

foreach (string company in companies)
{
MessageBox.Show("The available companies are: " + company);
}
}

private void cmdImportStamp_Click(object sender, EventArgs e)
{
// create service obj and set credentials
Purchase_Invoice_Service p = new Purchase_Invoice_Service();
p.UseDefaultCredentials = true;

// new obj to set fields
Purchase_Invoice PurchaseINV = new Purchase_Invoice();
PurchaseINV.Buy_from_Vendor_No = “10000”;
PurchaseINV.Vendor_Invoice_No = “123334”;

// new obj to set lines
Purch_Invoice_Line lines = new Purch_Invoice_Line();
lines.Key = “1”;
lines.Type = (Type)2;
lines.Description = “Bicycle”;
lines.No = “1000”;
lines.Quantity = 1;
lines.Line_Amount = 1;

// insert into RTC client for 51 Purchase Invoice page
p.Create(ref PurchaseINV);
}

}
}

I found out how and will post here, just so if anyone else needs information on how to. Thanks again.

namespace PurchaseInvoiceStamp
{
using NAVSystemService;
using NAVPurchaseINVService;

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
// GET COMPANIES OF NAV 2013
SystemService s = new SystemService();
s.UseDefaultCredentials = true;
s.Url = “http://localhost:7047/DynamicsNAV70/WS/CRONUS%20USA,%20Inc./SystemService”;

var companies = s.Companies();

foreach (string company in companies)
{
MessageBox.Show("The available companies are: " + company);
}
}

private void cmdImportStamp_Click(object sender, EventArgs e)
{
// create service obj and set credentials
Purchase_Invoice_Service p = new Purchase_Invoice_Service();
p.UseDefaultCredentials = true;

// new obj to set fields
Purchase_Invoice PurchaseINV = new Purchase_Invoice();
PurchaseINV.Buy_from_Vendor_No = “10000”;
PurchaseINV.Vendor_Invoice_No = “123334”;

// insert into RTC client for 51 Purchase Invoice page
p.Create(ref PurchaseINV);

// Create Purchase Invoice lines, set array for two lines
PurchaseINV.PurchLines = new Purch_Invoice_Line[2];
for (int idx = 0; idx < 2; idx++)
PurchaseINV.PurchLines[idx] = new Purch_Invoice_Line();

// update Purchase Invoice with new lines
p.Update(ref PurchaseINV);

// Update detail lines and insert those.
var line1 = PurchaseINV.PurchLines[0];
line1.Type = (Type)2;
line1.Description = “Bicycle”;
line1.No = “1000”;
line1.Quantity = 1;
line1.Line_Amount = 1;
line1.Direct_Unit_Cost = 1;
line1.Unit_of_Measure_Code = “PCS”;

var line2 = PurchaseINV.PurchLines[1];
line2.Type = (Type)2;
line2.Description = “Bicycle”;
line2.No = “1000”;
line2.Quantity = 1;
line2.Line_Amount = 1;
line2.Direct_Unit_Cost = 1;
line2.Unit_of_Measure_Code = “PCS”;
p.Update(ref PurchaseINV);
}
}
}

Hi,

Thanks for the code, can you please send me the cs file it will be more helpful for me…

amr_wafa@hotmail.com