on 04-14-2015 11:20 AM
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
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()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
9 | |
8 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.