It has been a while since I implemented my first event-driven scenario in SAP Business One. Ever since I started, I came across an “ocean” of possibilities/Platforms/Services that offer pretty much the same approach on how to achieve that, each of which has its own Pros and Cons.

There is no doubt that the industry is well developed and can offer numerous ways of getting things done, and I am a bit “overzealous” when it comes to learning new technologies (after all, it is our bread & butter). But whenever I sit down to write down a project design, I try to stick to the “One-Stop” approach, where opting for reusing tools and services embedded within the B1 application itself would probably be at the top of my list.

These tools have been out there ever since and have scaled up throughout the years and not only haven’t been deprecated but have also expanded their capabilities and performances.

Don’t get me wrong; I do think that the SAP BTP Platform, for instance, provides endless possibilities when it comes to consuming  REST Web Services that can interact with our SAP systems and also allows for reusing some of the most powerful connectors to integrate with other SAP / Non-SAP systems, as well as to extend our business applications and business processes. The SAP BTP also utilises cutting-edge services such as AI Builders and Fiori Apps tools. So the purpose here is not to knock down the SAP BTP, which rightfully earned its place, but merely to state that the SAP BTP is not the only game in town.

Nevertheless, those of you who tried navigating through this ocean of data exposed on top of the SAP BTP platform probably realized by now that the BTP is very much S4/HANA oriented and is not specifically tailored for SAP Business One developers.

On top of it, the BTP presents some evident shortfalls:

  1. Long and tedious setup -adding a subscription/Instance/entitlement will cost you time, and in most cases, you wouldn’t get it right the first time
  2. Pricing tiers are just not suitable for SMB clients. As long as you are using the “Free” subscription for non-productive environments, you should be fine, but once you transition into the “Pay-As-You-Go” subscription tiers and go into production,in most cases, it would become an “overkill” for any SMB-based project and also rather costly.
  3. It has no built-in awareness of the B1 objects. We can use it and call it like we would use any other API to make it “aware” of what we are looking to get.

So let’s get right to it – how do we implement an Event Forwarding Scenario and use the information we get to trigger/build other B1-related solutions without overcomplicating things?

Typically, we would need to do the following:

  1. Set up an SAP Event Mesh instance on BTP
  2. Having an SAP CAP Application to handle the events in BTP (usually used for building enterprise-grade services and applications, which again, is “swinging for the fence” when it comes to SAP B1)
  3. We would need to code an auxiliary step to retrieve the Token in order to authenticate against the SAP Event Mesh instance on the SAP BTP Platform.

 

The architectural overview would look like the following:

 

What if I told you that we can skip the part where we subscribe to the BTP and go straight to our B1 Integration framework (B1If) to consume those events and further utilize them to extend our B1 application behaviour using Microsoft Azure?

Assuming you have the B1iF installed and set up correctly in your environment, you are off to a good start.

I would strongly advise you to consider taking the following steps to ensure that you fully comply with all the prerequisites:

** If you are experiencing any issues with configuring the B1iF, please feel free to reach out to me, and I will be happy to provide guidance and support**

 

Lastly, we would want to set up our B1iF Event Sender to start firing events.

B1iF best practices dictate that we adhere to the following:

1)Make sure you access the Integration Framework 2.0 Instead of 1.0:

This comes with several key benefits:

  • Comes in addition to the integration framework – all programming models can run simultaneously in parallel.
  • Optimized for cloud computing
  • Inbuilt multi-tenancy − More flexibility in scenario deployments
  • Built to address all integration developers
    • Higher flexibility
    • More control and transparency when developing integration content
  • “Classical” developers feel more comfortable because of the new browser-based IDE
  • Up to 10 times faster – runs directly on top of the integration platform
  • Does not replace the current programming model Migration of existing scenario packages not required, unless you want to make use of multi-tenancy in cloud environments

 

 

2. Make sure all your SLD connections test OK:

Having one of these connections broken will compromise the process and disallow communication with your HANA server / Service Layer later on, so you would want to make sure they are all clear and, in case they don’t, to reconfigure your connection strings.

 

