Thursday, October 11, 2018

Web Services: Initialize and Add a Vendor Bill from a Purchase Order using JAVA

The code snippet below shows how to initialize and add a Vendor Bill from a Purchase Order using JAVA.

InitializeRef purchaseOrder = new InitializeRef();
purchaseOrder.setInternalId("123"); //specify internal id

purchaseOrder.setType(InitializeRefType.purchaseOrder);

InitializeRecord vendorBill = new InitializeRecord();
vendorBill.setType(InitializeType.vendorBill);
vendorBill.setReference(purchaseOrder);

ReadResponse vendorBillResponse = _port.initialize(vendorBill);
VendorBill vendorBillRecord = (VendorBill) vendorBillResponse.getRecord();

VendorBillItemList itemList = new VendorBillItemList();
itemList.equals(vendorBillRecord.getItemList());

VendorBillItem itemArr00 = new VendorBillItem();

VendorBillItem[] itemArr = new VendorBillItem[1];
itemArr[0] = itemArr00;

itemList.setReplaceAll(Boolean.FALSE);

vendorBillRecord.setItemList(itemList);

WriteResponse response = _port.add(vendorBillRecord);

Note: "_port" is an instance of NetSuitePortType and must be declared and instantiated accordingly.

No comments:

Post a Comment