Thursday 31 December 2020

How to get fuzzy search for multiple columns other than the standard search help.

Introduction:

I am going to explain, how to add new fields in standard search help and make it available as fuzzy search help in dictionary(SE11) level and as well as report level.

Custom fuzzy search help in report level:

Step1:

Go to tcode SE11 and Create a custom table with the following fields, here I want to add a new field PO text to be displayed in the search help so added a field for PO text.

Wednesday 30 December 2020

Safe dating in ABAP

Every so often a developer needs to involve code related to dates in their work. I have come across some “interesting” and “creative” approaches to this which might work under some conditions, but do provide a risk. Let’s talk dates in ABAP. I’ll explain how they work, common mistakes and my suggestion for consistent handling… Please let me know if you have other suggestions!

The Basics

There is a predefined data type DATS which you declare just as you would expect:

DATA lv_date type dats.

To assign it the value of todays date, which always is available in the sy-datum field:

Tuesday 29 December 2020

SAP TM – Auto populate Email Receiver for PPF Action / PPF Output/ PDF Forms

Introduction:

A common functionality in SAP TM can be to send the email with the attachment to a particular receiver or a set of them when an action is executed in Output Management. This can be achieved manually by adding the email id into the Communication Tab and executing the action but checking the email checkbox.

But the requirements can be like, the receiver should be auto-populated based on certain conditions and add into the receiver table in the Output Management tab whenever the action is executed.

Monday 28 December 2020

ABAP Tricks for Functionals | Trick #1 – Edit Table Values in S/4 HANA using SE16 Debug Edit

Introduction –

We come across situations where we need to edit values in standard/custom tables. There could be many reasons why you want to edit values in standard/custom tables, some reasons are listed below.

1. You are performing testing, and want to simulate a test scenario without changing a lot of test data

2. You do not have a table maintenance transaction available to edit table value

3. You have found a data inconsistency and want to change table value to fix it

Sunday 27 December 2020

Calling Stored Procedure from SAP ABAP Application [BW on HANA, BW/4HANA, S/4HANA]

Stored Procedure – Introduction

Stored Procedure are frequently used Objects in SAP HANA. Stored Procedures allows to group the SQL statement into a single block and can return data in the form of output parameters.

In Mixed modelling Scenario calling a Stored Procedure from SAP Application can also be a good approach. Below is one Scenario we have faced in our Project.

Scenario: We had created a S/4HANA Report based on a Transient Provider and when checking for InfoProvider report gives a System Generated Tech name 2H*.

Saturday 26 December 2020

SAP Cloud Platform Launchpad: Integrate apps from the ABAP Environment

In this blog I’ll demonstrate how to configure an integration between the SAP Cloud Platform Launchpad service and a Fiori application deployed in the the ABAP environment. Below is the setup with both the ABAP environment and the Launchpad service sitting in the same subaccount. The steps shown will also work across separate subaccounts.

SAP Cloud Platform, ABAP Environment, SAP ABAP Exam Prep, SAP ABAP Development, SAP ABAP Guides, SAP ABAP Career, ABAP RESTful Programming Model

Wednesday 23 December 2020

SAP TM – Access the Transportation Charge Delegated Node in TOR BO and Update the Delegated Node.

Introduction

Working with BOPF in SAP TM is tricky and many times the developers struggle to find help online.

This blog is just an effort to reduce the burden by providing an easier way to traverse the delegated node for Transportation Charge From the Freight Order Root and how the update the Delegated Node fields.

Hoping that the reader has an idea about basic terms like Business Object, Node, Association etc, I move forward with the explanation.

Monday 21 December 2020

ALV Tree Simple Report (Multiple orders => Single Delivery)

Requirement

We had an interesting requirement to combine multiple orders (belonging to a single ship-to party) into a single delivery note. This can be achieved using standard transaction ‘VL10’ but the custom requirement was to only be able to combine the orders that had a similar payment type. Payment type is a custom field in the Sales Order (in our case VBAK-ZPAYM_TYPE) which can be either Cash, Credit Card, Debit Card or so on.

In this blog post, I’ll show how I used ALV tree for displaying orders belonging to Ship-to in a hierarchical form.

Friday 18 December 2020

Configuring OAuth 2.0 and Creating an ABAP Program That Uses OAuth 2.0 Client API

This blog post will give the basic overview about OAuth2.0 Configuration and use case from SAP ABAP program.

Introduction:

The OAuth 2.0 server (AS ABAP) protects resources you want to use, and the OAuth 2.0 client enables you to access services and resources that are offered by a service provider.

Authentication with OAuth 2.0 protection between an SAP NetWeaver Application Server for ABAP and an external service provider such as, for example, SAP HANA Cloud Platform, Google Cloud Platform, or Microsoft Azure, requires a dedicated OAuth 2.0 client. You can configure and register this OAuth 2.0 client in the OAuth 2.0 server (AS ABAP).

Thursday 17 December 2020

Dynamic Cache for CDS View performance optimization in S/4HANA

Purpose

Performance optimization of analytical app is crucial in S/4HANA as it causes additional system load as well as performance of analytics itself. This is great impact on business users.

This blog is about the CDS View performance optimization with Dynamic Cache in S/4HANA. With the Dynamic Result Cache, as the aggregated cached data is accessed instead of data in the source table, thus the runtime could be optimized. The cached data is updated when the data in the source is updated. Dynamic Cache can be created for a table in S/4HANA.

Wednesday 16 December 2020

CDS View Entity

The purpose of this blog is to show the created CDS view entities including Analytic Query, Extended entity, Annotate Entity in the system.

Test system

◉ S/4HANA On premise 2020 Initial shipment stack

◉ ABAP Platform Initial shipment stack (SAP_BASIS 755/0000 with SAP Kernel 781 patch19).

Tuesday 15 December 2020

Extending SAP Fiori App: My Inbox – Approve Purchase Requisitions (F0401A)

Overview

The intent of this blog post is to provide some initial insight in extending the standard SAP Fiori – My Inbox application. Specifically, this will deal with the SAP Fiori app: My Inbox – Approve Purchase Requisition (F0401A). Take note that this will not go into the details of setting up the SAP Business Workflow that will be using this, but only extending the SAP Fiori app itself. Fortunately, once set-up properly, we only need look at the ABAP Core Data Services (CDS) views to modify the front-end output.

Monday 14 December 2020

Reports with CL_SALV_TABLE

This time we’re going to make a report using the CL_SALV_TABLE class to create a grid with data.

This object is very useful and easy to use that you could make reports preparing first the data and finally exporting it to CL_SALV_TABLE.

It is also possible to it color la cells, rows and columns and it is even possible to make editable cells to enter data.

CL_SALV_TABLE includes toolbar and events where you can make calculations, save date and make a very interactive report.

Friday 11 December 2020

Modern Regular Expressions in ABAP – Part 1 – Introducing PCRE

Regular expressions have been part of the ABAP programming language for quite some time now. From the beginning, more than a decade ago, there has been only one regular expression flavor, defined by POSIX standard 1003.2 and implemented by the Boost Regex library version 1.31.

These regular expressions can be applied in a variety of ways throughout the ABAP language:

◉ using built-in functions like find, replace, count, matches, etc.