3) Make sure to filter B1i events by navigating to Maintenance -> B1 Event Filter and checking the “B1i User Filter Switched On” -this will ensure you get rid of all those system events you are not looking to listen to

 

Note that you can also include that configuration on version 1.X by accessing it directly from version 2.0 (under Tools ->Version 1) and navigating to the Event Sender Wizard.

This is where you would also want to include your B1 Object IDs for all those objects you wish to get events for

 

You can find the complete list of B1 objects at the end of this thread

Alternatively, you can retrieve that value straight from the B1 application by launching the Query Generator and selecting the “<table_name>”.” ObjType” column:

 

 

4) The most important step is to test that YOUR events are NOT being filtered out but rather relayed to the B1 Event Monitor when triggering your scenario.

In my case, I simply created a Business Partner and refreshed the display to see that B1iF was able to catch the event:

Note: The test run will only be successful if you make sure to add a new deployment to the “Deployment Panel” of your scenario and assign a valid Sender/Receiver system from your SLD– that pane is the new (and cool!) feature in version 2.0 that allows you to get one single overview of all your scenario artefacts.

 

Once we know for a fact that our Event Sender is properly processing our events, we can proceed with building our scenario in BizFlow.

Now, it is important that we fully understand what we are trying to achieve here:

We just want B1iF to forward every event that meets our filtering criteria to an external HTTP WebHook-based workflow in the form of an XML  payload from which we can then parse and retrieve data.

That’s all there is to it!

If you ask yourselves ‘Why?’, then the answer is pretty straightforward:

With Azure Logic Apps and the built-in HTTP Webhook connector, we can create automated tasks and workflows that subscribe to a service endpoint by registering a callback URL, wait for specific events, and run based on those events, rather than regularly checking or polling that endpoint.

This is particularly useful and beneficial in cases where PaaS (Platforms as a Service) like Microsoft-Azure charge you per execution.

Just imagine how many executions will be triggered within a 24-hour timeframe when a workflow is scheduled to run every 15 minutes (96 executions) vs 3 executions for those 3 new Business Partners you created when the workflow is only triggered right after the Business Partner record is added to the B1 database.

This directly impacts consumption and, consequently, how much you will be charged at the end of the month.

 

Having said that, I will cover the Logic App side of our project during the next part of this blog.

 

Let’s first finalize our scenario and scenario steps.

Our BizFlow diagram will be a relatively simple one:

 

We are looking at a typical ‘Asynchronous’ process mode where the event is fired, fetched and then relayed to the  Inbound Atom, where it is then transformed via an XSLT Atom to be used in our HTTPCall Atom.

Keep in mind that B1iF always processes the data internally as XML so, in our case, we just wish to grab the XML representation of our event from the Sender System (Event Sender) and use it as part of our HTTP Call Body.

 

A good way of analyzing the structure of the messages during runtime is to use the B1iF Debugger:

 

Our XSL transformation Atom will only need to be adjusted to fetch the Incoming XML payload of the B1 Event, where an XPATH expression will then be added to our HTTPCall Atom to.

 

We will return to our HttpCall Atom after we conclude our Logic App (WebHook) discussion in Part 2 of this blog.

 

Let’s summarize what we have accomplished so far:

  1. We have presented our main topic – Event Creation and Forwarding in SAP Business One
  2. We covered some of the most common ways to achieve event handling while outlining the Pros and Cons of each approach.
  3. We went through some of the basic settings and configurations of the SAP Business One Integration Framework
  4. We covered the new B1iF version 2.0 enhancements
  5. We had a detailed overview of the Event Sender setup and learned how to successfully set filtering criteria for B1 Objects we wish to get events for
  6. We learned how to deploy a development via the “Deployment Panel “ of our scenario and assign an SLD sender/receiver system.
  7. We discussed HTTP WebHooks and understood how they play a significant role in reducing the number of workflow executions that will ultimately affect our billing.
  8. We went through the various scenario steps to receive an Inbound message ( event ), then process and transform it, and further prepare it for the HTTPCall Atom.

 

