cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to create a Checks/Credit Card deposit via SDK?

Former Member
0 Kudos

I've checked the SDK Help and while the Deposit object has a Checks and a Credits property (Deposit.Checks and Deposit.Credits) which are of type CheckLine and CreditLine respectively have all their properties defined as read only. I want to do something like this but I can't (pseudocoded)

Deposit.Checks.Add()

Deposit.Checks.Item(1).AccountNumber = "ABC123"

Nor can I do this

CheckLine MyCheckLine;

MyCheckLine.AccountNumber = "ABC123"

I get a syntax error stating that the property is read only in both cases.

Is it possible to create deposits of checks and credit cards and my understanding of how it works is wrong

Or the SDK does not allow this kind of deposits to be created?

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor
0 Kudos

Hi Hector,

For you to do a deposit with credit card or check, you need to have an check or a credit card to compesating.

For check, you can look in OCHH table, where the checks with the column deposited equals 'N'

SELECT CheckKey FROM OCHH WHERE Deposited = 'N'

In the deposit object, you only defines the checkKey property, with the value that you catch in the SQL statement.

For credit card, you should do the same thing, but you need do a sql in OCRH.

SELECT AbsId FROM OCRH WHERE Deposited = 'N'

In the deposit object, you only defines the AbsId property, with the value that you catch in the SQL statement

Hope it helps.


Best regards,

Diego Lother


View Diego Lother's profile on LinkedIn

Former Member
0 Kudos

Hello Diego.

I tried what you mentioned doing something like this:

MyDeposit.Check.Add();

MyDeposit.Check.Item(0).CheckKey = 1;

The number 1 is in fact a check where the Deposited property is == 'N'

I've specified the MyDeposit.BankAccount and I get the error "Missing bank account"

So I specified the MyDeposit.DepositAccount too and I get the error "Missing allocation account"

I then specified the MyDeposit.AllocationAccount and I now get the (loosely translated) error "Cash amount must be positive"

When I debug my code, right before adding the deposit, I check for the MyDeposit.Checks.Item(0).CheckAmount and the value is 0. No values are retrieved for the check so I suppose that (in theory) the Check values are retrieved during the insertion operation.

In conclusion, it is not working... but I don't know why. What am I doing wrong? 😕

former_member185682
Active Contributor
0 Kudos

Hi Hector,

My sample code for check deposits:


                SAPbobsCOM.CompanyService oCompanyService = oCompany.GetCompanyService();

                //Create the deposit

               

                SAPbobsCOM.DepositsService oDepositService = (SAPbobsCOM.DepositsService)oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.DepositsService);

                SAPbobsCOM.Deposit oDeposit = (SAPbobsCOM.Deposit)oDepositService.GetDataInterface(SAPbobsCOM.DepositsServiceDataInterfaces.dsDeposit);

                SAPbobsCOM.DepositParams oDepositParams = (SAPbobsCOM.DepositParams)oDepositService.GetDataInterface(SAPbobsCOM.DepositsServiceDataInterfaces.dsDepositParams);// = dpService.AddDeposit(dpsAddCash); 

                oDeposit.DepositType = SAPbobsCOM.BoDepositTypeEnum.dtChecks;

                CheckLines chks = oDeposit.Checks;

                CheckLine chk = chks.Add();

                chk.CheckKey = 9;

                Console.WriteLine(chk.CheckAmount);

                oDeposit.DepositDate = DateTime.Today;

                oDeposit.DepositCurrency = "R$";

                oDeposit.DepositAccount = "1.01.01.02.02";

                oDepositParams = oDepositService.AddDeposit(oDeposit);

                Console.WriteLine(oDepositParams.DepositNumber);

About the check amount, you are correct, the api only fill it in the insert operation.

My SAP is 9.1 PL 11.

Hope it helps.


Best regards,

Diego Lother


View Diego Lother's profile on LinkedIn

Former Member
0 Kudos

... I feel so ashamed.

Since I copypasted a piece of code I used somewhere else, I forgot to change the DepositType... man, such a silly mistake. Only after reviewing your code I was able to notice that!

Thank you Diego! This is twice in a row you solved my issues with deposits!

former_member185682
Active Contributor
0 Kudos

It happens.

Cool that your problem was solved.


Best regards,

Diego Lother


View Diego Lother's profile on LinkedIn

distherec
Discoverer
0 Kudos

HI, i wanna create a deposit by diapi but previosly i have to update field Trnsfrable in table OCHH.

I can't find how to do it.

is it possible or not what i'm looking for?

Answers (1)

Answers (1)

Former Member
0 Kudos

You can try this.

  1. InPay.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_DownPayment
  2. InPay.CreditCards.CreditCard = 1  ' Mastercard = 1 , VISA = 2
  3. InPay.CreditCards.CardValidUntil = CDate("10/31/2015")
  4. InPay.CreditCards.CreditCardNumber = "1111" ' Just need 4 last digits
  5. InPay.CreditCards.CreditSum = 9700 ' Total Amount of the Invoice
  6. InPay.CreditCards.VoucherNum = "1234" ' Need to give the Credit Card confirmation number.