Search code examples
javascriptc#sapui5sapb1

SAP B1 Service Layer G/L account is not valid


I'm trying to create a new Incoming payment using the service layer but I received this error

G/L account is not valid [PaymentAccounts.AccountCode][line: 1]

My JSON is:

{
    "DocType": "rAccount",
    "DueDate": "2023-03-31",
    "DocDate": "2023-03-31",
    "ProjectCode": "005",
    "BPLID": 1,
    "JournalRemarks": "APL APLIC AUT MAIS",
    "HandWritten": "tNO",
    "Printed": "tNO",
    "LocalCurrency": "tNO",
    "SplitTransaction": "tNO",
    "ApplyVAT": "tNO",
    "CurrencyIsLocal": "tNO",
    "Proforma": "tNO",
    "IsPayToBank": "tNO",
    "PaymentPriority": "bopp_Priority_6",
    "PaymentType": "bopt_None",
    "CashAccount": "1.01.01.01.01",
    "CashSum": 28709.6,
    "PaymentAccounts": {
        "AccountCode": "1.01.01.02.34",
        "SumPaid": 28709.6,
        "GrossAmount": 28709.6
    }
}

I tried to create a new Incoming payment


Solution

  • I resolved this, the PaymentAccounts must be a List< JsonObject >() not just a JsonObject