Skip to Content

Create a Supplier Invoice in ByD via ABSL

Dear Colleagues,

I tried creating the simplest Supplier Invoice programmatically.

Unfortunately, I am stuck on the following code:

import ABSL;
import AP.SupplierInvoicing.Global;
import AP.FO.Product.Global;
import AP.FO.Party.Global;

var date = Date.Create( 2015, 10, 5 );

// Supplier Invoice
var supplierInvoiceData	: elementsof SupplierInvoice;
supplierInvoiceData.TypeCode = "004"; // Invoice
supplierInvoiceData.Date = date;
supplierInvoiceData.DocumentItemsGrossAmountIndicator = false;
supplierInvoiceData.ReceiptDate	= date;
supplierInvoiceData.TransactionDate = date;
//supplierInvoiceData.GrossAmount.content = 264;
supplierInvoiceData.GrossAmount.currencyCode = "GBP";
var supplierInvoice = SupplierInvoice.Create ( supplierInvoiceData );

// External Document ID
var businessTransactionDocumentReference : elementsof SupplierInvoice.BusinessTransactionDocumentReference;
businessTransactionDocumentReference.BusinessTransactionDocumentRelationshipRoleCode = "7";
businessTransactionDocumentReference.BusinessTransactionDocumentReference.ID.content = "EXT1236";
businessTransactionDocumentReference.BusinessTransactionDocumentReference.TypeCode = "28";
supplierInvoice.BusinessTransactionDocumentReference.Create ( businessTransactionDocumentReference );

// Set Seller Party
var partyData : elementsof SupplierInvoice.Party;
partyData.PartyKey.PartyID.content = "S100200";
supplierInvoice.SellerParty.Create ( partyData );

// Set Buyer Party
partyData.PartyKey.PartyID.content = "1000";
partyData.PartyKey.PartyID.content = partyData.PartyKey.PartyID.content.AddLeadingZeros();
supplierInvoice.BuyerParty.Create ( partyData );

var item1 = supplierInvoice.Item.Create();
item1.ItemProduct.ProductKey.ProductID.content = "P100109";
item1.Quantity.content = 1;
item1.NetUnitPrice.Amount.content = 220;
item1.TaxCalculationItem.TaxationCharacteristicsCode.content = "2";
foreach ( var accountingCodingBlockAssignment in item1.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment ) {
	accountingCodingBlockAssignment.GeneralLedgerAccountAliasCode.content = "A-7460";



On saving I get error messages:

There are at least two error messages I can hardly understand:

- Account assignment data missing for item 1.1

- The balance is not equal zero

I can see in the debugger that all the mentioned fields are filled with correct values and BalanceAmount = 0.

Besides that, I successfully created some supplier invoices with the same data manually (via Work Center)

Please, could you tell me what is not correct in my code?

Thank you.

000130.jpg (20.0 kB)
000131.jpg (5.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 11, 2017 at 01:28 PM

    Hi Alexsei

    I am surprised, that you were able to enter the data manually and not via the absl coding. I would suggest that you first only save the entry (w/o the actions) and check the data. From this I would proceed.

    best regards


    PS: It is hard to give qualified advice w/o knowing your data.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 11, 2017 at 03:19 PM

    Dear Marlene,

    I just saved a new Supplier Invoice with exactly the same data as they were in the absl code (but External Document ID).

    I am afraid the screenshot is not very good quality because I had to reduce the scale to capture the whole view.

    It is just after hitting Check button. After saving, I got a message with a new id of the Supplier Invoice = SIV-1384.

    Now we can see the Invoice in the list below. Before that, SIV-1382 and SIV-1383 were also created in the same way (but quantity).

    I used creating an Invoice without a purchase order.

    Thank you very much


    000133.jpg (62.9 kB)
    000134.jpg (120.5 kB)
    000135.jpg (39.4 kB)
    Add comment
    10|10000 characters needed characters exceeded