// Create a Map to store all the data of a Vendor Bill
Map<String, Object> nsVendorBill = new Map<String, Object>();
nsVendorBill.put('classification', new Map<String, Object>{'internalId'=>'5'});
nsVendorBill.put('location', new Map<String, Object>{'internalId'=>'13'});
nsVendorBill.put('currencyRecord', new Map<String, Object>{'internalId'=>'1'});
nsVendorBill.put('department', new Map<String, Object>{'internalId'=>'2'});
nsVendorBill.put('dueDate', DateTime.newInstance(2020, 12, 31).getTime()/1000);
nsVendorBill.put('approvalstatus', new Map<String, Object>{'internalId'=>'2'});
nsVendorBill.put('entity', new Map<String, Object>{'internalId'=>'30440'});
nsVendorBill.put('shipTo', new Map<String, Object>{'internalId'=>'362'});
nsVendorBill.put('memo', 'Bill 12');
nsVendorBill.put('otherRefNum', '4343399');
nsVendorBill.put('tranDate', DateTime.newInstance(2020, 09, 07).getTime()/1000);
// Initializing the Vendor Bill Custom Fields
List<Object> billCustomFieldList = new List<Object>();
Map<String, Object> billCustomField = new Map<String, Object>();
billCustomField.put('fieldType', 'select');
billCustomField.put('scriptId', 'custbody_customlist');
billCustomField.put('valueLookup', new Map<String, Object>{'internalId'=>'2'});
billCustomFieldList.add(billCustomField);
// Adding the Vendor Bill Custom Fields
nsVendorBill.put('customFieldList', new Map<String, Object>{'customField'=>billCustomFieldList});
// Initializing the Vendor Bill Line Items
List<Object> lineItemList = new List<Object>();
Map<String, Object> lineItem = new Map<String, Object>();
lineItem.put('description', 'A weapon for shooting arrows');
lineItem.put('item', new Map<String, Object>{'internalId'=>'239'});
lineItem.put('quantity', 1);
lineItem.put('rate', '999');
// Initializing the Line Item custom fields
List<Object> liCustomFieldList = new List<Object>();
Map<String, Object> liCustomField = new Map<String, Object>();
liCustomField.put('fieldType', 'boolean');
liCustomField.put('scriptId', 'custcol_checkbox');
liCustomField.put('value', 'true');
liCustomFieldList.add(liCustomField);
// Adding the Vendor Bill Line Item Custom Fields
lineItem.put('customFieldList', new Map<String, Object>{'customField'=>liCustomFieldList});
lineItemList.add(lineItem);
// Adding the Line Items to Vendor Bill
Map<String, Object> billLineitemList = new Map<String, Object>();
billLineitemList.put('item', lineItemList);
nsVendorBill.put('itemList', billLineitemList);
// Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('vendorBills', new List<Object>{nsVendorBill});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'createVendorBill');
reqObj.put('requestJSON', reqJSON);
// Placing a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
System.debug(resp);