Skip to Content

How do we write code for: UseNegativeAmounts ?

Nov 14, 2016 at 11:54 AM


avatar image

Hi, everybody

We are closing our previous thread which is getting too crowded, and replacing it by this simplified one.

Previous thread:

Is it possible to make an add-on run automatically when a user logs in to SAP B1?

Please see attached picture which explains what we want to do.


Any help is most welcome.


Leon Lai

capture.jpg (219.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
DIEGO LOTHER Nov 14, 2016 at 12:09 PM

Hi Leon,

How can Edy said in previous post, you can update this information with the AdminInfo object of the DI API. The changes that you do in this object will be reflect for all user os the company.

Sample code:

Dim oCompanyService As CompanyService = oCompany.GetCompanyService()
Dim oCompanyAdminInfo As AdminInfo = oCompanyService.GetAdminInfo()
oCompanyAdminInfo.UseNegativeAmounts = BoYesNoEnum.tYES

Kind Regards,

Diego Lother

10 |10000 characters needed characters left characters exceeded
Edy Simon Nov 15, 2016 at 01:34 AM

Hi Leon,

You need to take into consideration that your user might not have authorization to update this system wide property.


Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Edy,

This is my terrible nightmare! I always feared that this might happen. Unfortunately, I am working on a complex add-on and have not yet completed it sufficiently to test if it works for all users.

I will do a simple add-on to test if UseNegativeAmounts will work for users who have say only Logistics Access to SAP. If it does not work, it's not too bad, because they could not change the settings anyway.

But there may be cases where having only Logistics Access may result in some add-ons not working for them.

Best Regards,



Hi, Edy

We just wrote a simple add-on to modify the Company Details.

It worked perfectly for a user with Professional access.

Then we logged on using user "John", who has only Logistics access.

"John" does not have access to the Company Details screen (we checked and it was invisible on the menu).

But when we ran the add-on (in Visual Studio - debug), it worked perfectly - changing the settings as we wanted.

We hope it will work when we make it into an .ard file. We have not tested yet.


I am glad you are not entirely right this time! John does not have access to the Company Details settings on screen. But he can modify these with SDK add-on! (BTW, it was you who gave me this answer some (long) time ago, and it was this which gave me enough hope and courage to develop company-wide add-ons).




Hi Leon,

You are right, this setting is not controlled by the authorization.