◉ using the ABAP statements FIND and REPLACE with the addition REGEX

◉ and, for the most amount of control, using classes CL_ABAP_REGEX and CL_ABAP_MATCHER

Thursday 10 December 2020

Determination In BOPF

Description: The Blog Post is about how to create determination and test it in BOPF framework.

Prerequisite: To know The Steps Of Creating BO Object in BOPF And Also To add Node And Necessary Structures Required For Creating BOBF Application.

Introduction: A determination is an entity of a business object node that is used to provide functions that are automatically executed as soon as a certain trigger condition is fulfilled. A determination is triggered internally on the basis of changes made to the node instance of a business object.

Examples For Determination: Generation Of ID Automatically Via SNRO.

Tuesday 8 December 2020

Automate Master Data Vendor Extension Process to Purchase Organization with Approval Workflow

Introduction

In every Project or Customer you worked for, you will have the scenario where some Master Data will not be extended to Company Code/Purchase organization and in those scenarios you have to send an email to that Team and wait when this will get extended so that you can create your Business Document. In this Blog we are considering a case where a Vendor/Supplier is not extended to a Purchase Organization. We will show how we can create a Simple Workflow for the Approval of this Master Data Extension and it is Auditable as everything is inside SAP. This will help you achieve the following Business Goals

Saturday 5 December 2020

Entity Manipulation Language – EML | RAP Series

What is EML?

Entity Manipulation Language (EML) is a part of the ABAP language. It means that there are new syntaxes available in ABAP to

◉ control the business object’s behavior in the context of ABAP RESTful programming model, using ABAP code user can manipulate Business Object created using ABAP RAP model

◉ provides a type-save read and modifying access to data in transactional development scenarios.

Friday 4 December 2020

QR code in smartforms

Most of the time in SAP the answer for many things come from a lot of sources. The QR code implementation in SAP is an example of it.

But then I realized that even if I use that code I had to deal with the fact that I should be aware that the QR code had to be generated from a Google API. That could be a problem because in my case I needed to use that feature internally, so it was not ok to access the internet to get the image. On the other hand, this site could be at any moment be closed or shutdown.

So, the thing is that I had to make my own webservice to get that image, and having a background of C# I found it logical to make my own webservice. So I began to investigate how to generate the QR and when I got it then I proceeded to code it. There are a lot of open source solutions out there and in my case, I just had to grab one of them and use it. I found a couple and the ZXing.Net implementation seemed to be the best in this case.

Thursday 3 December 2020

How to create a follow up (Subsequent Notification) in PM

Prerequisite:

You have a PM notification under which you want to create a child (subsequent or follow up) notification.

Overview:

I wanted to create a subsequent PM notification under a parent notification and could not found any concrete solution for the same which inspired me to write this blog to help fellow developers who are facing a similar problem.

Friday 27 November 2020

How to find the Views/CDS Views that stores multiple Field values? That’s what ABAPER and Functional does :) in WRICEFF development

Introduction

After working with SAP for more than 15 years and travelling across the Globe for SAP Projects one issue I always use to have how can I keep track of all the SAP Tables/Views associated with different Modules. If you are working as a SAP ABAP Consultant you need to keep the name of tables/views in your Fingertips. Sometimes this you know from other Experts and sometimes you have to dig it out.

After exploring I found a very easy way to know the Tables that contains all the four fields or Data Element in the same Views and has data in it.

Thursday 26 November 2020

How to Send Email from SAP ABAP Query Report ?

Introduction

In SAP most of the time when we create a ABAP Query report we do it to download it to our Local file and then we need to send it to a bunch of Recipient. This Blog will help you in taking some of this Steps reduced by Sending email directly from the ABAP Query Report.

Solution

First we go to Transaction Code SQVI.

Select your ABAP Query.

Wednesday 25 November 2020

Classes in ABAP

Classes are fundamental structures that we need to understand and master to model entities.

A class can represent anything; a document, a vehicle, animal, or anything that has traits and behaviours.

Classes in ABAP are coded in two steps: first of all, you code the definition part and then the implementation part.

The definition part is the place where you define all the data and methods that are going to be used in the class.

Monday 23 November 2020

Consume ABAP RESTful Application Programming Model (RAP) Service in SAP UI5 Application

In this blog will see how to consume RAPM (ABAP RESTful Application Programming Model) service in SAP UI5 App through SAP Business Application Studio (BAS).

Step 1: Required SAP Cloud Platform Trial account. Refer below link to create.

https://developers.sap.com/tutorials/hcp-create-trial-account.html

Step 2: Considering we have ABAP RESTful Application Programming Model (RAP) service developed in SAP Cloud Platform ABAP Environment. To create one you can follow OpenSAP course Building Apps with the ABAP RESTful Application Programming Model

Friday 20 November 2020

Discover approval level in MM Flexible Workflow agent determination BAdI

Introduction 

Recently I had an opportunity to work on SAP Flexible Workflow for Purchase Order approvals.

Flexible Workflow is a Fiori integrated solution for creation of document approval processes. Its main strength, ease of use, comes from little or zero need for programming interference. Basic scenarios can be created using configuration only. If you have a more complex situation, you can use one of the available BAdIs – for example the MMPUR_WORKFLOW_AGENTS_V2 BAdI, which allows for customer specific approval step agent determination logic.

Wednesday 18 November 2020

Debugger-Script to generate Value-Statements for arbitrary Structures/Tables (Idea and Snipptes)

As I am forcing myself to write more Unit-Tests for my development classes, I was struggling a bit to set up the test-scenarios since the needed value statements may become big and boring to type in.

I know in ADT is a tool included in the SQL-Console to translate the select-output to a file including the value statements, but still, it took me some effort because not any table can be constructed via sql select (or the type of the target structure/table does not correspond to the db-table type…).

Friday 13 November 2020

Separate data classes in unit tests

I proposed using an abstract class for the parts of a unit test that do not differ among the various test cases. I also suggested creating a separate class for each test case.

Based on this approach, I now want to describe a technique for separating the test data creation from the test data usage in test doubles.

Note that this approach is especially useful for classes where you put to the test a public method and cover the other methods by the calls of the public one. Classes that respect the single responsibility principle often are made like this.

Thursday 12 November 2020

Custom E-tag for optimistic lock in SAP Gateway Odata for Deep Update

This blog is about the locking concept in SAP Gateway odata for update deep method. As there are already many blogs on optimistic and pessimistic locking mechanism. And in Gateway Odata there are different ways to implement optimistic lock for concurrency control. below are the ways which I am trying to categorizing 

1.) Using Timestamp for E-tag

2.) Using Hash for E-tag

Wednesday 11 November 2020

How to set the delimit button for custom table and ways to use this functionality

Introduction:

This Blog is about to set the delimit button for custom table. Before doing that I will explain about the delimit functionality and when we will use this concept.

We generally use this concept in any module as per their business requirements in SAP. If they want to see/track the business data into single custom table. Then we will enable the delimit button of particular custom table.

Monday 9 November 2020

G/W Service for Inbound Delivery Creation(VL31N) in SAP S/4 HANA

Introduction :

When a purchase order is created in the system, and if there is a need of Inbound Delivery Creation, we use to go to VL31N to create it Manually, but when it comes to a Technical scenario, it would require a BAPI to get that Created. But there is no specific/Direct BAPI for this requirement, we need to use Standard BAPI GN_DELIVERY_CREATE to proceed. Here in this Blog post i created an OData service for the same.

