Skip to Content
author's profile photo Former Member
Former Member

-5002 Date deviates from permissible range [OJDT.DueDate] [(---)173-11]

I am using the SapBOBCom to talk to SAP. Receiving a weird error when attaching payments to a credit memo: -5002 Date deviates from permissible range [OJDT.DueDate] [(---)173-11]. This happens when I try to refund money to anything other than cash. Cash payments go through with no problem. We have tested this with 2005 and 2007 SAP. The posting period is for the current year, and my payments are going in with today's date.

For a test, what I did was create a credit memo directly in SAP. Now I'm trying to attach a payment with credit card through my delphi app. I'm using the demo database, but the original problem occurred with a live database. Here's my code in that method. Does anyone see anything off?

procedure TfrmMain.btnOutgoingClick(Sender: TObject);

var

oPayments: SAPbobsCOM_TLB.Payments;

begin

ConnectDatabase;

oPayments := IPayments(oCompany.GetBusinessObject(oVendorPayments));

oPayments.CashAccount := '_SYS00000000001';

oPayments.CashSum := 0.0;

oPayments.HandWritten := tNO;

oPayments.DocDate := Now;

oPayments.DocType := rCustomer;

oPayments.CardCode := 'AZRK224';

oPayments.Invoices.DocEntry := 3;

oPayments.Invoices.DiscountPercent := 0.0;

oPayments.DocObjectCode := bopot_OutgoingPayments;

oPayments.Invoices.InvoiceType := it_CredItnote;

oPayments.Invoices.SumApplied := 138.86;

oPayments.CreditCards.CreditCard := 2; //MasterCard

oPayments.CreditCards.CreditAcct := '_SYS00000000005'; //Mastercard

oPayments.CreditCards.CardValidUntil := Now + 365;

oPayments.CreditCards.CreditSum := 138.86;

iRetCode := oPayments.Add;

if iRetCode <> 0 then

PopLastError

else

StatusBar.Panels[0].Text := 'Added payment';

end;

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 03:11 AM

    Dear David Lawnicki,

    Please try set the TaxDate to see if can solve the issue:

    oPayments.TaxDate = Now
    

    Best Regards

    Jane Jing

    SAP Business One Forums team

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.