02-26-2018 7:55 AM - edited 02-04-2024 3:12 AM
Hi,
I was trying to add new Item into Purchase Request by using DI API. Didn't occure any error when I run code but it didn't add into table. I checked OPRQ and also PRQ1 tables, both them are empty. Could you tell me where is the wrong? Here is my code:
SAPbobsCOM.Documents vItem;
try
{
vItem = (SAPbobsCOM.Documents)vCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseRequest);
vItem.Comments = "TEST";
vItem.DocDate = System.DateTime.Now;
vItem.DocDueDate = System.DateTime.Now.AddDays(1);
vItem.Add();
Application.SBO_Application.MessageBox("ok");
}
catch (Exception ex)
{
Application.SBO_Application.MessageBox(ex.ToString());
}
Hi Hatice,
As edy.simon mentioned on the comments, your code should provide the minimum information to create a purchase request, like we do on the SAP Business One client.
On SDK help center you are able to see samples of how to add documents with SDK.
A small sample:
try
{
SAPbobsCOM.Documents oDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseRequest);
oDoc.SendNotification = SAPbobsCOM.BoYesNoEnum.tNO;
oDoc.ReqType = 12; //user or 171 as employee
oDoc.Requester = "manager";
oDoc.RequriedDate = DateTime.Now;
oDoc.Lines.ItemCode = "A00001";
oDoc.Lines.Quantity = 1;
//If you want more itens, call oDoc.Lines.Add(); before provide new items code.
if (oDoc.Add() != 0)
MessageBox.Show(oCompany.GetLastErrorDescription());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Hope it helps.
Best Regards,
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.