Friday 6 November 2020

Changing Work-item Initiator in a Workflow.

Introduction:

Usually, for a workflow with multiple steps in Approval process, the Work item initiator is the user who processed the previous step/ created the current step and sometimes, technically it is shown as “WF-BATCH” which is technical workflow system user.

I came across this situation where my client wants to see the User who triggered/initiated the workflow in his FIORI MY-INBOX, instead of the user who created the current step ( i.e, who processed previous step/ Work-Item initiator ) which in my case was being shown as “WF-BATCH”.

Thursday 5 November 2020

Substitution/Delegation app- Using and extending the standard My Inbox app

Recently, I have came across a scenario where one of the standard FIORI application- ‘My Inbox’ was implemented but the default landing page was different than the default page of My Inbox. Also, there was no semantic object mentioned in its tile to locate the standard application. The requirement was to add some custom code in that tile but I didn’t find any link as to where I can add the code as I was not aware of the corresponding application.

After reading some articles on internet, I was able to map the tile using the Roles assigned to my user but sometimes, developer has no Authorization to access the Roles.

Wednesday 4 November 2020

MB5L Transaction CDS View Equivalent

It is a common requirement to build custom reports base on MB5L transaction data (List of Stock Values: Balances). There is no CDS view equivalent to get this data. SAP offers  C_StockQuantityCurrentValue (Current Stock Quantity and Value) CDS view, but it is lacking Company Code and Account details. In my blog I explain how to add missing details to SAP standard CDS view.

Monday 2 November 2020

Transactional Fiori App using ABAP Restful Programming Model

UI Apps development is getting simplified with the evolution of ABAP. In my experience when UI5 was released i had to learn JavaScript ,jQuery concepts and use them to create even a simple UI App ,and then with the advent of  ABAP Programming model for Fiori it changed the approach, since using BOPF with annotations we can easily create  simple Transactional UI app’s with minimal frontend code. Now with ABAP RAP programming which is an evolution of latter, it further simplified and made flexible for UI App development.

Friday 30 October 2020

Display QR Code for GST INDIA E-Invoicing on Script and Smartform

This blog post has been drafted together with my colleague Rabindra Prasad regarding QR code display for GST INDIA E-Invoicing on Script and Smart Forms as many developers are facing problems to display proper QR code.

Please follow below steps to display it as expected.

In most of the cases, existing form will be altered to accommodate the QR code and other IRN details. This blog post is to fulfil the above requirement.

Wednesday 28 October 2020

Mass-activating multiple objects (in background)

1. Introduction

This blog post shows how to mass-activate multiple objects (in the background) and where to find the logs for the activation.

Since SAP decided to discontinue the IS-Media solution, we often have the requirement to add custom fields to MARA or similar tables in the S/4 HANA migration project I currently work on. Unfortunately, the current extension concept does not meet all our requirements and we get the change requests to add new fields or change existing fields only little by little, which means that we have to repeat this step every few weeks.

Tuesday 27 October 2020

Consuming REST APIs with (Cloud) ABAP

API stands for Application Programming Interface, and comprises a set of standards that allow two applications to talk to each other. REST APIs are a certain pattern of building APIs. They are based on the HTTP protocol, sending and receiving JSON or XML data through URIs (uniform resource identifier). JSON-based REST APIs are prevalent. We will also be using such one in this tutorial.

OData, which is very popular in the SAP world, is itself a REST API. There is a lot of information out there on how to provide a REST API from ABAP (i.e., to publish an OData service). But there isn’t much on how to consume an external API in ABAP. And from what little there is, it includes non-whitelisted ABAP APIs, i.e., they cannot be used with Cloud ABAP. So, I decided to write this tutorial on consuming REST APIs using Cloud ABAP.

Monday 26 October 2020

CI/CD Tools for SAP Cloud Platform ABAP Environment

In the on-premise ABAP world, lifecycle and quality processes can be controlled by the ABAP systems themselves. Think of transport routes and jobs to execute different checks. In the SAP Cloud Platform ABAP Environment aka Steampunk, this is no longer possible. Steampunk systems are independent of each other, and source code is “transported” with git-based solutions: gCTS and abapGit. While different systems in one global account are connected to the same repositories (read: “software components”), they do not know of each other. Due to this, the driver of lifecycle and quality processes needs to shift from the ABAP system itself to an external driver – for example: a classic Continuous Integration / Continuous Delivery (CI/CD) server like Jenkins. Of course, the Steampunk systems need to expose the functionality via APIs so that a CI/CD server can control those processes.

Sunday 25 October 2020

$Skiptoken System Query Option In SAP ODATA

In this blog we will learn how to use query option $skiptoken in gateway OData service.

To achieve server-side paging we will use $skiptoken.

Paging

It is the process of restricting the number of entries sent to the application. This also helps to increase the performance if a huge number of entries requested. This is of two types Server-side paging and Client-side paging.

Friday 23 October 2020

Easy Handling of Complex Selection Screen

Introduction

Most of us have faced this problem when designing a selection screen with a lot of fields. For example consider the scenario where you have to design selection screen for an ABAP Report which includes multiple Radio Buttons and accordingly the selection criteria i.e., select option or parameter should be made visible and hidden and also some radio can have authority object attached to it.

So in this blog post you will learn how you can reduce the complexity of Selection Screen Field visiblility inside the statement LOOP AT SCREEN.

Monday 19 October 2020

ABAP Exception Class ZCX_RETURN2 – Raise code templates

This blog post contains code templates for adding ZCX_RETURN2 exception raising code.

Template overview

◉ CREATE_BY_SYSTEM_MESSAGE (without MESSAGE statement)

◉ CREATE_BY_SYSTEM_MESSAGE (with MESSAGE statement for custom message)

◉ CREATE_BY_BAPIRETURN_STRUC

◉ CREATE_BY_BAPIRETURN_TABLE

◉ CREATE_BY_BAPIRET1_TABLE

◉ CREATE_BY_BAPIRET2_STRUC

◉ CREATE_BY_BAPIRET2_TABLE

◉ CREATE_BY_BDC_MESSAGE_TABLE

◉ CREATE_BY_EXCEPTION_OBJECT – catch for example CX_ROOT

Friday 16 October 2020

Feature switch framework proposal explained

In this blog I’ll try to explain my initial thoughts and are hoping for your feedback.

So briefly the intention is to build a feature switch framework that would enable an organisation to quickly turn off new code changes that has been brought in via transports if proven buggy. This buys the organisation time to provide a proper fix. I can vouch for this where i’m at currently as there is a very lengthy governance process.

The other part of it would be to enable new development to be rolled out gradually instead of always a big bang release when the code hits production. This enables you to run beta program and early releases to get the feedback from your end users earlier than otherwise as they can get their hands dirty.

Wednesday 14 October 2020

Custom MetaNet creation using Function Modules – HRFORMS_METADATA

Initial Situation:

