cancel
Showing results for 
Search instead for 
Did you mean: 

Supplier Invoice Creation via ABSL Not Working

former_member183363
Active Contributor
0 Kudos

Hello everyone,

I've been working on mass uploading supplier invoices using a combination of ABSL, XML file input and proxy BOs. Unfortunately I can't get it to upload, despite the debugger log showing supposedly no errors by the end of processing. Anyone able to assist? Proxy BO, accompanying mass-enabled AfterModify script and debugger logs as attachments.

What's strange is that if I don't set any breakpoints the last thing I see in the log is it exiting the AfterModify script with, supposedly, no errors, but if I have any breakpoints I get the following window when it exits the script:

Points to note:

  • if I uncomment the lines:

         Then in the debugger it says "balance sheet account is not permitted with cost centers", as shown in the file 'SIUploader Debugger Log (with                  Account Info)'. What does that mean?

  • the values of the variables in the XML input file that are stuck into the proxy BO and used to create the supplier invoice are all correct, these have been quadruple-checked with the customer.
  • First three files are attached, the rest will be in dummy replies as the SCN only allows for three attachments!

Lewis

Accepted Solutions (1)

Accepted Solutions (1)

Jacques-Antoine
Active Participant
0 Kudos

Hello Lewis,

Did you check in debig that your code "var newSI = SupplierInvoice.Create(siRoot); //Create a new supplier invoice" is well triggered?

If the instance is well Created, then I think the problem may come from the ItemAccountingBlockAssignment. This is a [0,1] association so it needs to be created also before associating it with values I think.

First, check your Item.IsSet() as you did. If it is set, check that Item.ItemAccountingBlockAssignment.IsSet().

If yes you can modify it, if no, create the node.

Then after creating the AccountingBlockAssignment you may be able to populate it and have your Supllier Invoices created.

I hope this helps!

Best regards.

Jacques-Antoine Ollier

former_member183363
Active Contributor
0 Kudos

Hi Jacques-Antoine,

I did indeed check whether the instance was created. FYI, for anyone reading this in the future, I found that the node isn't actually set unless you include the BO type code, which I believe is 004 for invoices; when I didn't include it, the node was marked as not set in the `Locals' section of the debugger.

In the description for the SupplierInvoice BO in the repository explorer, it says the account information space is created automatically --- this is supported by it always passing an ``if...isSet()" check, and it throwing an error if I tried to create an instance of it through code.

This question's actually solved now --- I'm not entirely sure how, because it seems my current code is pretty much the same as the latest versions attached to this thread. Regardless, here are the text files with my custom BO and the mass-enabled AfterModify script if anyone's interested. To accompany it, you'll need to create a mass-enabled XML input integration which has readable ID of zInputRow, and instance identification is done via the same field. Next step for me is to get it to do multiple rows per invoice, which seems fairly easy --- I did the same with purchase order uploading. Case closed.

Lewis

Answers (5)

Answers (5)

former_member183363
Active Contributor
0 Kudos

Bump.

former_member183363
Active Contributor
0 Kudos

I've worked out a few kinks such as account assignment type etc. BO is in screenshot below; AfterModify script, debugger log and XML input are attached.

former_member183363
Active Contributor
0 Kudos

Bump.

Former Member
0 Kudos

Sorry to be late

I looked at your code and  found the following code to add product:

instaSIItem.ItemProduct.ProductKey.ProductID = row.zItemProductID;

Do a check here if ItemProduct association is set otherwise create the association and then assign product. Do the same check for all associations you are trying to access.

Try this and let's see the log again if there are more errors.

Thanks & Regards,

Meghna

former_member183363
Active Contributor
0 Kudos

The description of the supplier invoice BO in the repository explorer says that the item product node is automatically created. Nevertheless I stuck in a check for IsSet() --- same error log.

Former Member
0 Kudos

I can see so many for loops which is not clear to me. According to me there should be only one foreach loop as the script file is mass enabled. So if we do the below

foreach(var ins in this) 

then we can get the current instance in "ins" variable itself. Can you please elaborate what exactly you are trying to do. And the best option is to debug the code and check if all create operation is successful.

Thanks & Regards,

Meghna

former_member183363
Active Contributor
0 Kudos

Meghna,

The first section, below, does the following: goes through each row of input in 'this' and gathers unique instances of supplier invoices within. For example, if the file had two supplier invoices in --- invoice A with two items, and invoice B with one item --- the code would recognise that there are only two invoices in the file, because the second row (item 2 of invoice A) would have the same ship-to address and delivery date as line 1 of invoice A, which is already in the collection. I know this section works, so no need to worry about this.


The next foreach loop --- "foreach (uniqueSupplierInvoice in uniqueSupplierInvoices) { }" --- loops through each unique invoice instance as determined by the above code. For each invoice instance, it steps through and adds the header details. Once it's done that, it goes through each row of input in the XML file and creates the items that are bound for that invoice. So, to continue the previous example: uniqueSupplierInvoices has two instances in, invoices A and B. The main body of the code creates the header elements for invoice A, then goes through each row of input (3 in total) and adds the relevant rows (2, in this case --- remember invoice A has two items in) and adds the items to the invoice. Once that's done, it starts again, creating the header elements for invoice B before adding all relevant rows (one, in the case of invoice B).

In pseudocode, this would be:

Determine all unique invoices

For each unique invoice

{

     Create header elements

     For each row of input in the XML file

     {

          If the row belongs to the current unique invoice, add it to the invoice

     }

}

I hope I've explained this clearly --- if you have any questions, please ask.

former_member183363
Active Contributor
0 Kudos

Dummy reply to add additional files.

Former Member
0 Kudos

Hello,

Please share your code so that it's easy to find errors and the error in debugger seems to be a connectivity issue, which is temporary and would be resolved automatically.

Thanks & Regards,

Meghna

former_member183363
Active Contributor
0 Kudos

Meghna,

That's done --- I couldn't do so until my post went through the moderators.