Coding

ABAP Code as Infrastructure

Throughout my 25 years of ABAP development, I have been coding the same paradigm time and time again. The same operational programs in a countless number of variations. Selling professional services around SAP, I developed ABAP code for numerous organizations running SAP: Reports to add Vendors’ confirmation to Purchase Orders, Report to block customers which surpass their creditline, and mass creation of wage type records per several employees. 

The drill is well known:

  1. Form a report based on the needed context (e.g., PO lines report, Customer report, and Employee report) with a corresponding selection screen
  2. Display data in a tabular way using SAP ALV (ABAP List Viewer) 
  3. Add a toolbar-function (‘Button’) that does the mass change (often consist of a call to the relevant BAPI)
  4. Make sure to display a log of the changes made

Indeed, there were some variations to the above-described framework. In some cases the entire thing was supposed to be invoked in the background, in some cases the original report was based on an Excel file, and in some cases the records were color-coded to emphasize a point. 

Trying to minimize the loss of time, I built my own framework and perfected it with time. I used an ALV template, I incorporated an application log functionality into my template, and I coded the toolbar-function in a secluded place- so I could call it both in the foreground and background modes. Still, I could not avoid coding the Toolbar-function time and again. 

While contemplating over the challenge of Toolbar-function reuse, I took part in the development of InsightSAP (formerly, RainbowSAP) by D-Pro Innovation- a software company that develops complementary products for the world of SAP. InsightSAP is a platform (an SAP certified ABAP Add-On) that allows companies running SAP to reuse any report (standard and locally developed), query, DB table, CDS view, or even an Excel file (we refer to them as ‘the Baseline’). InsightSAP presents the baseline in its own context where many things could be added to it:

  • Content – Content in type of new columns (Formula, DB lookup, Text, Input, Comment, and others) could be added. In addition, navigation from one Insight Creation to anywhere else in SAP (e.g., SAP transactions, Reports, other Insights) is supported. This way, any needed information resides at the same screen (data columns) or a click away (navigation)
  • Structuring – Data could be organized in manageable groups and easily accessed (navigation pane). A picture worth a thousand words and thus Graphs could be easily added to make information more comprehensive. Conditional Formatting could also be applied to mark outstanding data points in a distinguishable way. 

We were missing automation, the ability to select a few records and to apply some local logic that will affect SAP entities. 

Surprisingly, the challenge from both worlds coalesced. 

Soon enough, the Toolbar-function was added to InsightSAP. Toolbar functions (AKA, Buttons) encapsulate business operations by exposing a clear interface. This interface, a list of fields, serves as the input for the Toolbar function. That is to say, the set of fields this Toolbar-function needs in order to fulfill the agreed-upon functionality. This way, the button that confirms a PO order-line ‘expects’ to get as input: the PO number, PO item number and the amount and date to confirm. By the same token, the button that blocks customers expects: the customer number along with the date of block. Lastly, the button that adds a wage-type record to Employee data expects for input: The employee number, wage-type, and amount. 

As soon as the interface was defined, an ABAP developer can now code the needed functionality in the Development system. When completed, the code is transported to the Testing system for further tests and when approved could be moved, thereafter, to the Production system. 

When the button was incorporated into an Insight and its interface was mapped onto that Insight’s data columns, it could be taken advantage of. By selecting several records and pressing the Toolbar-function, mass change of SAP entities will be performed. The log yielded from the functionality, will be automatically propagated to the end-user in the form of application log. 

Toolbar function that changes Purchase Orders’ delivery date

The beauty part is that now, different Insights may share the same Toolbar-function. InsightSAP Toolbar-function democratized code and turned it into infrastructure. No more coding the same functionality over and over again- one code serves them all.

Do note that using a service program, any Insight could be invoked in the background. This service program allows auto pressing of any needed Button in the requested insight. Thus, the Toolbar-function mechanism could be operated in the background as well. Needless to say, that the log will be saved in SAP-standard application log (T-code SLG1) for further use.

However, the ability to ‘code once and use many’ was only the first move in this Checkmate in three steps to code waste. 

The 2nd step in turning code into infrastructure was by manifesting any Toolbar-function as a baseline by itself. Namely, now the button itself could be presented as an Insight Creation. As soon as InsightSAP was pointed at a given Toolbar-function, it turned it into a whiteboard for mass & quick change. Each of the Toolbar-function fields is displayed as an input field, allowing business end-users to key in the relevant data in rows and columns. When the filled-records are selected and the button is pressed, the functionality is invoked yielding the desired mass change. 

Whiteboard based on Toolbar-function that changes Purchase Orders’ delivery date

From my experience, this functionality was heavily demanded by the Business everywhere yet, the high cost of implementing it per each given usage, made it impossible up until now.

Look around, the world has changed. Any SaaS application offers its users to mass upload their data using a straight forward protocol. The user is asked to upload an Excel (or sometimes CSV) file with the data. In case the user does not know the requested file structure, she is offered to download a sample file in which the data could be typed or copied. As soon as the filled file is uploaded, pressing the ‘Button’, will perform the functionality. Google offers mass upload of email-users this way, Zoho allows mass upload of Leads this way, and any online booking application enables its users to mass upload customers this way. This is how the modern world operates these days. Hence, why SAP should be any different. 

This brings us to the 3rd step in code reusing. Again, the same Toolbar-function could now be used to upload data from an Excel (or CSV) file. The file should use a header line with the fields (and their order) in the way the Toolbar-function was defined. Yet, one can always press the button ‘Download Sample’, to get the expected file structure. Typing or copying the needed information into that file and pressing the ‘Import’ button, will upload the file content into SAP. Now, using the known drill of selecting the needed records and pressing the Toolbar-function button and voilà- the needed functionality is invoked 

Sample fileFilled-in file
Excel file imported

Hopefully, by now the point that Toolbar functions represent common functionality that could be shared by many processes was well founded. We, now, would like to stress the point that the same (give or take) Toolbar functions could serve different organizations. 

As the stream of customers’ requests for specific Toolbar functions flowing in grew up, patterns started to emerge. It looks as if many organizations need to mass update Purchase Orders’ payment terms. Many organizations need to create invoices out of Excel files and many organizations need to convert Plan orders into Purchase Requisitions. In that case, why should every organization build its own set of Toolbar-functions?

Last but not least, in our quest for code reuse, we introduced the Out-of-the-Box content. A set of ready-made processes and Toolbar functions that could be downloaded by our customers. Indeed, in many cases the delivered Toolbar-function does not fit 100% exactly to the needs of the organization, yet it serves as a great starting point. In addition, the list of provided Toolbar-function (which grows rapidly) gives functional experts many ideas to automate processes they did not think of. 

SAP, a software company that has invented the ERP space, was founded in 1972 with the catchphrase: “the company in the business of helping businesses”. Apart from SAP itself, companies running SAP are not software companies investing in the ERP domain. Moreover, companies running SAP on-boarded SAP in the first place, to be able to concentrate on their core businesses – software projects are not their forte. Thus, companies running SAP should minimize the code developed internally, let alone coding the same functionality over and over again. InsightSAP is a platform that was invented exactly to achieve this goal- Reuse, reuse, reuse. Toolbar-function is yet another major step in that journey.