Initially our client was using the pay slips designed in Sap Script to display the results in the off-cycle workbench of payroll. However a new requirement was raised, where the client wanted to replace the Sap Script pay slip format (that looks like an sap script) with PDF forms. After much research, I have suggested the solution to be implemented with the use of HRFORMS which allows us to implement the solution by providing an interface that provides the payroll data to design the forms using Adobe forms or Smartforms platforms.

Monday 12 October 2020

Explained : Measuring Code

Premise:

Measuring system for real world objects and code is different. Virtual system measuring metrices evolved over the years. But are they fit for today’s world?

Code measuring systems and metrices rely on quality and syntax of written code.

Friday 9 October 2020

Controlled usage : Not released Functions

Premise:

Usage of standard functions in custom code is not something new, and in my experience standard functions are one of most used artefacts in customer code.

When using standard functions release status is one of the most important topics that come up quite frequently.

At the end of this blog you should be able to identify whether a standard function is ok to use in customer code or not. Also, what can be the implications / risks introduced by using such an object.

Wednesday 7 October 2020

A tale of code

Take a look at this:

Mr. Enfield returned: "But I happen to have noticed his address; 

                      he lives in some square or other".

"And you never asked about the—place with the door?" 

Mr. Enfield's reply was:  "No, sir; 

Tuesday 6 October 2020

How can we create Code Templates in ABAP Editor SE38/SE80? The Google Way

Introduction

If you are an ABAPer you must be using the TAB key in your keyboard a lot to Auto Fill Keyword Commands. Last year Google have taken this TAB Key concept in writing emails which is awesome. This Blog will help in saving Code Templates that you can use in any ABAP Program.

Monday 5 October 2020

Showing an avatar with Initials or Image on the Fiori Element Object Page for a better user experience using RAP

I always felt like something is missing in all the FE Object Page apps when there is no avatar displayed in the header. I mean, just check the below image, and see how beautiful it looks with the avatar control on the object page.

Saturday 3 October 2020

Introduction to SAP BRF+/BRFplus & why is it so popular in SAP World !!

Introduction:

◉ BRF+ stands for Business Rule Framework Plus which provides a comprehensive application programming interface and user interface for defining business rules

◉ It enables you to define business rules without the need of wiring ABAP code.

◉ The generated Business Rules can be incorporated into other SAP programs or Substitution/Validation rules.

Friday 2 October 2020

** TEAM FPM ** Get in Touch with the New FPM Mobile Enabler!

How to easily adapt your FPM applications for mobile devices.

Ever wondered how to transfer your existing FPM applications to a mobile environment? Have a look at the example below for a quick look at how to do just that using the new FPM Mobile Enabler.

I’m using an FPM test application that uses a Search GUIBB and a List ATS GUIBB to display hardware products. The list contains quite an extensive number of columns. Underneath the list a Chart GUIBB shows the products by supplier.

Wednesday 30 September 2020

Pessimistic Lock in SAP Netweaver Gateway OData without using soft state

We are building our own App for SAP S4HANA 1909. The frontend is built in a Microsoft based tool. We integrated the App to S4HANA using OData protocol.

One of the requirement is to lock the object, once the user clicks on edit in the App. So that nobody else can edit, either from the app, or in SAP GUI.

Talking about lock in SAP NetWeaver Gateway-OData(on-premise), till date I could not find any solution which will behave similar way as in SAP GUI because of rest property(as rest is stateless) so cant store the state there.

Monday 28 September 2020

Standalone editing of ABAP in vscode

With ABAP code versioned in git, it is possible to clone ABAP projects as files to the local PC. And like other files, these can be edited with your favorite editor.

To help the developer, I’ve been working on a standalone setup for editing ABAP files based on LSP and vscode.

Below shows some of the features currently implemented,

Friday 25 September 2020

Printing QR Code and Digital Signature in Adobe Forms

Introduction

In this blog post, we will see how we can get QR code and Digital signature on Adobe Form without using Job profiles. We will basically convert the QR code into the image (BMP) and then Digitally sign the form via ADS Server.

Before implementing the solution please check if you have SAP note 2790500 implemented in your system so that we can use class CL_RSTX_BARCODE_RENDERER. Go to SE24 and check if you have the above class in your system. If not then implement the given note for the same.

Wednesday 23 September 2020

IDoc modification made easy with ABAP Object Oriented Programming

Introduction

Throughout all my years with ABAP development, modifying IDocs in an easy to understand, elegant way has always been a struggle. First, the issue of making changes to the segments, second, the issue of correct sequence of the IDoc’s segments.

In this blog post, I will show how to easily perform the create, read, update and delete (CRUD) operations on IDoc segments, thanks to the use of ABAP Object Oriented Programming.

Monday 21 September 2020

SAP Analytics Cloud live data connection to SAP Cloud Platform

Introduction:

This blog covers:

◉ Enable HANA service in SAP Cloud Platform(Neo)

◉ Creation of HANA database in Cloud Platform Cockpit

◉ Access the HANA DB

◉ Creation of live connection in SAC for Cloud Platform

◉ Creation of model and simple story in SAC

Friday 18 September 2020

Combine Select-option, CDS Table function and Call AMDP methods in Program

When we use openSQL, filtering data from parameters and select-option is too easy. With AMDP or CDS, we can only filter data with parameters. Some case, we want to filter both

select-option and parameters, So how can do it?

Additionally, AMDP is only a method, so if we have more AMDP methods, how can we call another AMDP inside the AMDP method?

Wednesday 16 September 2020

Unexpected behaviour of the RFC call

In this post I would like to describe interesting behavior of the RFC functional call in ABAP, and especially the program flow on the target side.

Let’s start from the coding, you can find below small synthetic example which is easier to understand than real cases. So please do not focus on the deep sense of it, rather pay attention to the coding itself.

Monday 14 September 2020

How Print-relevant purchasing document changes trigger printout

After Purchase Order been created at the system, the relevant users should get notice email if any important fields been changed like net price, delivery address, items, etc. SAP System already provides an excellent solution with transaction OMFS, where you can maintain a combination of table name and table fields along with control flags to control whether PO printout should be triggered or not.

SAP ABAP Certification, SAP ABAP Learning, SAP ABAP Exam Prep, SAP ABAP Guides

Saturday 12 September 2020

GOS Excel Attachment into Internal Table

Introduction


We have seen how image or PDF file can be retrieved from GOS attachment. But we have challenges when we try to get the data from Excel file of GOS attachment. Herein , we have a scenario where third Party vendor is sending consolidated PO Invoice with Excel File in GOS Attachments. The corresponding excel file contains the invoice line item details like PO Number, Item Number, Amount, Tax Code, Condition type etc. We can check below how we can read the line item data from GOS excel attachment and update the corresponding line item to be passed into Internal Table for further processing.

Friday 11 September 2020

GTT – another ways to replace FAE

With the ECC system in the past, when handling logic to filter the table together, we usually used For all entries – FAE. But, when we use it, we could not be able to utilize power in open SQL (ex Built-in function, order by). Known this disadvantage in the system, SAP has developed alternative solutions (CTE, View, …), one of the solutions which are a Global Temporary Tables, also known as GTT. So what it is, let’s stay tuned!!!

Thursday 10 September 2020

Easy way to create custom country-specific replication classes in the PTP framework

Introduction


When you try to replicate a person from EC to ECPY, then you may face a lot of difficulties like dealing with Pay Frequencies, storing information in a new subtype of an infotype, manipulating the employee data after the parsing of the XML.

