Saturday 30 December 2023

Using memoization to optimize pure functions in ABAP

I recently needed to drastically improve performance of a recursive method, and memoization was there to save the day. I’d like to demonstrate the technique, in case you’re not familiar with it, using the recursive Fibonacci sequence as a base.

FAQ:

Q: Was the Fibonacci calculation what I needed to improve performance for?

A: No, but the recursive Fibonacci calculation is a great and simple example that lends very well to memoization demonstration.

Q: Aren’t there better performing ways to calculate the Fibonacci sequence than the recursive method?

A: Well, there are other, but I need somthing “slow” to demonstrate the memoization I have included two other options in the end, for good measure…

Friday 29 December 2023

How to get stock on posting date: manually and programmatically

Sometimes for planning purposes we need to get logistics stocks by plant/storage location/material for the specific date. In the blog I will describe some ways to solve the problem depending on version of SAP NetWeaver.

Manual approach via tcode MB5B


Transaction MB5B could help us to read stocks. Tcode could be find via menu path Logistics -> Materials Management -> Inventory Management -> Environment -> Stock -> MB5B – Stock for Posting Date. As we could see from the screenshot below there are also some others useful transactions in the menu path.

Wednesday 27 December 2023

Abap SQL Common Table Expression (CTE)

I this short blog post, I would like share a few useful CTE examples.

Sometimes we require complex sql queries and at that point we have a few options.

  • CDS
  • AMDP
  • CTE

By considering, DRY principle, if we will use it in multiple places, we may prefer to create cds or amdp depending on requirement. But if our requirement is to use it once, than we can use CTE.

Friday 22 December 2023

How to create a custom field with Custom Field and Logic App and transporting field in SAP S/4HANA

In this blog, I will show you how to create custom fields via the “Custom Field and Logic” app in Fiori and transporting fields in SAP S/4HANA.

First, let’s start with Custom fields.

We can do the following using Custom Field and Logic app.

  • Create your own fields(Choose field type and description)
  • Make your fields available in UIs,reports,email templates, form templates,business scenarios and other languages.
  • Delete fields.
  • Edit fields that have already been published
  • Publish fields to your system.

Wednesday 20 December 2023

Hierarchies: How to Assign a Hierarchy to a Dimension and How to Consume a Hierarchy in an Analytical Query

CDS offers the possibility to structure hierarchical data. For instance, if you have employee data and would like to organize this data based on their manager, you can structure the data hierarchically. You are then able to query data of employees under each manager (sales, for instance). The general structure of a CDS hierarchy is depicted below:

Monday 18 December 2023

Using class CL_ABAP_PARALLEL for mass parallel dialog work processes

Using class CL_ABAP_PARALLEL is a convenient way to mass process in parallel dialog work processes. This can be especially powerful in a system with more dialog vs other types of work processes. Due to limited documentation, there was a small learning curve when I first implemented this in an S4/HANA on-premise system on SAP_BASIS version 7.54. I’m writing this blog to help others with their implementation of this class.

Setup overview


In this example there will be two local classes (to make it an easy copy/paste test). The XSTRING data type is used to universally pass different kinds of data between the two classes.

Saturday 16 December 2023

Release News 2308: Enumerations in ABAP CDS

This blog post explains the new ABAP CDS enumerations.

Release info

  • 2308 SAP BTP ABAP Environment
  • ABAP Release 7.58
  • SAP S/4HANA 2023

Creating a CDS enumerated type


In ADT, an enumerated type is created as a repository object of the type Type. 

Friday 15 December 2023

SLT – Replication with Additional Fields and Changing Operation Type

I am sure many of you who use SLT (SAP Landscape Transformation) would have encountered a need to add additional fields to their table structure or to modify existing field types. This could be for various reasons. To process certain data, to add additional parameters for the destination system, support data, etc. This is quite common and can be easily achieved using Table and Rule settings on LTRS transaction. One specific need we had was two fold. First, every record replicated should have its timestamp (of replication) and a flag that indicates what operation was performed (Insert, Update or Delete). Some of you I am sure would have probably worked and solved this same scenario or something similar.

Wednesday 13 December 2023

Effortless Material Creation using Excel Sheets via Fiori App (e.g., SolidWorks’ CAD-Driven Data)

Introduction


Material creation in SAP is simpler using Fiori and Excel, we can tweak data before uploading, even integrating info from CAD software like SolidWorks or any other data source. This connection makes creating new materials in SAP a smoother process. Let’s dive into how this system works seamlessly.

Summary


In this blog, we’re diving into a streamlined material creation process within SAP. We’ll explore the creation of a Fiori app and an OData service designed to seamlessly integrate data from external sources for material creation. For this blog, we will be using data comes from SolidWorks automation.

Saturday 9 December 2023

How to display photo of employees from PA30 to module pool custom container

In this blog post you will learn how to make a basic Module Pool program using custom container to display image of employee from PA30.

Module pool programming is a special type of programming which is used to create custom SAP screens.

We will first upload the image for the employee on the SAP Server using the transaction OAAD. The name of the image we upload is APPLE and is in black and white (the supported formats are .jpg and .png).

Wednesday 6 December 2023

Tips about fetching attachment list from Service Notification

If the requirement is to send the PDF files fetched from the attachment list of service notifications once the service order reaches to specific status, how to get those linked document files based on the service order number will be the key. That is the purpose of this article.

Tips about fetching attachment list from Service Notification

Tuesday 5 December 2023

Alternative option for IMPORT/ EXPORT using Shared Memory SHMA approach.

Motivation:-


In this blog you will learn how to use shared memory as alternative option of ABAP Memory(Import/Export).

Business Scenario:- Many of times we need Import & Export at the time of SAP Enhancement or other requirements so Here use of shared memory which is also alternate option of Import/ Export and as per SAP standard guideline this approach is highly recommended.

Monday 4 December 2023

Fiori Element: Display Rating Indicator’s & Images

We had the requirement to display the rating indicator to determine the Employee’s ratings based on their performance, skills and their availability. Here I am trying to display rating indicator by using product details, also displaying the Images of respected product by forming the URL Via OData.

Let’s begin with example.

Here RAP Model also involved to preview the Application but the agenda is that we have to display the ratings for each product

Saturday 2 December 2023

Functional Programming in ABAP Series: PART I (Introduction)

Background

In computer coding, it’s super important to write really good code. Good code doesn’t just make programs run faster, it also helps developers work better. But figuring out what makes code good can be tricky, and it’s not just about making things run quickly.

Good code has things like being easy to test, easy to keep up, easy to use again, and easy to add more stuff to. These things are like measuring sticks for how tough and reliable the code is. But knowing how to make code like that isn’t always clear, so we look into ways to help us write clean code.