on 07-05-2022 5:02 PM
Hi, i followed this code:
import ABSL;
import AP.DueItemManagement.Global;
/*Create Root*/
var entryRootData : elementsof TaxReceivablesPayablesEntry;
entryRootData.BusinessPartnerInternalID = "MC9785";
entryRootData.CompanyID = "MC10000";
entryRootData.ReceivablesPayablesEntryTypeCode.content = "1";
entryRootData.PartnerBaseBusinessTransactionDocumentReference.ID.content = "Interest Invoice";
entryRootData.Description = "Sample Script";
entryRootData.TransactionCurrencyCode = "USD";
entryRootData.AccountingTransactionDate = Date.ParseFromString("20140401");
entryRootData.BusinessTransactionDocumentDate = Date.ParseFromString("20140401");
entryRootData.CountryCode = "US";
var entryRoot = TaxReceivablesPayablesEntry.Create(entryRootData);
/*Create CashFlowExpenseAndReceiptExplanation*/
var explanation = entryRoot.CashFlowExpenseAndReceiptExplanation;
if (!explanation.IsSet())
{
explanation = entryRoot.CashFlowExpenseAndReceiptExplanation.Create();
}
var item = explanation.Item.GetFirst();
if (!item.IsSet())
{
item = explanation.Item.Create();
}
item.TransactionCurrencyNetAmount.content = 50;
item.PropertyMovementDirectionCode = "2";
item.TaxationRegionCode.content = "OK";
item.TaxJurisdictionCode.content = "OK";
var tax = "10";
var gross = "50";
/*Set Coding Block*/
item.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment.GetFirst().GeneralLedgerAccountAliasCode.content = "A-1500";
/*Create TradeReceivablesPayablesItem;*/
var tradeItem = entryRoot.TradeReceivablesPayablesItem;
if (!tradeItem.IsSet())
{
tradeItem = entryRoot.TradeReceivablesPayablesItem.Create();
}
tradeItem.CashDiscountTerms.FullPaymentEndDate = Date.ParseFromString("20140401");
/*Set Reconciliation Account: The Reconciliation Account Type Codes for Accounts Payable and Accounts Receivable can be seen in Business Configuration -> "Charts of Accounts, Financial Reporting Structures, Account Determination" activity -> Reconciliation Account Types.
Set the correct Reconciliation Account based on whether the item is a payable or a receivable */
tradeItem.AccountsReceivableDueItemTypeCode.content = "AR010";
/*tradeItem.AccountsPayableDueItemTypeCode.content = "AP020";*/
/*Call Release Action on the instance*/
entryRoot.Release();
in the documentation to create charge and credit using ABSL code and it works but i'm trying to create multiple lines in Account Assignment node but it didn't work it creates one line only successfully .. any help ?
Ahmed
You code seems fine, and very similar to the code I am using.
However I try the system gives me a "G/L Code missing" Error. I have spoken with the product developers and we think you should open an incident in your ByD tenant with the errors so they can determine how these errors are being raised.
/*
Add your SAP Business ByDesign scripting language implementation for:
Business Object: AddAccount
Node: Root
Event: BeforeSave
Note:
- To access the elements of the business object node,
use path expressions, for example, this.<element name>.
- To use code completion, press CTRL+J.
- The solution uses this script when:
- the instance of the business object is being saved.
- the instance of the business object is created from other sources like web services, preview screen, and so on.
*/
import ABSL;
import AP.DueItemManagement.Global;
//Create TaxPayableReceivable Root
var entryRootData: elementsof TaxReceivablesPayablesEntry;
entryRootData.BusinessPartnerInternalID = this.Account;
entryRootData.CompanyID = "1000";
entryRootData.ReceivablesPayablesEntryTypeCode.content = "1";
entryRootData.PartnerBaseBusinessTransactionDocumentReference.ID.content = "Interest Invoice";
entryRootData.Description = "Sample Script";
entryRootData.TransactionCurrencyCode = "USD";
entryRootData.AccountingTransactionDate = Date.ParseFromString("20220701");
entryRootData.BusinessTransactionDocumentDate = Date.ParseFromString("20220701");
entryRootData.CountryCode = "GB";
var entryRoot = TaxReceivablesPayablesEntry.Create(entryRootData);
/*Create CashFlowExpenseAndReceiptExplanation*/
var explanation = entryRoot.CashFlowExpenseAndReceiptExplanation;
if (!explanation.IsSet()){
explanation = entryRoot.CashFlowExpenseAndReceiptExplanation.Create();
}
var item = explanation.Item.GetFirst();
if (!item.IsSet()){
item = explanation.Item.Create();
}
item.TransactionCurrencyNetAmount.content = 100;
item.PropertyMovementDirectionCode = "1";
item.ItemAccountingCodingBlockDistribution.TotalAmount.content = 100;
item.ItemAccountingCodingBlockDistribution.GeneralLedgerAccountAliasContextCodeElements.UsageCode = "10";
foreach(var block in this.Codingblock){
var accAssign: elementsof item.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment;
accAssign.AccountingCodingBlockTypeCode.content = "ACC";
accAssign.GeneralLedgerAccountAliasCode.content = block.GLAlias;
var dist = item.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment.Create(accAssign);
if(dist.IsSet()){
dist.Amount = block.costAmount;
dist.GeneralLedgerAccountAliasCode.content = block.GLAlias;
}
}
/*Create TradeReceivablesPayablesItem;*/
var tradeItem = entryRoot.TradeReceivablesPayablesItem;
if (!tradeItem.IsSet())
{
tradeItem = entryRoot.TradeReceivablesPayablesItem.Create();
}
tradeItem.CashDiscountTerms.FullPaymentEndDate = Date.ParseFromString("20220701");
/*Set Reconciliation Account: The Reconciliation Account Type Codes for Accounts Payable and Accounts Receivable can be seen in Business Configuration -> "Charts of Accounts, Financial Reporting Structures, Account Determination" activity -> Reconciliation Account Types.
Set the correct Reconciliation Account based on whether the item is a payable or a receivable */
tradeItem.AccountsReceivableDueItemTypeCode.content = "AR010";
/*tradeItem.AccountsPayableDueItemTypeCode.content = "AP020";*/
/*Call Release Action on the instance*/
entryRoot.Release();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
8 | |
8 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.