Join us on the SAP Business One Community Blog page for Part 2 of Implementing an Event-Forwarding Mechanism using SAP Business One B1iF and Microsoft Azure.

 

List of SAP Business One Object Types

 

Table Table description Primary Key Object Type
OACT G/L Accounts AcctCode 1
OCRD Business Partner CardCode 2
ODSC Bank Codes AbsEntry 3
OITM Items ItemCode 4
OVTG Tax Definition Code 5
OPLN Price Lists ListNum 6
OSPP Special Prices CardCode, ItemCode 7
OITG Item Properties ItmsTypCod 8
ORTM Rate Differences LineNum, IsSysCurr 9
OCRG Card Groups GroupCode 10
OCPR Contact Persons CntctCode 11
OUSR Users USERID 12
OINV A/R Invoice DocEntry 13
ORIN A/R Credit Memo DocEntry 14
ODLN Delivery DocEntry 15
ORDN Returns DocEntry 16
ORDR Sales Order DocEntry 17
OPCH A/P Invoice DocEntry 18
ORPC A/P Credit Memo DocEntry 19
OPDN Goods Receipt PO DocEntry 20
ORPD Goods Return DocEntry 21
OPOR Purchase Order DocEntry 22
OQUT Sales Quotation DocEntry 23
ORCT Incoming Payment DocEntry 24
ODPS Deposit DeposId 25
OMTH Reconciliation History MthAcctCod, IsInternal, MatchNum 26
OCHH Check Register CheckKey 27
OBTF Journal Voucher Entry BatchNum, TransId 28
OBTD Journal Vouchers List BatchNum 29
OJDT Journal Entry TransId 30
OITW Items – Warehouse ItemCode, WhsCode 31
OADP Print Preferences PrintId 32
OCLG Activities ClgCode 33
ORCR Recurring Postings RcurCode, Instance 34
ONNM Document Numbering ObjectCode, DocSubType 35
OCRC Credit Cards CreditCard 36
OCRN Currency Codes CurrCode 37
OIDX CPI Codes IdexCode 38
OADM Administration Code 39
OCTG Payment Terms GroupNum 40
OPRF Preferences FormNumber, UserSign 41
OBNK External Bank Statement Received AcctCode, Sequence 42
OMRC Manufacturers FirmCode 43
OCQG Card Properties GroupCode 44
OTRC Journal Entry Codes TrnsCode 45
OVPM Outgoing Payments DocEntry 46
OSRL Serial Numbers ItemCode, SerialNum 47
OALC Loading Expenses AlcCode 48
OSHP Delivery Types TrnspCode 49
OLGT Length Units UnitCode 50
OWGT Weight Units UnitCode 51
OITB Item Groups ItmsGrpCod 52
OSLP Sales Employee SlpCode 53
OFLT Report – Selection Criteria FormNum, UserSign, FilterName 54
OTRT Posting Templates TrtCode 55
OARG Customs Groups CstGrpCode 56
OCHO Checks for Payment CheckKey 57
OINM Whse Journal TransNum, Instance 58
OIGN Goods Receipt DocEntry 59
OIGE Goods Issue DocEntry 60
OPRC Cost Center PrcCode 61
OOCR Cost Rate OcrCode 62
OPRJ Project Codes PrjCode 63
OWHS Warehouses WhsCode 64
OCOG Commission Groups GroupCode 65
OITT Product Tree Code 66
OWTR Inventory Transfer DocEntry 67
OWKO Production Instructions OrderNum 68
OIPF Landed Costs DocEntry 69
OCRP Payment Methods CrTypeCode 70
OCDT Credit Card Payment Code 71
OCRH Credit Card Management AbsId, Instance 72
OSCN Customer/Vendor Cat. No. ItemCode, CardCode, Substitute 73
OCRV Credit Payments AbsId, PayId, Instance 74
ORTT CPI and FC Rates RateDate, Currency 75
ODPT Postdated Deposit DeposId 76
OBGT Budget AbsId 77
OBGD Budget Cost Assess. Mthd BgdCode 78
ORCN Retail Chains ChainCode 79
OALT Alerts Template Code 80
OALR Alerts Code 81
OAIB Received Alerts AlertCode, UserSign 82
OAOB Message Sent AlertCode, UserSign 83
OCLS Activity Subjects Code 84
OSPG Special Prices for Groups CardCode, ObjType, ObjKey 85
SPRG Application Start LineNum, UserCode 86
OMLS Distribution List Code 87
OENT Shipping Types DocEntry 88
OSAL Outgoing DocEntry 89
OTRA Transition DocEntry 90
OBGS Budget Scenario AbsId 91
OIRT Interest Prices Numerator 92
OUDG User Defaults Code 93
OSRI Serial Numbers for Items ItemCode, SysSerial 94
OFRT Financial Report Templates AbsId 95
OFRC Financial Report Categories TemplateId, CatId 96
OOPR Opportunity OpprId 97
OOIN Interest Num 98
OOIR Interest Level Num 99
OOSR Information Source Num 100
OOST Opportunity Stage Num 101
OOFR Defect Cause Num 102
OCLT Activity Types Code 103
OCLO Meetings Location Code 104
OISR Service Calls RequestNum 105
OIBT Batch No. for Item ItemCode, BatchNum, WhsCode 106
OALI Alternative Items 2 OrigItem, AltItem 107
OPRT Partners PrtId 108
OCMT Competitors CompetId 109
OUVV User Validations IndexID, LineNum 110
OFPR Posting Period AbsEntry 111
ODRF Drafts DocEntry 112
OSRD Batches and Serial Numbers ItemCode, DocType, DocEntry, DocLineNum 113
OUDC User Display Cat. CodeID 114
OPVL Lender – Pelecard Code 115
ODDT Withholding Tax Deduction Hierarchy Numerator 116
ODDG Withholding Tax Deduction Groups Numerator 117
OUBR Branches Code 118
OUDP Departments Code 119
OWST Confirmation Level WstCode 120
OWTM Approval Templates WtmCode 121
OWDD Docs. for Confirmation WddCode 122
OCHD Checks for Payment Drafts CheckKey 123
CINF Company Info Version 124
OEXD Freight Setup ExpnsCode 125
OSTA Sales Tax Authorities Code, Type 126
OSTT Sales Tax Authorities Type AbsId 127
OSTC Sales Tax Codes Code 128
OCRY Countries Code 129
OCST States Country, Code 130
OADF Address Formats Code 131
OCIN A/R Correction Invoice DocEntry 132
OCDC Cash Discount Code 133
OQCN Query Catagories CategoryId 134
OIND Triangular Deal Code 135
ODMW Data Migration Code 136
OCSTN Workstation ID Code 137
OIDC Indicator Code 138
OGSP Goods Shipment Code 139
OPDF Payment Draft DocEntry 140
OQWZ Query Wizard Code 141
OASG Account Segmentation AbsId 142
OASC Account Segmentation Categories SegmentId, Code 143
OLCT Location Code 144
OTNN 1099 Forms FormCode 145
OCYC Cycle Code 146
OPYM Payment Methods for Payment Wizard PayMethCod 147
OTOB 1099 Opening Balance VendCode, Form1099, Box1099 148
ORIT Dunning Interest Rate Code 149
OBPP BP Priorities PrioCode 150
ODUN Dunning Letters LineNum 151
CUFD User Fields – Description TableID, FieldID 152
OUTB User Tables TableName 153
OCUMI My Menu Items UserSign , Id_ 154
OPYD Payment Run Code 155
OPKL Pick List AbsEntry 156
OPWZ Payment Wizard IdNumber 157
OPEX Payment Results Table AbsEntry 158
OPYB Payment Block AbsEntry 159
OUQR Queries IntrnalKey, Qcategory 160
OCBI Central Bank Ind. Indicator 161
OMRV Inventory Revaluation DocEntry 162
OCPI A/P Correction Invoice DocEntry 163
OCPV A/P Correction Invoice Reversal DocEntry 164
OCSI A/R Correction Invoice DocEntry 165
OCSV A/R Correction Invoice Reversal DocEntry 166
OSCS Service Call Statuses statusID 167
OSCT Service Call Types callTypeID 168
OSCP Service Call Problem Types prblmTypID 169
OCTT Contract Template TmpltName 170
OHEM Employees empID 171
OHTY Employee Types typeID 172
OHST Employee Status statusID 173
OHTR Termination Reason reasonID 174
OHED Education Types edType 175
OINS Customer Equipment Card insID 176
OAGP Agent Name AgentCode 177
OWHT Withholding Tax WTCode 178
ORFL Already Displayed 347, 349 and WTax Reports DocEntry, ReportType, DocType, LineNum, TaxCode, OrdinalNum 179
OVTR Tax Report AbsEntry 180
OBOE Bill of Exchange for Payment BoeKey 181
OBOT Bill Of Exchang Transaction AbsEntry 182
OFRM File Format AbsEntry 183
OPID Period Indicator Indicator 184
ODOR Doubtful Debts AbsEntry 185
OHLD Holiday Table HldCode 186
OCRB BP – Bank Account Country, BankCode, Account, CardCode 187
OSST Service Call Solution Statuses Number 188
OSLT Service Call Solutions SltCode 189
OCTR Service Contracts ContractID 190
OSCL Service Calls callID 191
OSCO Service Call Origins originID 192
OUKD User Key Description TableName, KeyId 193
OQUE Queue queueID 194
OIWZ Inflation Wizard AbsEntry 195
ODUT Dunning Terms TermCode 196
ODWZ Dunning Wizard WizardId 197
OFCT Sales Forecast AbsID 198
OMSN MRP Scenarios AbsEntry 199
OTER Territories territryID 200
OOND Industries IndCode 201
OWOR Production Order DocEntry 202
ODPI A/R Down Payment DocEntry 203
ODPO A/P Down Payment DocEntry 204
OPKG Package Types PkgCode 205
OUDO User-Defined Object Code 206
ODOW Data Ownership – Objects Object, SubObject 207
ODOX Data Ownership – Exceptions QueryId, Object, SubObject 208
209
OHPS Employee Position posID 210
OHTM Employee Teams teamID 211
OORL Relationships OrlCode 212
ORCM Recommendation Data DocEntry 213
OUPT User Autorization Tree AbsId 214
OPDT Predefined Text AbsEntry 215
OBOX Box Definition BoxCode, ReportType, BosCode 216
OCLA Activity Status statusID 217
OCHF 312 ObjName 218
OCSHS User-Defined Values IndexID 219
OACP Periods Category AbsEntry 220
OATC Attachments AbsEntry 221
OGFL Grid Filter FormID, GridID, UserCode 222
OLNG User Language Table Code 223
OMLT Multi-Language Translation TranEntry 224
OAPA3 225
OAPA4 226
OAPA5 227
SDIS Dynamic Interface (Strings) FormId, ItemId, ColumnId, Language 229
OSVR Saved Reconciliations acctCode 230
DSC1 House Bank Accounts AbsEntry 231
RDOC Document DocCode 232
ODGP Document Generation Parameter Sets AbsEntry 233
OMHD #740 AlertCode 234
OACG Account Category AbsId 238
OBCA Bank Charges Allocation Codes Code 239
OCFT Cash Flow Transactions – Rows CFTId 241
OCFW Cash Flow Line Item CFWId 242
OBPL Business Place BPLId 247
OJPE Local Era Calendar Code 250
ODIM Cost Accounting Dimension DimCode 251
OSCD Service Code Table AbsEntry 254
OSGP Service Group for Brazil AbsEntry 255
OMGP Material Group AbsEntry 256
ONCM NCM Code AbsEntry 257
OCFP CFOP for Nota Fiscal ID 258
OTSC CST Code for Nota Fiscal ID 259
OUSG Usage of Nota Fiscal ID 260
OCDP Closing Date Procedure ClsDateNum 261
ONFN Nota Fiscal Numbering ObjectCode, DocSubType 263
ONFT Nota Fiscal Tax Category (Brazil) AbsId 264
OCNT Counties AbsId 265
OTCD Tax Code Determination AbsId 266
ODTY BoE Document Type AbsEntry 267
OPTF BoE Portfolio AbsEntry 268
OIST BoE Instruction AbsEntry 269
OTPS Tax Parameter AbsId 271
OTFC Tax Type Combination AbsId 275
OFML Tax Formula Master Table AbsId 276
OCNA CNAE Code AbsId 278
OTSI Sales Tax Invoice DocEntry 280
OTPI Purchase Tax Invoice DocEntry 281
OCCD Cargo Customs Declaration Numbers CCDNum 283
ORSC Resources ResCode 290
ORSG Resource Properties ResTypCod 291
ORSB ResGrpCod ResGrpCod 292
RecordSet 300
Bridge 305
OITR Internal Reconciliation ReconNum 321
OPOS POS Master Data EquipNo 541
ODRF Stock Transfer Draft DocEntry 1179
OMSG Messaging Service Settings USERID 10000105
OBTN Batch Numbers Master Data AbsEntry 10000044
OSRN Serial Numbers Master Data AbsEntry 10000045
OIVK IVL Vs OINM Keys TransSeq 10000062
OIQR Inventory Posting DocEntry 10000071
OFYM Financial Year Master AbsId 10000073
OSEC Sections AbsId 10000074
OCSN Certificate Series AbsId 10000075
ONOA Nature of Assessee AbsId 10000077
RTYP Document Type List CODE 10000196
OUGP UoM Group UgpEntry 10000197
OUOM UoM Master Data UomEntry 10000199
OBFC Bin Field Configuration AbsEntry 10000203
OBAT Bin Location Attribute AbsEntry 10000204
OBSL Warehouse Sublevel AbsEntry 10000205
OBIN Bin Location AbsEntry 10000206
ODNF DNF Code AbsEntry 140000041
OUGR Authorization Group GroupId 231000000
OEGP E-Mail Group EmlGrpCode 234000004
OGPC Government Payment Code AbsId 243000001
OIQI Inventory Opening Balance DocEntry 310000001
OBTW Batch Attributes in Location AbsEntry 310000008
OLLF Legal List Format AbsEntry 410000005
OHET Object: HR Employee Transfer TransferID 480000001
OTCX Tax Code Determination DocEntry 540000005
OPQT Purchase Quotation DocEntry 540000006
ORCP Recurring Transaction Template AbsEntry 540000040
OCCT Cost Center Type CctCode 540000042
OACR Accrual Type Code 540000048
ONFM Nota Fiscal Model AbsEntry 540000056
OBFI Brazil Fuel Indexer ID 540000067
OBBI Brazil Beverage Indexer ID 540000068
OCPT Cockpit Main Table AbsEntry 1210000000
OWTQ Inventory Transfer Request DocEntry 1250000001
OOAT Blanket Agreement AbsID 1250000025
OKPI Key Performance Indicator Package AbsEntry 1320000000
OTGG Target Group TargetCode 1320000002
OCPN Campaign CpnNo 1320000012
OROC Retorno Operation Codes AbsEntry 1320000028
OPSC Product Source Code Code 1320000039
ODTP Fixed Assets Depreciation Types Code 1470000000
OADT Fixed Assets Account Determination Code 1470000002
ODPA Fixed Asset Depreciation Areas Code 1470000003
ODPP Depreciation Type Pools Code 1470000004
OACS Asset Classes Code 1470000032
OAGS Asset Groups Code 1470000046
ODMC G/L Account Determination Criteria – Inventory DmcId 1470000048
OACQ Capitalization DocEntry 1470000049
OGAR G/L Account Advanced Rules AbsEntry 1470000057
OACD Credit Memo DocEntry 1470000060
OBCD Bar Code Master Data BcdEntry 1470000062
OINC Inventory Counting DocEntry 1470000065
OEDG Discount Groups AbsEntry 1470000077
OCCS Cycle Count Determination WhsCode 1470000092
OPRQ Purchase Request DocEntry 1470000113
OWLS Workflow – Task Details TaskID 1620000000