cancel
Showing results for 
Search instead for 
Did you mean: 

Create a deposit for bill of exchange

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member762348
Discoverer
0 Kudos

Hi,

I Solved....example in VB.Net:

Dim bol2 As SAPbobsCOM.BillOfExchangeTransaction

bol2 = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBillOfExchangeTransactions)

bol2.StatusFrom = SAPbobsCOM.BoBOTFromStatus.btfs_Deposited

bol2.StatusTo = SAPbobsCOM.BoBOTToStatus.btts_Paid 'bol.IsBoeReconciled =SAPbobsCOM.BoYesNoEnum.tYES

bol2.Lines.SetCurrentLine(0)

bol2.Lines.BillOfExchangeNo = nbol 'nbol as Integer - BoeNum

bol2.Lines.BillOfExchangeType = SAPbobsCOM.BoBOETypes.bobt_Incoming

bol2.Deposits.PostingType = SAPbobsCOM.BoDepositPostingTypes.dpt_Collection

bol2.Deposits.BankDepositAccount = "7470" <--Bank Account No. (DSC1.Account)

bol2.Deposits.BankCountry = "BR" <--Country

bol2.Deposits.BankBranch = "4531" <--Bank Branch (DSC1.Branch)

bol2.Deposits.BankAccount = "001" <--Bank Code (DSC1.BankCode)

bol2.add()

Former Member
0 Kudos

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

Former Member
0 Kudos

Hello Radhia,

Did you manage to solve this issue?

I'm facing the same problem here.

Thanks

Former Member
0 Kudos

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

maik_delly
Active Contributor
0 Kudos

my best guess is, that BillOfExchangeNo is not correct.

Former Member
0 Kudos

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

maik_delly
Active Contributor
0 Kudos

What is the result of oBOEtrans.Add();  If it is differnet from 0 get

Program.oDiCompany.GetLastErrorDescription();

regards,

Maik

maik_delly
Active Contributor
0 Kudos

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