Skip to Content
0

Supplier Invoice - Execute CreateCancellationFromReference Action via ABSL

Nov 13, 2016 at 05:17 PM

183

avatar image

Hi All,

I try to execute Supplier Invoice - CreateCancellationFromReference Action via ABSL Script. This action is already PSM released. But I could not call this action via ABSL (The action is not listed in the suggestion dropdown). Do I need to add anything more with this coding?

My ABSL Script:

Regards

Sankaran A

cancel.png (29.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Pradeep Kumar N
Nov 14, 2016 at 02:41 AM
1

Hi Sankaran,

Action CreateCancellationFromReference doesn't need any input, hence call this action with just the BO name:

SupplierInvoice.CreateCancellationFromReference

Thanks, Pradeep.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Pradeep,

Thank you so much. I tried the bellow code. But It is showing an error.

import ABSL;
import AP.SupplierInvoicing.Global;

var querySI = SupplierInvoice.QueryByElements;
var paraSI = querySI.CreateSelectionParams();
paraSI.Add(querySI.ID.content, "I", "EQ", this.ID);
var result = querySI.Execute(paraSI);
var SIIns;

if(result.Count() > 0)
{
	SIIns = result.GetFirst();
	var returnSI = SupplierInvoice.CreateCancellationFromReference(SIIns);
	if(returnSI.IsSet())
	{
		returnSI.TransactionDate = this.PostDate;
	} 
}



The error message is You cannot post the invoice on 01/01/2014. This date is blocked for postings in financial accounting.

This error is not coming from the financial area I guess. If I manually create the cancellation document from SupplierInvoice Screen, The above error message will come and If I change the posting date, the error message will not appear.

I think, I am doing some mistake in my coding on assigning the transaction date. Please help to solve this error.

Regards

Sankaran A

0

It is working Pradeep. Thanks. But struggling to post the instant.

if(result.Count() > 0)
{
	SIIns = result.GetFirst();
	var returnSI = SupplierInvoice.CreateCancellationFromReference(SIIns);
	if(returnSI.IsSet())
	{
		returnSI.TransactionDate = this.PostDate;
                returnSI.Post(); //It is not working
	} 
}
0

Hi Sankaran,

Error is due to missing process control in the system for the period X in which date 01/01/2014 lies.

If you maintain process control for the period, you should be able to release the document however there will not be any postings in accounting if period is also blocked. So you may need to post them manually to another period or open the period and then post the document.

To be honest, I am not familiar with the ABSL scripts. but to me this logic seems to take the posting date of the original invoice and posting for that date is blocked in accounting. I might be missing something here. :)

Thanks,

Harshal

0