Skip to Content
avatar image
Former Member

how to include business logic in B1 AddOn?

I would like to know best way for including business logic in B1 AddOn. I know including triggers in SQL it is not allowed but I think this is a powerfull way. For example, I want to update some UDFs increasing and decreasing numeric values automatically when purchases and sales are created.

Waiting your answers!!!

Thanks a lot!!!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Sep 09, 2014 at 04:09 PM

    Hi Miguel,

    An addon can manage only it's connection, not modification done by other users. If this is a requirement, your "best friend" will be B1if...

    Regards,

    Eric

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 10, 2014 at 07:24 AM

    Hi,

    try to use POST transaction notification.

    or

    through Code u can mange

    Regards,

    Prasad

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 10, 2014 at 08:23 AM

    Hi Miguel,

    Perhaps you could rethink your solution.

    UDF's should be used to store more or less static data, or to show (calculated) data on a transaction in progress (formatted search).

    You could use Prasad's suggestion to mimic the trigger effect, but I would recommend calculating whatever this value is at the moment you consume it, instead of trying to store it before. In other words, perform the calculation when you run the report, or calculate it on the fly using a formatted search.

    Even with a trigger, your UDF will only show the value to the user, that it was at the moment the form was opened.

    Regards,

    Johan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 12, 2014 at 07:26 AM

    Thanks a lot for your answers.

    Some questions:

    - I think UPDATE, DELETE or INSERT instructions are not allowed by SAP in POST transaction notification store procedure.

    - I want to make an AddOn for controling sizes in products. Products will have sizes (S, M, L and XL for example). Then, when a purchase, sale or transfer stock is done, I would like update stock sizes automatically as part of the general transaction. I could calculate stock sizes with formatted searchs adding purchases and sustracting sales, but I think this is not the best solution for performance having a lot of transactions in database.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Miguel,

      Could you please describe your scenario in a little more detail ?

      • ...I would like update stock sizes automatically...

      What do you mean with "stock sizes" ?

      • ...I could calculate stock sizes with formatted searchs adding purchases and sustracting sales,...

      The system maintains live stock levels in the OITM.OnHand and OITW.OnHand fields, but depending on the answer to the first question, these may not suffice for you.

      Calculating this in a (well built) query should not strain the system. However, the impact on performance depends entirely on where you plan to show / perform the calculation.

      Doing it on a row level in a document (purchase, sale or transfer stock) with more than 20 rows, may slow down opening the form, but it would not affect your system performance as a whole.

      By the way, it sounds like you have a clothing scenario. To my knowledge there are special addons available for that already. Just post your scenario for example on LinkedIn, and I am sure you'll get some suggestions.

      Regards,

      Johan

  • avatar image
    Former Member
    Sep 12, 2014 at 11:26 AM

    Yes, Joan, I have a clothing scenario and I want to develop a little addon for controlling stocks by sizes.

    My idea was to create UDFs in OITM and OITW tables (STOCKSIZE_S, STOCKSIZE_M, STOCKSIZE_L....) for saving stocks by sizes and warehouses in real time. But I don´t know where can do these UPDATEs because this is not allowed in SBO_SP_TransactionNotification stored procedure.

    Finally, I am thinking to use formatted search to calculate stocks by sizes and warehouses. So, I don´t need include business logic in purchases and sales transactions.

    Thanks a lot for your help.

    Regards,

    Miguel

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 16, 2014 at 03:54 PM

    Hi,

    You can fill your UserField after adding your document, or fill Form db datasource in beforeaction true in the formDataEvent if the userfield is in the same form or db datasource.

    Regards, Alessandro.

    Add comment
    10|10000 characters needed characters exceeded