SAP has provided country-specific standard replication classes & BADIs infotype wise, for that purpose. But, they are having less flexibility.

Wednesday 9 September 2020

ALV Grid With Multiple Header Lines

Sometimes the column description of an ALV grid is not sufficient and one would like to have multiple lines as column header. With this trick it is possible to realize such a behaviour.

Demonstration


This is how it looks like deomnstrated with the countries table T005T:

Monday 7 September 2020

How to Test BAPI Function Module in SAP?

Introduction


As a SAP Consultant at some point of your career you will use BAPI. There is special way to test a BAPI whether it is really useful for you to call in your Program.

Solution


In our example we will be using BAPI_PO_CHANGE to change some fields in PO Line Item.

Friday 4 September 2020

Easy Way to get the SAP TR/Task(Request/Task) details

Introduction


We generally use the Tcodes: SE01, SE09, SE10 for getting the transport details. The program called for all these Tcodes is RDDM0001. But, extracting the output in an excel sheet & doing some operations on them can be a difficult task sometimes.

Solution


First of all, please change the below-mentioned settings of the SE16(Data Browser) of SAP GUI.

Please follow the below steps:

Wednesday 2 September 2020

Designing for ABAP OOP and coding against interfaces with text-based diagraming tool.

Introduction.


As ABAP developer creating custom code (less than 10KLOC) for various user stories, when I started with object-oriented programming (OOP) in SAP, I had to start to solve below design problems:

1. what the design should contain,
2. how much design I will do up front,
3. how I will display it in graphical way (I prefer graphical way to see to design of my software solution) to see bigger picture,
4. what diagramming tool I will use,
5. what kind of diagram I will use,
6. how I will backup versions of the design,
7. how to create the diagram so that I would reuse it in coding,
8. how to ensure that other developers could update the diagram without a software with some proprietary license (so I was searching for open source software)

Friday 28 August 2020

Message Classes – SAP Cloud Platform

Definition: Message classes are created within an ABAP project at the ABAP package level. They are used to group messages within a development object. So, you can combine related messages and reuse them in other programs. After creating a message class, you add the individual messages.

Message: Messages notify a user about unexpected behaviour, an error, a status, or a result of an action. An application will display the message at runtime. A message is specified by a unique 3-digit message number, a single-digit language key, text information, and a message class.

Wednesday 26 August 2020

How to Display Workflow Log or Start Workflow in Custom Report in SAP in one click?

Introduction


After working with SAP for more than 15 years and travelling across the Globe for SAP Projects one requirement I always use to get is Build me a Report that will show all the Workflow Related information and also show me the Workflow Log. This blog will make your life easier as well as the Customers as they will have to click Less. This blog will save you at least 3 clicks per document which is equivalent to 3 less chances of making Mistakes.

Tuesday 25 August 2020

First Program with AMDP method

Previously, when programming ABAP, we were very familiar with using the syntax of Open SQL to get data and display it to ALV or smart forms. Technology evolved and SAP also evolved and launched new technicals like as CDS view or AMDP as other optimal solutions to solve performance issues of fetching data from the database, and also to take advantage of the power of new technology (HANA database).

Friday 21 August 2020

SAP S/4HANA Reconciliation with SAP Data Services (E2E)

In this blog post I’d like to share the insights of a customer project where we added data reconciliation after the SAP S/4HANA Migration activities.

The blog post explains the following:

◉ SAP S/4HANA Migration related data objects and how to do manual recon
◉ Architecture for End-2-End (E2E) automated reconciliation using

Wednesday 19 August 2020

Batch Call Processing in SAP NetWeaver Gateway

Introduction:


There can be a scenario where multiple operations need to be performed in one call. To do so, we all know what to use that is ‘Batch Call Processing’. $Batch collects all fixed number of operations (retrieve, create, update, delete) of an OData service in one single HTTP post request.

Recently, I came across the same scenario, & I did some research on the workflow of batch call in SAP NetWeaver gateway and thought of sharing the same with all of you folks!!

Monday 17 August 2020

In SAP S/4HANA You can create Change History Report in less than 15 minutes. I mean any Change History Documents

Introduction


One of the greatest Success story of SAP is the Audit Trace it has using SAP Standard Change History Object. It is used anywhere everywhere for the following

Friday 14 August 2020

How to know every Important Transaction Code for Procurement in SAP ECC and SAP S/4HANA?

Introduction


In SAP everything is a Transaction Code. The more you know them the more Feathers you can add in your Quiver. This Blog covers every important Transaction codes you can drill to related to SAP Procurement.

Wednesday 12 August 2020

How the Credit Horizon affects the Credit Exposure at FSCM

I search the credit horizon in FSCM and get lots of great explanations, but still not very clear how it calculates the credit horizon periods from a technical point of view. For example which date system used exactly for the Started date of credit horizon when processing credit check/exposure with open order/delivery.

Monday 10 August 2020

How to Stop your SAP Debugger on Update of Standard Table or Selection of Tables with Wildcard also in any Transaction Code?

Introduction


SAP Debugging is a skill that is very important for A Technical Consultant as well as Functional Consultant. SAP Debugging can be compared to the Pressure Monitor, Glucose Monitor Device etc used to check up our Body. For any WRICEFF Development a SAP Consultant does, they use Debugging to find the following

Friday 7 August 2020

Logic of default attribute at Dispute Case creation screen

Users can create a dispute case in the FI document display mode like FB03 or FBL5N by including the document displayed in the dispute case and assign the dispute case to a processor. Dispute case attributes like Processor and Responsible person will be populated automatically at the creation screen, it’s SAP standard.

In this article, I will show the key function module been used to fetch those dispute attributes to better understanding the FSCM mechanism and answer user query or enhancement preparation.

Wednesday 5 August 2020

Automatic Partner Determination for Quality notification

In this blog we will see how to determine the partner automatically for Quality notification. This technique can be used for PM/CS notification as well.

Step 1 – Create a Rule 


Go to PFAC transaction and give some number/name to the rule

Sunday 2 August 2020

SAP-BW Transformation Routine References Finder Tool

Introduction:


While checking the ‘Where-used List’ of any Info-Objects in SAP-BW, the result shows the relevant Infocubes, DSOs, Queries, Transformations, etc. where the Info-Object is used. However, it doesn’t show the Transformation routines/codes (Start Routine/End Routine/Field Routine/Expert Routine) where the Info-Object tables are referred to. For example, the 0MATERIAL master data table /BI0/PMATERIAL might be called in a Start Routine code (Example Code: SELECT * FROM /BI0/PMATERIAL) under a Transformation. While clicking on the ‘where used list’ of 0MATERIAL, it doesn’t show the Code Line where this table has been referred in a Transformation. This table might be used in many routine codes under multiple Transformations. In order to find the Transformation routines in which the tables/Infoproviders are referred to, I have developed the tool called as ‘SAP-BW Transformation Routine References Tool’.

Wednesday 29 July 2020

Turbocharging SAP Queries & Standard ABAP Reports

Introduction


Many SAP queries and ABAP reports do not perform well when retrieving large volume of data from traditional databases using complex SELECT – JOIN SQL statements often on 10 or more tables containing millions of records.

