cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a production receipt from a production order with JCO java in SAP B1

Former Member
0 Kudos

Hi.

I have created a Production Order in SAP B1 with Java JCO.

This is the code that i have used

IProductionOrders vOP;
if (SapOb.getConnect() == 0) {
    // Create a Production Order
try {
vOP = SBOCOMUtil.newProductionOrders(SapOb.getCompany());

vOP.setProductionOrderType(1); // P
vOP.setProductionOrderStatus(0);   // planificado             
vOP.setItemNo("PC00294");
vOP.setPlannedQuantity(50.00);
vOP.setWarehouse("01");
vOP.setDueDate(dateFormat.parse(pF1));
vOP.setPostingDate(dateFormat.parse(pF1));
vOP.getUserFields().getFields().item("U_user").setValue(pUser);
vOP.getUserFields().getFields().item("U_terminal").setValue(pHost);

// Add lines
vOP.getLines().add();
vOP.getLines().setCurrentLine(0);
vOP.getLines().setItemNo("PC00313");
vOP.getLines().setItemType(0);
vOP.getLines().setBaseQuantity(1.00);
vOP.getLines().setPlannedQuantity(50.00);
vOP.getLines().setWarehouse("01");
vOP.getLines().setProductionOrderIssueType(0);
vOP.setRemarks("ESTO ES DE PRUEBA");
// add Sales Order
if (vOP.add() == 0) {
JOptionPane.showMessageDialog(null, "Transaction Completed");
} else {
 SBOErrorMessage errMsg = SapOb.getCompany().getLastError();
 Dao.commitGeneral("INSERT INTO dbo.est_sap_error_log (descripction, error_type) VALUES ('"+errMsg.getErrorMessage()+" "+errMsg.getErrorCode()+ "','SAP TRANSACTION' )");
// get error message fom SAP Business One Server
JOptionPane.showMessageDialog(null, "SAP Transaction Error.. " + errMsg.getErrorMessage() + " " + errMsg.getErrorCode());
}
} catch (SBOCOMException e) {               
e.printStackTrace();
}

Now i want to create a Production receipt from a production order, but i don't know what objet i have to use.

What is the correct Object, Document or Class to use In JCO?

Thanks in advanced.

Accepted Solutions (0)

Answers (0)