Skip to Content
0
Former Member
Jun 02, 2010 at 10:12 PM

Producto Order

17 Views

Hi

i'm doing Produccions orders on the DI API, but some fileds that i need to create it i can find it on the methods of the oProductionOrders.

DataTable dt,dt2;

DataRow drArt,drDeArt;

SqlDataAdapter da,da2;

int i;

DateTime hoy = new DateTime();

SAPbobsCOM.Documents OrdF10 = (SAPbobsCOM.Documents)objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductionOrders);

try

{

//Document Head

OrdF10.CardCode = cardCode;

OrdF10.CardName = cardName;

OrdF10.TaxDate = hoy;

OrdF10.UserFields.Fields.Item("U_Pedido").Value = pedido;

sCnn = "Server= (local); database= SBO_CACEI; integrated security=yes";

cnn = new SqlConnection(sCnn);

//childs items

string sql = "SELECT ITT1.Code, ITT1.Quantity FROM OITT INNER JOIN OITM ON OITT.Code = OITM.ItemCode INNER JOIN ITT1 ON OITT.Code = ITT1.Father WHERE OITT.Code = '" + artf10 + "'";

da = new SqlDataAdapter(sql, sCnn);

dt = new DataTable();

da.Fill(dt);

if (dt.Rows.Count >= 0)

{

for (i = 0; i < dt.Rows.Count; i++)
{
drArt = dt.Rows;

//edescription of the child

string sql2 = "SELECT OITM.ItemName, OITM.OnHand, OITM.IsCommited, OITM.IssueMthd, OITT.Qauntity, OITM.InvntryUom, OITT.ToWH FROM OITM INNER JOIN OITT ON OITM.ItemCode = OITT.Code WHERE OITT.Code = '" + drArt["Code"].ToString() + "'";

da2 = new SqlDataAdapter(sql2,sCnn);

dt2 = new DataTable();

da2.Fill(dt2);

drDeArt = dt2.Rows[0];

OrdF10.Lines.ItemCode = drArt["Code"].ToString();

OrdF10.Lines.ItemDescription = drDeArt["ItemName"].ToString();

OrdF10.Lines.Quantity = double.Parse(drDeArt["Qauntity"].ToString());

}

}

}

catch (Exception er) {

throw er;

}

¿what info is missing?

adding the quantity column, the quantity is the quantity of the child or the final quantity. i doing this getting for example the manual way directly of SBO user.

the add method of the order thowrs a error code, how do i know the meaning of this error and i have to create a purchase order if the item quantity is low.