If these ABAP reports are standard SAP programs or ABAP programs generated by SAP in applications like, e.g., SAP SQ01 Query, they should not be modified by programmers. However, using them is frustrating because of poor performance and timeouts they cause for broad selection screen criteria.

Friday 24 July 2020

How-to load a CSV file into SAP BW/4HANA using the Planning function type 0RSPL_FILE_UPLOAD_AO

Introduction


The requirement to upload a CSV file into a SAP BW system is something a lot of people have come a across every once and a while. There the well-known solution by Marc Bernard  is provided. In SAP Note 2053696 it is now stated that this How-to Paper is obsolete and should not be used anymore. Therefore, the new Planning Function type File Upload from AO, 0RSPL_FILE_UPLOAD_AO was introduced.

Wednesday 22 July 2020

How to Add Payment Amount Field in FBL1N Transaction Code and how to Display the Technical Field name in Layout for better Search Capability?

All of my Friends who deals with SAP Vendor Payments and Outstanding Payment FBL1N transaction code is a must. It would be great if you can get to know the Payment amount also in the Layout and now if you can get this without any coding it would be a great win. This blog will cover

1. Add Payment Amount in FBL1N layout to be Displayed with Value.

2. How to get to know the Technical Field name in FBL1N, FBL3N FBL5N and FAGLL03.

This blog can also be used for bath SAP ECC and SAP S/4 HANA also.

Monday 20 July 2020

Update Variant Characteristic Values Using FM

Introduction:


Updating VC characteristic values is some what tricky in this case BAPI_OBJCL_CHANGE  BAPI will not support .In this blog i will explain how to update VC characterist values Using Function Modules step by step.

Below Function Modules used to Update the Variant Characteristic Values.

Friday 17 July 2020

Table Function – SAP Cloud Platform

It is a type of CDS which allow developers to write database procedures They support the HANA platform code pushdown capabilities in ABAP CDS.

For creating a table function two components are required

◉ CDS entity of the table function
◉ CDS table function implementation

Wednesday 15 July 2020

Customized fields at Case management of FSCM

It’s very common to add customized fields to more closely align with your own business needs. In this article, you will find the method to add customized fields for Documented Credit Decision (DCD) as well as enable it at the SCASE search screen.

Monday 13 July 2020

Start writing a Unit Test

I will give an example how to start with ABAP unit test. I start with a simple migration ABAP migration report. The report reads and change data on the database. So the unit test has to cope with external dependency. Code without external dependency is rare in real life. So I show how I write unit tests when external dependencies are an issue. This is in at least 95% of all code I write the case.

I will sometime deviate from common conventions. I do this because I show how I code in my daily work.

Saturday 11 July 2020

Native SQL in S4, replace EXEC SQL statement with this method

Today we are going to discuss about executing Native SQL statements from Report program , there are many instances which I come across during my ABAP journey where we dont get access to development in Hana studio/Hana DB access . So, for executing the Native SQL statements from our report program first we establish connection via EXEC SQL statement.

Friday 10 July 2020

RAP( Restful ABAP programming) for OnPrem S4HANA

The purpose of this document is to show the capabilities of RAP with on Premise setup and see how exactly this is different than BOPF.

Basically there are 3 implementation scenarios possible for RAP

◉ Managed ( Green field development )

1. Managed Scenarios are more like BOPF where you define what tables will be updated at end of the process.
2. We have options for implementing actions, determination and validations
3. Only available on S4HANA cloud

Wednesday 8 July 2020

Cheaper Unit Tests with less Mock Logic

Automated tests have become an important part in my professional life as a software developer. However, you cannot always avoid external dependencies of individual methods you want to test. The more dependencies you have, the more cumbersome testing gets.

Different Approaches to automated testing


The standard advice is to mock any logic that is called by the code under test.

Monday 6 July 2020

Custom Entities – SAP Cloud Platform

Custom entities are data definitions, which does not have a select statement on data source but we define return fields and their types. In case of custom entities their data model is invoked manually at runtime. The logic is defined in a class, we could not only retrieve data using custom entities but also do some other useful and awesome stuff with these good little tools.

Friday 3 July 2020

SAP ABAP Programming Model for FIORI- List Report Application (Part 3)

This is third and final blog of this series. If you directly landed here I will suggest you to refer the first two blogs before starting with this.

SAP ABAP Programming Model for FIORI- List Report Application (Part 1)

SAP ABAP Programming Model for FIORI- List Report Application (Part 2)

So now we are at final step and I know you all are excited to see the Final Fiori App so let’s quickly start with it.

Wednesday 1 July 2020

Practical use of BRF+ Application to design the Rules in SAP

What is BRF+ and the importance in S/4HANA?


BRF+ is an ABAP based framework and part of the NetWeaver stack. BRF+ stands for Business Rule Framework Plus and it provides a comprehensive application programming interface and user interface for defining business rules. It enables you to define business rules without the need of wiring ABAP code. The generated Business Rules can be incorporated into other SAP programs or Substitution/Validation rules.

Monday 29 June 2020

SAP ABAP Programming Model for FIORI- List Report Application (Part 2)

This is the second blog in this series. You can refer to the first blog in the below link:

SAP ABAP Programming Model for FIORI- List Report Application (Part 1)

In this blog we will be looking into BOPF part to enable the Determination, Validation and Action in our Fiori List report Application:

Let’s proceed with this tutorial. In last blog we have created a Transaction CDS on SPFLI Table.

Friday 26 June 2020

SAP ABAP Programming Model for FIORI- List Report Application (Part 1)

I am writing this blog after a long time. The Idea to write this blog is because the challenges I face with getting all the required details at one place while creating a List Report Application based on Fiori Elements.

When I was developing a List Report Application I have to refer lot many blogs and tutorial, that’s why I thought to sum them all at one place so that it can save time for others

Wednesday 24 June 2020

The ABAP Data Dictionary

Here is a guide to using tables, we use this within our internal courses, I haven’t run one for some time with the lockdown in the UK, but I share it here for the benefit of others in this wider SAP community.

Tables can be defined independent of the database in ABAP Dictionary. When a table is activated in ABAP Dictionary, a similar copy of its fields is created in the database as well. The tables defined in ABAP Dictionary are then translated automatically into the format that is compatible with the database, because the definition of the table depends on the database used by the SAP system.

Monday 22 June 2020

Dynamic Report to check config Data with respective Texts

Introduction: The requirement was to capture the change logs of configuration data along with the respective descriptions (mostly from text tables), which is currently un-available in SAP directly using standards functionalities. This blog will explain the procedure to get the respective data.

Main Part: This blog can be used as reference for several topics like creating dynamic select query, dynamic table creations, dynamic read statements.

Saturday 20 June 2020

How to setup WebIDE Project for OData service generated using Restful ABAP Programming Model

In this blog I will show the how easily we can set up the WebIDE to create a Fiori project which will utilize the OData service created in backend using Restful ABAP Programming Model.

Steps to be followed are –

1. Generate a Service binding based on Service Definition. Activated service binding will look like below in ABAP Development Toolkit  –

Friday 19 June 2020

S4 HANA – Debugging Validation Rules (GGB0) in F110 – Automatic Payment Program

Introduction:


