on 07-23-2021 10:33 AM
Hi,
I need to do production using the DI API, and I have not done this before. There is no example code in the SDK for this process, so I am hoping someone can steer me in the right direction.
A specific requirement is that I need to change the cost price of one component each time.
All answers, and any advice or suggestions are most welcome.
Following the steps as in the B1 client, I suppose I would have to go about it like this(?):
Are there any steps I can skip?
Regards,
Johan
Dear johan.hakkesteegt,
For Production Order, you need to use ProductionOrders object.
SAPbobsCOM.ProductionOrders oPO = (SAPbobsCOM.ProductionOrders)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductionOrders);
oPO.ItemNo = "S10000";
oPO.PlannedQuantity = 2;
int APO = oPO.Add();
For Receipt From Production, you need to use Documents object.
SAPbobsCOM.Documents oReceiptFromProduction = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry);
oReceiptFromProduction.Lines.BaseEntry = 153;
oReceiptFromProduction.Lines.BaseType = 202;
oReceiptFromProduction.Lines.Quantity = 1;
oReceiptFromProduction.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntComplete;
oReceiptFromProduction.Lines.WarehouseCode = "01";
int ARPO = oReceiptFromProduction.Add();
Will those help for your cause?
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ankit,
Thank you so much for this. This is perfect, but would you clarify a few things for me?
About the code example for the Production Order:
About the code example for Receipt From Production:
Regards,
Johan
Dear johan.hakkesteegt,
The idea was to make you aware about the DI objects. The provided sample codes are just vague examples. You may need to add or remove properties based on your requirements.
You can always explicitly set ProductionOrderType and ProductionOrderStatus.
About Receipt From Production, in my case:
1. Yes, It was drawing the header of the Production Order (Product No. on Production Order screen), therefore, I didn't use the BaseLine property.
2. Yes, ReceiptFromProduction.Lines.Quantity corresponds to oPO.PlannedQuantity. You will get the details about the Quantities on the Summary tab of Production Order once Receipt from Production is added.
3. If you do not want to change Warehouse, no need to use it.
4. No, you will have to close the Production Order.
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
hey, this is my code:
using SAPbobsCOM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ConexionSAPB1
{
public partial class ConexionSAP : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (ConexioSAP.Open())
{
Linfo.Text = "conexion exitosa a SAP";
Linfo.Visible = true;
}
}
protected void BtnConexion_Click(object sender, EventArgs e)
{
if (ConexioSAP.Open())
{
Linfo.Text = "conexion exitosa a SAP";
Linfo.Visible = true;
}
}
protected void BtnProduccion_Click(object sender, EventArgs e)
{
ProductionOrders wo = ConexioSAP.mycompany.GetBusinessObject(BoObjectTypes.oProductionOrders) as ProductionOrders;
wo.ItemNo = "SILO AZ.";
wo.DueDate = DateTime.Now.AddMonths(1);
wo.ProductionOrderType = BoProductionOrderTypeEnum.bopotSpecial;
wo.PlannedQuantity = 6;
wo.Lines.ItemNo = "LLDPE";
wo.Lines.Add();
wo.Lines.SetCurrentLine(1);
wo.Lines.ItemNo = "COLOR. AZ.";
wo.Lines.Add();
wo.Lines.SetCurrentLine(2);
int retVal = wo.Add();
if (retVal != 0)
{
string errorMessage = ConexioSAP.mycompany.GetLastErrorDescription();
Linfo.Text = "Ocurrió un error al ingresar la orden de fabricación: " + errorMessage.ToString();
}
else
{
Linfo.Text = "Se ha ingresado correctamente la orden de fabricación";
}
}
}
}
it works perfect but i need to automize the most i can, someone knows how to automize the components auto fill?, because i have like 60 products and each one have like 3 components and its a big word to add one per one, and my boss will love me if i can automize it.
thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
11 | |
10 | |
6 | |
5 | |
5 | |
5 | |
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.