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

Create a deposit for bill of exchange

Hello professionals

I try to create a deposit for bill of exchange but without success..here is my code

SAPbobsCOM.BillOfExchangeTransaction oBOEtrans = (SAPbobsCOM.BillOfExchangeTransaction)Program.oDiCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBillOfExchangeTransactions);

try

{

oBOEtrans.StatusFrom= SAPbobsCOM.BoBOTFromStatus.btfs_Generated;

oBOEtrans.StatusTo = SAPbobsCOM.BoBOTToStatus.btts_Deposit;

oBOEtrans.Lines.Add();

oBOEtrans.Lines.SetCurrentLine(0);

oBOEtrans.Lines.BillOfExchangeNo = 119;

oBOEtrans.Lines.BillOfExchangeType = SAPbobsCOM.BoBOETypes.bobt_Incoming;

oBOEtrans.Add();

}

catch (Exception e)

{

Application.SBO_Application.MessageBox(e.Message);

}

finally

{

if (oBOEtrans != null)

System.Runtime.InteropServices.Marshal.ReleaseComObject(oBOEtrans);

}

when I run it it the application crushes .. what is wrong with it ?

Please help

Best regards

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Posted on Apr 14, 2015 at 10:58 AM

    Hi Radhia,

    you have an unneeded oBOEtrans.Lines.Add(); in your code ( every lines object contains already one empty line ). Apart from that it looks ok.

    Which line is it crashing and what is the message ( I guess an exception is thrown ? ) ?

    regards,

    Maik

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 14, 2015 at 12:41 PM

    hello Maik,

    thanks for your reply

    I added some code lines , now there is no crush but still do nothing ... the operation finished successfully but when i check the table OBOT there is no line inserted the status of the bill doesn't change .. this the code

    oBOEtrans.StatusFrom= SAPbobsCOM.BoBOTFromStatus.btfs_Generated;

    oBOEtrans.StatusTo = SAPbobsCOM.BoBOTToStatus.btts_Deposit;

    oBOEtrans.Lines.SetCurrentLine(0);

    oBOEtrans.Lines.BillOfExchangeNo =746;

    oBOEtrans.Lines.BillOfExchangeType = SAPbobsCOM.BoBOETypes.bobt_Incoming;

    //////////

    oBOEtrans.Deposits.BankAccount = "004003274000003210";

    oBOEtrans.Deposits.BankCountry = "DZ";

    oBOEtrans.Deposits.BankBranch = "00327";

    oBOEtrans.Deposits.PostingType = SAPbobsCOM.BoDepositPostingTypes.dpt_Discounted;

    oBOEtrans.IsBoeReconciled = SAPbobsCOM.BoYesNoEnum.tYES;

    oBOEtrans.PostingDate = DateTime.Today;

    ///////////

    oBOEtrans.Add();

    please help .. any help is appreciated

    Best regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 14, 2015 at 01:40 PM

    Hello Maik

    Thanks for your reply ..I get the Error: No Matching records found ... I dont understand which record ? Bill of exchange number or something else

    Best regards

    Radhia

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 14, 2015 at 03:06 PM

    Hello Maik

    the number is totally correct when I tried to create a transaction from Deposited to Paid it works fine but from Generated to Deposited I get an error

    I guess I need to create a deposit but the problem with bill of exchange is that I cant assign a number of BOE because this field is ReadOnly

    Thanks & Best regards

    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.