Skip to Content
author's profile photo
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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • 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 comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    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 comment
    10|10000 characters needed characters exceeded