Validation Rule is a tool where finance consultants can implement control checks at the time of Document Posting / Save as Complete to generate messages (Error/Information/Warning) with out the help of ABAP. They also use the trace function to check whether the validation rules are working as required.

Wednesday 17 June 2020

Automation of Functional Checkouts

BUSINESS SCENARIO:


Whenever we have an important event in the system (like an upgrade or a big deployment), we need to perform a list of necessary checks to ensure that system is fine and everything works as expected.

BACKGROUND INFORMATION:


Earlier these system checkouts were done manually, but now we have created an SAP ABAP Module pool program that will automatically check and provide status report on how the system is. With this program we can check different aspects of the system with minimal time and effort. Also, in case of issues, we will be able to identify and correct them quickly.

Monday 15 June 2020

Installing and configuring Eclipse for ABAP Development Tool

Introduction


When I searched, I did not find a detailed blog describing the installation of Eclipse for ABAP Development Tool(ADT). I was successful in installing the Eclipse for ADT, even though I did not know the ABCs of system ‘path variables’ or JavaRuntime(JRE). So, I am writing this blog for all the people who are in the same boat.

Wednesday 10 June 2020

S/4 Purchase Order Flexible Workflow: Agent Determination by BADI

As you know, in S/4 we have the Flexible Workflows scenarios. In some business cases, the standard agent determinations is not enough to meet the company’s needs, so we need to add custom code to make it 100%. On the Agent determination side, we have BADIs to accomplish that. Here, i’m gonna show how to use the Agent Determination BADI on the Purchase Order approval Flexible Scenario.

Monday 8 June 2020

SCP Mobile Services: MDK Offline CRUD App

“Mobile development kit (MDK) enables developers and technical business users to build native mobile applications in a highly productive environment. The tool provides a cross platform native experience so users build the app once and deploy to iOS and Android devices.”

There are already some great tutorials on MDK, like this one, but i wanted to do a “FullStack” version, coding all the way from the ABAP backend to the App itself. So basically my Goal here is for you to create your first full CRUD MDK App (Offline).

Friday 5 June 2020

Adding features to FIORI Element List Report using CDS views and annotations

In this blog, I will provide CDS annotation details, some tips and tricks along with examples to demonstrate how we can add features to a basic FIORI elements List report without having to change much in the UI code. This is especially helpful to backend /ABAP developers as these features can be implemented only using CDS views.

After you have created a basic list report application, you can add the following features using CDS,

Wednesday 3 June 2020

3W’s of credit management, High level comparison of FSCM with ECC Credit Managment and baseline S/4 CM configuration

In this blog we will try to give a layman’s viewpoint regarding 3 W’s (What, Why and Where) of credit management. What is the basic definition and business justification for having credit management and how the SAP credit management has evolved/changed from ECC to S/4 i.e. depicting the key changes/differences between two set ups and in the end following same with the baseline configurations required in S/4 to make it work.

Monday 1 June 2020

How to set up the ALE Distribution Unit(UPS) to Receive Inbound IDOCS.

I haven’t found any blog that details the steps to be followed to set up the ALE unit. Hence written this blog to detail all the configurations to be done for the ALE unit setup. Narrated the steps by taking a Scenario. Please find the Scenario details in the below sections.

What is ALE Distribution Unit(UPS)


ALE distribution consist of one original packet with batches of same type of data.

Ex: One Packet may consist of below details.

Friday 29 May 2020

CDS Table Function using ‘WITH’ Clause – Improved response time

Introduction –


In this blog, you are going to see how performance can be improved using ‘WITH’ Clause in CDS Table function when you have multiple selects.

I will use below Problem Statement as an example and try same solution in 3 ways.

Wednesday 27 May 2020

Create a Fiori application to perform CRUD operations with SAP Fiori Elements and BOPF Framework in S/4 System using CDS Annotations

Introduction


In this post, we will go over a series of steps in creation of a Fiori application to perform CRUD operations with SAP Fiori Elements and BOPF Framework using CDS annotations, without using a single line of UI5 code.

Pre-requisites for this Application:


◉ S/4 HANA System
◉ SAP NetWeaver gateway
◉ HANA Studio
◉ SAP Web IDE Cloud Platform

Friday 22 May 2020

Upload & Download Attachments in Dispute Management(FSCM)

In this blog, I am going to explain how to work with Attachments in the Dispute management module(FSCM) through the ABAP code.

There is a requirement where we need to Upload & Download the attachments for the Dispute case in our custom Applications I search for Different blogs to find any function modules or classes that can serve this purpose.

Wednesday 20 May 2020

Simple web forms realized by Fiori Elements Quick Create pattern

In this blog you will see how the Quick Create pattern from Fiori Elements can be used to easily create a HTML form application.

Forms


HTML form is a simple type of a one step/ one page application consisting of a list of fields for data entry and a SUBMIT button.  After the SUBMIT is hit the page data is sent to a back end system and the process is done.

Friday 15 May 2020

Wednesday 13 May 2020

Display standard text using CDS in ALV with IDA

Overview


This blogs mainly cover the topic to display standard text(T-code: SO10) is abap list viewer(ALV) with IDA which uses CDS as data source.

Standard Text


Standard text is a long text  and are not stored in SAP tables directly instead it is compressed & stored in the long raw data format in the table STXH and STXL. In ABAP programming, mainly Function Module READ_TEXT is used to retrieve these text.

Tuesday 12 May 2020

ABAP Exception Class ZCX_RETURN2

As an ABAP programmer we must program Object Oriented code (aka OO code). So for exception / error handling we need to use Exception classes instead of using the old procedural ways of error handling like SY-SUBRC and BAPIRETURN data.

However often we have to call BAPIs, or less favorite other function modules or FORM routines. In the new OO code we create we have to handle the procedural errors and convert them to OO Exceptions.

Monday 11 May 2020

Display Standard text using CDS annotation @ObjectModel.virtualElement in Gateway Service (Odata) or Fiori

Overview


Often we come across scenario where we need to display document/item text, which are stored in SAP as standard text. This blogs explains how standard text can be displayed in Gateway Service (Odata) or Fiori using CDS annotation @ObjectModel.virtualElement.

Wednesday 6 May 2020

Understanding the ABAP Program Logic With Profile Data Analyzer for Performance Optimization and Other Tasks

The Purpose


In the following SAP Community blog post which is published in the last month, we’d like to demonstrate the basic usage of the new tool “profile data analyzer” with two SM21 examples. With these examples, we can see that the profile data analyzer not only helps us to analyze the performance issue systematically and find out the most expensive parts of a program in a graphic and interactive way, but also helps us to understand the program logic, including getting an overall picture quickly and drilling down to the details easily.

Monday 4 May 2020

Understanding Fragments based Adobe form building using LiveCycle version 10+ with OData as back-end.

Adobe has come up with new Fragments based approach for building Adobe Forms using LiveCycle designer from version 10 and above. And these Forms are part of New Output Management for S/4 HANA Systems. In this blog post I would like to explain briefly about Fragments based Forms and also would cover regular Forms (which is categorized as of type “Standalone Form”) with OData as backend. I would like to say that even though traditional Form building provisions precisely speaking SAP Scripts, SMARTFORMS and Adobe Forms with ABAP based Interfaces are still available as an alternative for this but still I would like to ask all of you to give this a try at least for learning purposes if your client is not insisting on this. If not now definitely going ahead, we might be bound to use this option (Adobe Form with OData backend) only.

Friday 1 May 2020

Shared Memory Objects – Transfer data between ABAP programs

Shared memory is a memory area resides in the application server which is accessible to all the ABAP programs. In this post I’ll be discussing the way to access and use that memory area to cater business requirements by using a shared memory object.

Business Requirement


Sharing data between ABAP programs is a common business requirement. There are different ways of achieving that. Let’s take a simple business scenario.

Wednesday 29 April 2020

SAP ABAP, SAP PO and Microsoft Azure Logic App mashup – SharePoint Integration

Overview:-


Many of us have already integrated SAP with SharePoint using SAP Process Integration with REST api. In this blog post i will be explaining how we can use Microsoft Azure Logic App to drop PDF into SharePoint. With Logic App development efforts in SAP PO is reduced.

Implementation:-


In the ECC when a smartform is created a Function Module is generated.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Later smartform FM is called in the actual program to generate OTF, and then with the OTF, PDF is created.

below program returns OTF and then generate PDF.

gs_control_param-getotf      = 'X'. "When get OTF is set to "X" then FM will return OTF 

CALL FUNCTION gv_fm_name "Name of the FM generated by smartforms 
          EXPORTING
            control_parameters = gs_control_param
            mail_recipient     = lv_recipient
            mail_sender        = lv_sender
            output_options     = gs_composer_param
            user_settings      = ' '
            is_nast            = nast
          IMPORTING
            job_output_info    = gs_job_output
          EXCEPTIONS
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            OTHERS             = 5.
        IF sy-subrc EQ 0.
          DATA:gv_pdf_xstring       TYPE xstring,
               gt_job_output_info   TYPE STANDARD TABLE OF itcoo,
               lv_base64str         TYPE string.
                 
          gt_job_output_info[] = gs_job_output-otfdata[].

         CALL FUNCTION 'CONVERT_OTF'
              EXPORTING
                format                = 'PDF'
              IMPORTING
                bin_file              = gv_pdf_xstring
              TABLES
                otf                   = gt_job_output_info
                lines                 = gt_pdf_tab[]
              EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                err_bad_otf           = 4
                OTHERS                = 5.
         IF sy-subrc EQ 0.

         cl_http_utility=>if_http_utility~encode_x_base64( EXPORTING unencoded = gv_pdf_xstring RECEIVING encoded = lv_base64str ).

        ELSE.

With the FM “CONVERT_OTF”  OTF is converted to PFD and then PDF is encoded into base64 string using SAP standard method cl_http_utility=>if_http_utility~encode_x_base64.

DATA: ls_output              TYPE zws_mt_doc_to_spo_rqst, 
      ls_input               TYPE zws_mt_doc_to_spo_resp.

ls_output-mt_doc_to_spo_rqst-folder_path        = 'test/test/'.
ls_output-mt_doc_to_spo_rqst-file_name          = 'test.pdf'.
ls_output-mt_doc_to_spo_rqst-file_content_b64str  = lv_base64str.

  TRY.
       DATA(lo_doctospo) = NEW ZWS_CO_SI_DOC_TO_SPO_SYNC( ).
       lo_doctospo->si_doc_to_spo_sync_out( EXPORTING output = ls_output IMPORTING input = ls_input ).
    CATCH cx_ai_system_fault INTO DATA(lo_exception).
  ENDTRY.

The generated base64 string is assigned to a proxy structure (generated in SPROXY) and sent to SAP PO using SOAP sender(proxy) adapter.

SAP PO Configuration:-


In SAP PO ESR just 1 to 1 mapping is needed so i have created Data Type, Message Type and Service Interface.

Request Message Type

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Response Message Type.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Service Interface

SAP Process Orchestration,  ABAP Development, SAP Process Integration

There are multiple ways of sending PDF to SAP PO but i prefer converting PDF into base64 format in ECC itself using standard method in ABAP.

Other methods are as below.

1. Send PDF as an attachment from ECC along with the payload and then convert attachment into base64 string using UDF in graphical mapping or Java mapping.

2. using ABAP program generate PDF and save in Application server(AL11) then with FILE adapter in SAP PO pick the PDF(binary file) and convert PDF into base64 string using JAVA Mapping

If I opt above 2 approaches then i need to write a piece of code in SAP PO as well so i thought of performing all the conversion in ABAP itself(why to write java code in SAP PO if ABAP has already got standard class/method to encode/decode Base64 format )

In the Integration Directory we have used SOAP and REST adapter and configured like below.

SOAP sender adapter.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

REST Receiver Adapter.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

It is a HTTP POST operation.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Microsoft Azure Logic App Configuration:-


In the Microsoft Azure Portal under resource group create a new Logic App.

Logic App can be found under Integration –> Logic App(Microsoft has already provided document, tutorials and templates so that we can learn/understand and develop our logic App )

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Once Logic App is created select Trigger “When HTTP request is received” and under use sample payload to generate JSON Schema paste the JSON structure we developed in SAP PO Data Type(it will be in XML, convert it to JSON and paste here) and it will automatically generate JSON schema .

The REST receiver adapter in SAP PO will convert XML to JSON and send request to below Logic App to perform actions and drop files in SharePoint.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Now click over + button and select Add an action

SAP Process Orchestration,  ABAP Development, SAP Process Integration

A menu will appear, type SharePoint in the search box and select SharePoint Create File Action from the result.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

There are many other SharePoint actions available in the Logic App, i have selected Create File because i want to drop(create) a file in SharePoint. likewise we can use other actions if we need to do other operations.

Now when the create file appears, enter login details which has got access to SharePoint site where we will be dropping our PDF.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

SAP Process Orchestration,  ABAP Development, SAP Process Integration

◉ A new window will appear, when we simply click over field we can select dynamic content(whatever is there in JSON schema will appear)

◉ Whichever site the user has access will appear in the drop-down

◉ within site select the folder path where we will be dropping our file(we are sending path from SAP so path is being accessed dynamically here)

◉ enter the file name(we are sending filename from SAP so name is being accessed dynamically here)

◉ Since we are sending our PDF as base64 string, we will be converting it to binary here by writing expression base64ToBinary(triggerBody()?[‘FileContentB64Str’]) FileContentB64Str has been selected from Dynamic content

SAP Process Orchestration,  ABAP Development, SAP Process Integration

◉ base64ToBinary is present under Conversion functions under expression

Finally we will be creating last action that is Response(Send back response to SAP PO& ECC)

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Once done our Logic App workflow will look like this.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Testing:-


When the program is executed proxy program is invoked and data is sent to SAP PO which can be seen in SAP PO message monitor.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Logs can also be viewed in Azure Logic App monitor.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Finally PDF can be seen in SharePoint.

SAP Process Orchestration,  ABAP Development, SAP Process Integration

Scenario In a Nutshell:-


1. Return OTF from smartform Function Module, convert it to PDF, encode PDF into Base64 format and finally send out of SAP with SAP PO proxy configuration.

2. Configure SAP REST Receiver Adapter to call Logic App.

3. Logic App SharePoint create file action will connect to the SharePoint site and with base64toBinary operation decode Base64 string into binary file.