Friday, 29 December 2017

Add extra tabs to the standard transaction for sales and access them through menu bar

Introduction:


This post will clearly explain you how to add extra tabs in sales order or standard transactions and display the tab name as the menu item in order to access them through menu bar.

In this post let us see how to add additional tabs in sales order header through BADI.

Wednesday, 27 December 2017

Enhance SAP objects with great and testable code

The use case is an approval process for quotations. Requirement is to check the margin of a quotation and compare it with a customizable margin value, both total value and percentage value.

The check is based on item level (percentage check) and in accumulation (total value check) for the header.

If it fails a “blocking” order reason is set and a message is added to the application log (SD_MESSAGE_COLLECT).

Friday, 22 December 2017

Implementing search the S/4HANA way

An efficient search is one of the most important feature required in an application. This is what allows us to find objects that we want to work on.

In this blog series, me and my colleague Rajesh Khatwa would like to share our experience of implementing search functionality for a custom object built on top of S/4HANA. We used tools and technologies provided out of the box in S/4HANA to minimize the development effort.

Monday, 18 December 2017

ABAP debugger enhancement or how to speed up your test data creation process

Intro


In this blog we would like to introduce two open source helpers to create test data for abap unit tests.

Regardless of using the test first or test last approach in ABAP, we have to provide test data for our unit tests.

This process can be very time consuming depending on what has to be provided.

Friday, 15 December 2017

Posting FI Documents Using Flat File Interface- SAP FI-CO

Posting FI Account documents is a vital step for any Company to manage business flow. SAP provided different ways to post FI documents. One of the way is using FLAT FILE to upload and post FI documents.

Interfacing is one of the techniques used in SAP and of course in other technologies as well for uploading and then updating/Inserting data to the database. The data loaded must have some validation checks to make sure that the correct data is passed to the application , and saved to the database.

Wednesday, 13 December 2017

Concatenate multiple records in a single field using ABAP CDS Table Function

“Core data services (CDS) is an infrastructure that can be used to define and consume semantically rich data models in SAP HANA“.

The purpose is straight forward but the technical definition can provoke confusion sometimes, especially because we can find two different types of Core Data Services:

Monday, 11 December 2017

Implement Custom Syntax Check in SAP GUI

Recently for training purpose I need to demo a custom syntax check directly performed in SAP GUI by hotkey Ctrl+F2.

Let’s first have a look what could be achieved:

Open a method in Class builder and click syntax check icon or press Ctrl+F2:

Friday, 8 December 2017

Be prepared for the new ABAP programming model in SAP S/4HANA

You’ve surely already heard about the new ABAP programming model for building state-of-the-art, intrinsically SAP HANA-optimized Fiori apps in SAP S/4HANA and maybe even played around with it, but you are still be on SAP Business Suite – optimally on SAP HANA.

This is the situation for the vast majority of SAP’s customers and partners right now in 2017, but sooner or later they will get in touch with the Digital Core, that is SAP S/4HANA!

Wednesday, 6 December 2017

Handling Time-Out Scenario in Web Dynpro ABAP

Requirement


There is a common requirement given by client wherein, they expect to display some logical message to end-user if application page is kept ideal for a defined time i.e. instead of application throwing TIME OUT error, giving any of the following utilities:

Monday, 4 December 2017

SAP Certification Recommendation for Partner Solutions for SAP S/4HANA

With SAP S/4HANA, SAP has introduced a new product which is significantly different compared to the earlier ERP systems, and which brings many new features and simplifications with every new release.

Because of that, it’s highly recommended for SAP customers, to only use certified third party software, for integrating with SAP S/4HANA. This is mostly important, if the third party software runs in SAP S/4HANA as an ABAP Add-On.

Saturday, 2 December 2017

5 Use Cases of GROUP BY for Internal Tables

ABAP developers target a moving Netweaver platform (7.0, or 7.02 or 7.31 or 7.40 or 7.5x or the Cloud) where the state of the art method to shoot yourself in the foot is a contest between vintage idioms and idioms using recent additions to the language.

* Add line to internal table LT_ENTRY
ls_entry-action = shoot.
ls_entry-aim = foot.
APPEND ls_entry TO lt_entry.

Thursday, 30 November 2017

Revoke User to Release TR

In this doc we will discuss various methods to restrict the user to release the Transport request in SAP.

THis scanerio is used when you are having third party support and you want to check all TRs at your end and dont want to give them authorization to release the TRs.

We don’t have any enhancement points in program so we will go with BADI.

Friday, 24 November 2017

Find your way to the BOPF

I set a learning path to catch up with SAP development tools and techniques that in spite of being around for a while now,  the comfort zone was just too comfortable to step out, until the breakthrough came in and I realized I didn’t want to be left behind. After one year things are starting to pay off now, which is great.

In this opportunity, I want to talk about the Business Object Processing Framework (BOPF), which is yet another way of maintaining database records in an Object-Oriented way. Although this is a rather simplistic view, as it turns out that the framework is capable of doing many more things, such as dealing with authorizations, or even orchestrate the application business logic flow. It can be integrated with several UI technologies, say UI5 or Web Dynpro/FPM.

Monday, 20 November 2017

ABAP Code Vulnerabilities, a call for real-time security alerts

ABAP code vulnerabilities


SAP security is a great challenge and will be a challenge for many years to come. In order to thoroughly secure an application, all of its components and potential threats need to be understood. SAP security is multi-layered, its building blocks range from infrastructure to application security. In order to break an application, only one flaw may be sufficient to compromise an entire environment.

Below an overview of SAP security notes released between June and November 2017, categorized by their priority.

Friday, 17 November 2017

Simulation of statistic riddle

So just proof the solution with a simulation.

1. Create 1.000.000 families with two children {m,f} 50:50 and born on {sa,su,mo,tu,we,th,fr} 1:7
2. Count chance, that family has two boys 1/4
3. Count chance, that family has two boys, if you know that one child is a boy 1/3
4. Count chance, that family has two boys, if you know that one child is a boy and born on tuesday 13/27

Wednesday, 15 November 2017

The performance of open SQL as in ABAP 7.52

The use of FOR ALL ENTRIES in Open SQL of ABAP has been used for very long time. And it is helpful for report data from different table.

SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Certifications

Tuesday, 14 November 2017

Continuous Integration in ABAP using Jenkins

The team has setup a CI/CD pipeline in Jenkins to automate build, test, and deploy of those Java services. At the time we had the pipeline, I have realized the benefits for having such pipeline and that became my motivation to build one for ABAP.

The most important benefit in my view is the visibility over your software’s health. If someone asks whether the Java piece is working fine at the moment, we can have a glance at Jenkins monitor and be able to answer quite confidently. In ABAP, we are just blind. I even sometime break my software and found them out later.

Saturday, 11 November 2017

FOR expression in ABAP 7.40 – Best case scenarios

As we all know, the In-line declarations, operators and expressions available in 7.4 SP02 onward are taking the abap world by storm for last few years. For the new or the experienced abap-ers this is almost like fall in line or fall apart. The main idea is to write code easily, keep it lean and compact as much as possible.

Thursday, 9 November 2017

Troubleshooting ABAP Dumps in relation to SAP HANA

Purpose


The purpose of this document is to instruct SAP customers on how to analyse ABAP dumps.

Overview


How to troubleshoot ABAP Dumps

Tuesday, 7 November 2017

Simulate Shipment Cost (VT02N) – Using Function Module

I am here with yet another unsolved mystery, yup! You better believe me! As the subject is as clean as a whistle, this blog post is all about Simulating Shipment Cost through Function Module. Before I proceed, let’s have a clear understanding what actually I am trying to do and what exactly we will be going to achieve!

So, here is the scenario. You have the Shipment created and you see the button on VT02N to simulate cost. Well, when you do it through T-code, it is as easy as anything but the reality is as different as cheese and chalk! Oh yes, I mean it. It’s not easy when it comes to implement via Function Module.

Saturday, 4 November 2017

ABAP to the Cloud

This morning Bjoern Goerke, SAP’s Chief Technology Officer and President SAP Cloud Platform, announced at SAP TechEd in Las Vegas that SAP are going to make the ABAP runtime available on the SAP Cloud Platform (SCP).

ABAP has been a bit maligned over the years for not being ‘cool’. Maybe this is partly because simple consumer style apps for the smartphone are more hip than enterprise applications? Maybe it is because SAP lost a bit of interest in ABAP during some of the noughties? Maybe it is partly because we ABAPers are not always great representatives of the language? Maybe you can think of other reasons?

Thursday, 2 November 2017

How To Use SAP HANA ABAP Source Search via PowerShell

Here a tiny example how to use SAP HANA ABAP Source Search via PowerShell. After my question here, in the ABAP in Eclipse forum, I see how easy it is to use the ABAP Source Search from outside an SAP system. After the activation of the business function SRIS_SOURCE_SEARCH is it also possible with only one http get request to use it.

Wednesday, 1 November 2017

The Global Variable Dilemma

When doing complex coding, there’s always the dilemma of using or non using global variables. We all know that global variables are dangerous because you never know where they are set and what value they carry in a specific method.

On the other hand, if I keep everything local, I am ending with huge lists of parameters in every method just to pass the values needed to the deepest nested method where I need it.

How to replicate from ABAP to ABAP

With DMIS 2011 SP6 we released the capability for ABAP to ABAP replication. The underlying database is not imporatent for this setup. We get more and more request how to set it up. It is described in the system docu, but of cause a how to with screenshots is much better.

First of all, why should you setup a ABAP to ABAP replication?!

◉ Replacement of an batch-oriented option to move data between systems
◉ Fill additional ABAP system beside ECC with real-time data

Tuesday, 31 October 2017

ABAP Managed Database Procedure- Data Preview

What is AMDP ?


ABAP managed database procedure is a simple ABAP class method containing database-specific procedure coding. The code within the method is pushed to the database layer and executed within the database. Thus significant performance improvements of data-intensive processes can be achieved by code push-down from the application server to the database server. This reduces the number of data transfers and the amount of transferred data between both servers.

Monday, 30 October 2017

Connecting AS ABAP 751 Developer Edition with HANA Express 2.0 as Secondary DB

My experience of connecting a SAP ABAP 751 Developer Edition server to HANA Express and then, replicating data over to HANA through ABAP and finally, running a quick performance test between the two system using ABAP CDS vs HANA CDS.

Discussing on the topic of connecting a HANA database as a secondary DB in ABAP and also shared the following image below – and this is the inspiration to the start of a personal initiative to set up something similar locally.

Sunday, 29 October 2017

Add Custom Field to Purchase Requisition – MEREQ001

I looked for a detailed document about ME51N-ME52N-ME53N add custom field in SCN but i have not found fully described. That’s why i decided create this blog.


Symptom:


Some customers need to add custom fields for their purchasing request documents then try to copy this field other subsequent purchasing documents such a purchase order. You can benefit from this blog for these requirements.

Friday, 27 October 2017

How fast is ABAP Core Data Service(CDS)?

How fast is ABAP Core Data Service (CDS)?  This is one of the frequent question raised by technical consultants after any ABAP CDS sessions. We can demonstrate speed of ABAP CDS through below simple approach, I have written same requirement in two different methodologies. Business requirement is to obtain the material number from MARA table and material description from MAKT table. Material number in final result should be without preceding zero’s.

Thursday, 26 October 2017

Installing Two ABAP Systems on Separate Tenants in SAP HANA SPS 09

Over the last few months, I’ve been trying out various scenarios involving the new multitenant database containers in SAP HANA SPS 09, and I thought it might be helpful to share my findings and examples with others who want to get their feet wet with this new feature. So here goes…

“Multitenant database containers” is a bit of a mouthful, so for the rest of this article I’m going to use the abbreviation MDC.

The first scenario I tested was the installation of SAP HANA SPS 09 with MDC, followed by the installation of two ABAP systems on two HANA tenants:

Wednesday, 25 October 2017

New Data Modeling Features in SAP NW ABAP 7.4 SP5

The Challenge


With the availability of the SAP HANA platform there has been a paradigm shift in the way business applications are developed at SAP. The rule-of-thumb is simple: Do as much as you can in the database to get the best performance. This is also true for the underlying data models of the business applications.

Tuesday, 24 October 2017

ABAP Test Cockpit Checks

The purpose of this blog is to describe ABAP Test Cockpit (ATC) checks. ATC is based on Code Inspector (SCI), it reuses Code Inspector checks and significantly improves the code quality by offering the uniform quality criteria for the whole development landscape and establishing new quality assurance processes (quality gates, exemptions, mass regression tests) to minimize errors in productive systems.

Monday, 23 October 2017

ABAP Performance Test: Hashed Tables vs Database Buffers

There are two significant techniques to avoid repetitive access to database records: Hashed internal tables and database buffers.

If we decide to use the former method, we need to get the database record into a hashed internal table. Whenever we need to access the record, we read the internal table instead of the database table.

Wednesday, 18 October 2017

CDS view performance analysis using PlanViz in HANA studio Part-14

I am a newbie in CDS performance area and frequently I meet with some “weird” performance behavior which makes me really confused. After I consulted with performance experts, it turns out that all those “strange” behavior has their root cause and could be well explained – no strange at all but just works as designed! I will share with my finding and learning with you through this blog.

Monday, 16 October 2017

Implementation of ETag for write services

This article details an approach for implementing ETags in OData write scenarios in SAPUI5 applications.

Traditionally SAP GUI applications have utilized pessimistic locking using lock objects to ensure data consistency in parallel usage scenarios like single material number being edited by two users concurrently, same employee’s work schedule getting updated in parallel in two sessions, etc.

Under the HANA hood of an ABAP Managed Database Procedure

I’ve been looking into ABAP managed database procedures for HANA recently and decided to take a look at what’s actually created under the hood in the HANA database when an AMDP is created.

I created a small test class in our CRM on HANA system with a method to read a couple of columns from the crmd_orderadm_h table using sqlscript. The method takes one input parameter IV_OBJECT_ID and has one export parameter ET_ORDER.

Sunday, 15 October 2017

Configure ABAP webdynpro component into CRM system via Transaction launcher

THINK twice why you want to include an ABAP webdynpro component into CRM UI, as in CRM application it is not recommended to use ABAP webdynpro to develop UI. In some case for example, PDF preview is far more convenient using standard ABAP webdynpro control “Interactive form”. However if you would like to achieve the same via webclient UI, much more development are unavoidable.

Friday, 13 October 2017

Branching in ABAP – experiences

I described our approach to manage concurring requests for program changes using a branching-like technique.

After 6 months of “living” this approach, I would like to give an overview of our experiences.

Things to be aware of

New methods, attributes and types in classes

Thursday, 12 October 2017

WebUI meets ABAP CDS

Introduction


ABAP CDS views allow us to build very nice and structured applications for any solution or UI.

This blog is about how to build a very nice, simple and really fast WebUI application for really crazy data model and volumes, by just using ABAP CDS.

Send web push notifications using ABAP through OneSignal

Traditionally (in ABAP-land), in order to notify a user about something in SAP, it meant sending an e-mail to the user mailbox. It works most of the time until the user gets sick and tired of all the emails and sets up a rule to block all incoming e-mails from the SAP system or sets a rule to route it to the spam folder.

Then, came along mobile / Fiori applications where we’re now open to the world of real-time push notifications directly on your mobile device – ding! Obviously, this works great when you’re looking at your phone 24×7 and it’s always within reach.

Tuesday, 10 October 2017

Code Inspector Checks

The purpose of this blog is to describe SAP NetWeaver AS, Code Inspector checks. Code Inspector is a tool used to perform static analysis of ABAP programs and other SAP repository objects. It is a framework where all the categories and checks are based on ABAP classes. SAP continuously delivers new built-in checks for new tools and new objects.

New ABAP for HANA features in SAP NW 7.4 SP5

With the newly released AS ABAP 7.4 SP5 we have deepened the interplay between the ABAP and SAP HANA and enhanced the capabilities of the ABAP for HANA development. Following the code to data paradigm we have focused on enabling you to innovate faster and better with ABAP for HANA.

So what is inside this release for ABAP on HANA developers?

Friday, 6 October 2017

Methods of Running Total calculation in ABAP CDS views

The post is dedicated a of important aspect of reporting – calculating of Running Total or Cumulative Key Figures.

There is an example of cumulative amount key figure by fiscal year periods:

Cloud Native Applications

Cloud


A cloud application is one which you access over the internet and not your own computer’s hard disk. Today, everyone seems to be moving to the cloud. Cloud products are the latest in technology trends and all companies seem to be having some offering or the other on “cloud”. But it is important to be able to analyze for ourselves, if the product is really cloud – cloud-based/cloud-ready or cloud-native/cloud-centric?

Wednesday, 4 October 2017

Retroactive Billing – VFRB Modification to add credit/debit line

Retro billing process is used to create price differences documents (credit / debit memo) after price changes in SAP.

OEM suppliers benefit from this program but some of them need some developments on it. In our client, standard program SDREBI02 is modified to add credit/debit line manually .

1- May i add manuel credit/debit line ? Because, OEM calculates different total amount but they balance this items with debit/credit lines.

Tuesday, 3 October 2017

Creation of Service-PO using BAPI_PO_CREATE1

This post provides a detailed explanation of Service PO creation. Also, can able to understand the below bulletin points:

◉ The tables that refer to the service line logic.
◉ Passing the fields (needed for service-PO creation) to the BAPI_PO_CREATE1.

Saturday, 30 September 2017

ABAP Ray Tracer – Part 3 – The Skeleton

Objectives


In this third blog I am going to get the most rudimentary ray tracer running. The book calls that the skeleton ray tracer.

I’m gonna explain the basic concept behind a ray tracer and give you code examples from my implementation to highlight this concept.

Wednesday, 27 September 2017

Overview of ABAP in SAP Cloud Platform

SAP Cloud Platform is SAP’s strategic Platform as a Service (PaaS) offering for SAP customers and partners to build, integrate and extend SAP’s business solutions and services. Today, SAP Cloud Platform applications and extensions can be built with different development environments like Java or Node.js, but SAP’s own environment for business applications, ABAP, has not yet been available so far.

ABAP in SAP Cloud Platform is SAP’s new Platform as a Service (PaaS) offering for ABAP. Since many years, ABAP has been the foundation for SAP’s on-premise solutions. With ABAP in SAP Cloud Platform, ABAP developers can make use of their existing ABAP know-how to develop and run ABAP applications in the Cloud.

Tuesday, 26 September 2017

Time-dependent attributes and language-dependent texts in ABAP CDS views

In the post post I would like to consider how to model time-dependent attributes and language dependent texts in ABAP CDS views.


1. Sales Model Tables


1.1. Table of sales transactions. It contains time characteristics, sales manager, customer and amount. Number of records is 133 848.

Monday, 25 September 2017

ABAP Ray Tracer – Part 2 – The Overloader

Objectives


In this blog you’re gonna get to know the infrastructure powering this project, the content of the chapters, which I have read so far, plus certain C++ language features explained, which are missing in ABAP.

Friday, 22 September 2017

abapGit Branching Strategy Discussion

My team and I are reaching out to you to discuss some development questions which popped up after introducing abapGit in our company, which creates SAP 3rd party software, consisting mainly of ABAP and UI5 code.

This article deals exclusively with the ABAP side.

First of all we love abapGit, and we believe many do…

Thursday, 21 September 2017

ABAP News for Release 7.52 – Virtual Sorting of Internal Tables

It is mainly a “major step on the way to efficient development of SAP HANA optimized SAP Fiori apps is the use of the new RESTful ABAP programming model which includes technologies such as CDS, Business Object Processing Framework (BOPF), SAP Gateway and SAPUI5.”

But there are some news in the ABAP language too.

ABAP Development in Eclipse – Part 2

If you need to connect to any system, you have to create a Project.

Project can be created based on the type of implementation Eclipse will be used.

In our case, since we are connecting to SAP system , I am going to create an ABAP project.

Tuesday, 19 September 2017

ABAP Development in Eclipse – Part 1

As we all know that ABAP and SE38 has been a mainstay for SAP’s code development and most of the companies run their businesses on SAP solutions written in ABAP. All these years ABAP development and SE38 has continuously evolved into what we see in latest and improved SE38 editor.

1990 – First ABAP Editor came

1999 – ABAP Workbench was introduced

2004 – Syntax coloring and Code compilation added

Adding custom tab to billing document Part - 1

1. Requirement


In order to fulfill some requirement, we may need a custom tab for transaction VF01/VF02/VF03 with some custom field(s) in that sub screen, in this document we take GTI (Golden Tax Invoice) for example.

Saturday, 16 September 2017

How to develop a transactional app using the new ABAP Programming Model for SAP Fiori

Introduction


The purpose of this how to guide is not to simply duplicate the content of the SAP Online Help, but to provide guidance for the participants of a SAP CodeJam event. Participants of a SAP CodeJam event shall be guided to create their own repository objects and services in one system without messing up the implementation of the other participants. Therefore, all repository objects contain the participant / group number indicated by a hash # as a suffix.

Thursday, 14 September 2017

Wednesday, 13 September 2017

SAP AS ABAP – Authentication using X.509 Client Certificates

This document shows how to configure SAP AS ABAP for authentication with x.509 client certificates. It shows the procedure used to create a simple Certification Authority (CA) using OpenSSL and how to generate client certificates from this CA.

Enabling SSL


Install the SAP Cryptographic Library. The following are minimal parameters to enable SSL

Simplify your life: Searching text strings in SAP code - enhancements, SAPSCRIPT, SMARTFORMS or ADOBE forms

Introduction


A recurrent issue is to search all kinds of ABAP code for text strings. SAP standard program AFX_CODE_SCANNER does a great job, but lacks the search in code of enhancements, Sapscript, smartforms and Adobe forms and interfaces.

I will post the code for ZAFX_CODE_SCANNER, an adjusted copy, which does have those options, and can search the other areas. Please use at your advantage.

Tuesday, 12 September 2017

ABAP Continuous Integration with Eclipse

Short read


As an add-on for ABAP in Eclipse the plugin ABAP Continuous Integration  contains some features for a Continuous Integration environment. The plugin can be downloaded from the Eclipse Marketplace.

To access the unit test data of the ABAP system a specific Gateway Service is needed, which delivers the information whether all tests of an ABAP package are valid or not. The creation of this backend service is described here.

Saturday, 9 September 2017

Adding multiple transport requests to import queue

Introduction

A good habit is to clean up import queues (STMS), so the overview of all that remains to be done is best. You can always search the histroy for what has been done.

SAP provides the menu function to remove already imported requests, and maybe soms old and obsolete transports, that have not been imported, from before the acceptation environments new client copy, can be removed also.

Thursday, 7 September 2017

ABAP Continuous Integration – the backend

Short read


In this blog the creation of an Odata Service is shown which can be used to get the unit test data of an ABAP Netweaver system.

To get the information whether all tests of a package are valid or not the ABAP class cl_aunit_adt_res_test_runs is used. The code to extract the package status is available on github: https://github.com/andau/zabap_ci and can be imported with abapGit.

Tuesday, 29 August 2017

A compare tool: Download and analyze the runtime performance result from SAT

I once participated one project which needs to do bench-marking about how much performance gain we can benefit after we move the whole CRM system on top of HANA.

we plan to do it via steps below:

1. Run one test report via SAT on both HANA based and non-HANA based system

2. export trace result( xml format ) of HANA system locally, and import it into non-HANA system, and do comparison in SAT.

Saturday, 26 August 2017

SAP JCo Server Example

Introduction


When writing my first JCo server for I found it very cumbersome to find guiding code snippets and as well as a self-contains, fully working example. Thus I would like to put such an example here.

Friday, 25 August 2017

Some small ABAP tools I write to improve daily work efficiency or just for fun

I write some small ABAP tools for my daily work. Some of them might not be so useful at first glance – I just write them for fun. Some of them could be used to improve work efficiency.

1. Tcode Usage Statistics Tool


This 56 lines of report can print the tcode usage for a given user per month.
REPORT ZTCODE.

Wednesday, 23 August 2017

Realizing automotive EDI processes with VDA, EDIFACT, ANSI, ODETTE, and IDocs

Introduction


The supply chains of automotive companies are usually fully automated. Instead of using paper-based processes, OEMs (original equipment manufacturers) and their suppliers communicate using electronic data interchange (EDI). Thereby, messages are sent from one IT system to another IT system without any human intervention.

ABAP syntax check in Notepad++

Introduction


Notepad++ is a free text editor with a lot of good functions to work on ABAP source code files. Several developers have shown how to improve your work with this editor. That’s great to read and write ABAP source code without using transaction SE80 or Eclipse – have a try, it’s interesting to write source code without system assistance.

Tuesday, 22 August 2017

Step by step to use jChartFX in BSP application

In my blog CRM One Order statistic tool I develop a small tool to print out the statistics of number of assigned line item for all business documents in the system.

The tool has the following three sections of output in SAPGUI.
This section means there are 1 order which has 5000 line items, 1 order has 2000 items, 1 order has 1998 items …

Sunday, 20 August 2017

ABAP to get SAP BW Direct & Event scheduled process chains list

Proposal:


Sometimes we may be struggling to find out all the list of Direct & Event scheduled process chains. Also as part of SAP BW Support activity, during GMW (Global Maintenance Window) we are carrying few activities manually which needs to be done before the start date of GMW. Analyzing and de-scheduling the process chains (PC) depends upon the down-time duration of the GMW falls under this activity. It takes long time for identifying the process chains which are Direct or Start using Meta chain/API. So here I have developed a ABAP code to get the list.

Saturday, 19 August 2017

Delivery and Shipment handling units

Business Requirement :


1.Creation of Delivery Handling unit for over packing and master cartons even if over packing is not required.
2 Creation of Shipment Handling Unit for boxes packed in Deliveries to allow receipt by HU# in the receiving plants.

Friday, 18 August 2017

ABAP custom code adaptation for SAP HANA – The efficient way

Introduction


Currently many SAP customers plan and evaluate the migration from their classic ERP system running on any DB to Business Suite on SAP HANA or S/4HANA. For both scenarios custom ABAP code needs to be adapted for SAP HANA. This paper shares best practices in order to minimize the adaptation effort. The recommended procedure has already been applied successfully in many different SAP Hana migration projects.

Wednesday, 16 August 2017

Enumerations in ABAP

To represent a fixed value set in ABAP you can use several different technologies. The newest one is enumerations which are provided at language level and can be used as of AS ABAP 7.51. With this blog post I want to show which possibilities there are for ABAP developers to define enumerations and use them in signature elements in the safest way possible.

Saturday, 12 August 2017

Call HANA Orion API from ABAP

The SAP HANA Repository is a key feature of the HANA native development environment.  It is the design time archive for all development objects from database tables all the way up through user interface artifacts. However up until now we’ve not had a supported API which would allow application developers or 3rd party tools developers to access the Repository.  With the advent of the Web-based development tooling, SAP needed to create a REST-based service interface for these development tools.  These two requirements come together in SPS 09 in the form of the newly released SAP HANA REST API.

Basics of Web Dynpro ABAP

Basics


Web Dynpro applications  can be created and edited in the web dynpro explorer in the ABAP development environment

It has been fully integrated into the ABAP Workbench so there is no separate transaction code. we use the object list selection to display  or create Web Dynpro component.

Thursday, 10 August 2017

An ABAP tool to get ABAP source codes line number

You can use this tool ( an ABAP report ) to get the line number of your ABAP source code.

How to use this tool


Just specify the criteria based on which the source code will be scanned and line number will be calculated.

CDS view source code count tool Part-12

The Continues Blog, For development complexity and draft effort estimation I need a tool to calculate the total line number of the CDS views belonging to a given package.

ABAP Development, SAP ABAP Tutorials and Materials, SAP ABAP Certifications

Wednesday, 9 August 2017

ABAP Nested Loop Performance Test

During an ABAP performance discussion, we decided to run tests to decide on the best method for nested loops. The example was to have an outer loop of BKPF and an inner loop of BSEG.

Nesting two raw loops gives the worst performance in all cases; therefore I have left it out.

In our initial test using the source code shared below; here are the methods ordered by better performance:

Sunday, 6 August 2017

How to create ABAP CDS View with enabling derivation of the value for parameters

There have been dozens of blogs online for walking through developers on how to create ABAP CDS view with parameters in ABAP for HANA, however, one major issue still exists is that although input parameters can restrict or filter the data from CDS views, the limitation of the value input for a parameter to filter out more specific data range is significant.

Here the author presents you a way to enable derivation of the value for parameters to tackle similar problems in your future development using the example shown below.

Friday, 4 August 2017

Regarding cookie manipulation in CL_HTTP_CLIENT to avoid CSRF token validation failure issue

Recently I meet with this cookie issue so I document it as a blog in case any other guys might meet with the same problem.

I am trying to create some Opportunity transaction data by consuming OData service via CL_HTTP_CLIENT. Since this is a update operation which needs to be finished by HTTP POST, so a CSRF token is needed in this HTTP post. Let’s first have a look what is a typical scenario running in Chrome extension postman:

Thursday, 3 August 2017

Old New ABAP Editor

Introduction


If you develop now UI for SAP, you use Web IDE. If you are doing backend and ABAP, you use ABAP in Eclipse. But sometimes you still need to come back to SAP GUI and ABAP Workbench and use the “New” ABAP Editor.

Wednesday, 2 August 2017

ABAP Group Operations in Internal Tables

Today, we will be inspecting some cool grouping techniques introduced in ABAP 7.40.

First, let’s get familiar with our context. We will read the table T001K, where BWKEY (valuation area) is the table key, but BUKRS (company code) is repeated multiple times in various lines. Let’s start off by reading this table.

Converting Function Module Exceptions to Exception Classes

Although function modules belong to the era of procedural programming, we all need to use them from time to time. While most BAPI’s usually return error messages in a clean internal table format, many other function modules return classical exceptions.

If you are calling a function within a class method, you might have a hard time converting those classical exceptions to class based exceptions – meaning exception classes.

Monday, 31 July 2017

CDS view authorization Part-13

There are already lots of blogs in community talking about CDS authorization concept, here I just blog what is so far not mentioned in those blogs.

For demonstration purpose I create a very simple database table ZORDER with two entries:

ABAP Development, SAP ABAP, CDS

Saturday, 29 July 2017

How to Create,Change or Check FBI Customization

Normally in FPM we have direct option to create Customization , whereas in FBI we don’t have:

Standard FBI View how it looks, there is no option to create customization

SPA ABAP Tutorials and Materials, SAP ABAP Certifications

Friday, 28 July 2017

ABAP in Eclipse 2.80 benefits Eclipse Oxygen

On June 28nd Eclipse Foundation released the Oxygen release which is the newest version of the Eclipse platform. This release brings some nice improvements the ABAP Development Tools directly benefit from:

Improvements of the “Quick Access” field


  • You can now use * and ? as wildcards and also search for partial descriptions in Quick Access (Ctrl+3).

CDS view test double framework Part-11

The CDS view test double framework works as a magic for me: how the mocked data I inserted into the view under test could be read again in unit test code? As a result in this blog I will try to explain how CDS view framework works under the hood.

The view I am developed is listed below, which is simply used to return material guid with description by joining table MAKT with MARA:

Thursday, 27 July 2017

How does CDS view key user extensibility work in S4 Part-10

One of supported feature is customer can easily add new fields to extensible CDS view without knowing technical detail.

For example, if a given CDS view is marked as “UI Reports” extensible in extensibility registration tcode SCFD_REGISTRY.

ABAP CDS, ABAP Development, SAP S/4HANA

Wednesday, 26 July 2017

Cube view and query view Part-9

In previous eight steps all we focus on is transactional stuff. This time let’s touch some analytics stuff.

Let’s first create a most simple database table in ABAP backend:

ABAP CDS, ABAP Development

Monday, 24 July 2017

Associations in ABAP CDS(7.40)

I would like to present one simple example to explain Association in ABAP CDS view in 7.40 environment.  In this example i will not concentrate on theory we will just take 3 tables and try to show association.

Let us take one problem statement

Problem Statement– “Need the details of all employees having valid addresses in database either PERMANENT or TEMPORARY”

Sunday, 23 July 2017

Darkest Dark Theme for Eclipse with ADT

I really like Abap in Eclipse and work with Eclipse every day. But if you work every day with Eclipse it’s really exhausting for your eyes because of the bright UI.

So i searched for a possibility to use the dark theme with ABAP in Eclipse. I think many developers tried to use the standard dark theme in Eclipse.

Saturday, 22 July 2017

Simple Program to view tables in single view

A lot of times we need to view data from different tables in a single view to perform analysis.

It could be analysis for development or production. In those scenerios we can create quick SAP Query – but problem with Query is that if two tables are not joined you cannot view data from two more more independent tables.

In those cases we can use the below report which will fetch data from different tables and present it in single ALV or Browser page. The report logic is as given below.

Friday, 21 July 2017

First Experience with ABAP for HANA – Evolution or Revolution?

ABAP for HANA – Revolution or Evolution?


When taking part at CEI Trailblazer I learned that SAP tried out lots of different approaches to find the best programming model for ABAP applications on top of HANA. So we had to learn about the new toolset ABAP in Eclipse and many new ABAP frameworks and techniques – in fact all represented different approaches and programming paradigms. Some of those frameworks are revolutionary in the sense that they are powerful and sophisticated – but do they allow agile development and “taste” like SAP Business Suite? We tested very conservative techniques like Open SQL with HANA as primary persistence and it worked fine and often brings immediate success. I learned that other approaches fit perfectly to HANA like OData with its filter and paging techniques.

Wednesday, 19 July 2017

ABAP on HANA Optimization – Step by Step Remediation

1. STEP BY STEP TUNE YOUR CUSTOM ABAP CODE – HANAFIED


1.1 Introduction

Before Migrating to Suite on HANA or ABAP on HANA environment we need to analyse which of my ABAP code must be changed to avoid potential functional issues. In general existing ABAP code runs on SAP HANA as before
Only if ABAP code relies on technical specifics of the old database, ABAP code changes might be necessary.

Monday, 17 July 2017

Use Regular Expression to parse the image reference in the markdown sourcre code

As mentioned in my blog A Github repository issue backup tool developed by ABAP I am developing a tool in ABAP which can backup my github issues.

One of the functionality I would like to fulfill is to backup the images used in issue with markdown format as well. Take this issue of mine for example. This issue contains the reference to image files uploaded by me via dragging my local image files and drop them to the browser.

Sunday, 16 July 2017

A Github repository issue backup tool developed by ABAP

I personally prefer to use Github repository issue to manage my knowledge. For issue, this is my github repository to store ABAP and SAP CRM related knowledge of mine and currently it has already 285 issues.

ABAP Development, ABAP Tutorials and Materials

Saturday, 15 July 2017

Step-by-step Guide to setup ABAP on HANA with Eclipse

Step by Step guide to install ABAP on Eclipse for HANA Development


This blog describes how to install and update the front-end components of ABAP Development Tools (ADT) for SAP ABAP on HANA.

I’m writing this blog as I see many people have asked questions about ABAP Development tool on Eclipse. One can take different approaches within Eclipse to bring ABAP development tool and this is one such approach. This blog is suitable for anyone who seeks to start the ABAP Eclipse setup or those who need of such information.

Friday, 14 July 2017

Adding Custom Fields in WZR1,WZR2 and WZR3

Creating Additional Tab in WZR1/WZR2/WZR3

Now here is the document to show how to create an Additional Tab in WRZ1 (Settlement Request) screen. I did this as per my requirement which is for creating Payment Settlement Request.Here the data is coming from the IDOC to SAP server and to track the Payment Information the Settlement request is created and gets stored in the Standard WBRK table.

Now in this IDOC, it contains some IMP user specific data which needs to be stored ,it can be anything in my case it is  For Ex. IDOC number, IBAN number, SWIFT key and many more for which there is no fields provided in the Standard WBRK table. Now so as to store those values in WBRK table we need to create Custom Fields in WZR1 screen as well as in WBRK table.

Thursday, 13 July 2017

Decimal Shift & Decimal Shift Back in CURRENCY_CONVERSION an Example

Below example explains the use of parameter DECIMAL_SHIFT and DECIMAL_SHIFT_BACK in CDS function CURRENCY_CONVERSION (ABAP 7.40).

First let us understand what does Standard definition says:

DECIMAL_SHIFT–  If the value “X”  is passed to the parameter decimal_shift, the value passed is multiplied by 10 to the power of two minus the number of decimal places of the source currency before it is converted.

Tuesday, 11 July 2017

SAP FICO ABAP Interface (Iine Items/Balance in currency transaction) error resolved)

One of the most important aspect of SAP FICO is the posting of the documents. Document postings can be done in several ways. When abapers use Interface or report program to post documents , they face many issues. Here I am discussing the solution of two of the most common issues for document postings  to the fico.

Frist scenario is related to lines Items postings. The second scenario is related to  the error ‘balance in currency transaction.

Monday, 10 July 2017

Using the Rules Pattern to Improve Code Maintainability

The Root Cause


What is the root cause of all of this mayhem? In a word, unpredictability. It was impossible to gather all of the requirements at design time, and if working according to agile methodologies this would not even be attempted. Requirements evolve over time, new customers and business conditions come onboard, so even if the requirements analysis had been completely comprehensive at the beginning of the design process, new requirements would invariably crop up.

Sunday, 9 July 2017

My summary of different approaches for annotation declaration and generation Part-8

During my recent CDS view explore I have experienced several ways of CDS view annotation declaration or generation. I list them in this blog for study purpose.

Approach 1: developer does not declaration explicitly, but backend generates automatically
Take this field for example:

SAP ABAP Tutorials and Certifications

Friday, 7 July 2017

Unveil the secret of @ObjectModel.readOnly Part-7

In my application with edit function enabled, I have set posting date as read only by using the annotation below according to sap help.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guide

Thursday, 6 July 2017

Consume table function in CDS view Part- 6

Let’s try to resolve one real issue now. What we want to achieve is: in CRM we need a CDS view which returns the service order guid together with its Sold-to Party information, “Title” ( Mr. ) and “Name” ( blGMOUTH ).

ABAP Development, SAP ABAP Certifications, SAP ABAP Guide

Wednesday, 5 July 2017

Weak reference in ABAP and Java

Recently I have some recruitment interview on the topic Weak reference and I think it is necessary for me to refresh my knowledge on this topic.

According to ABAP help, we can wrap an object reference to the so called weak reference, for example see the following code:

lo_person = NEW lcl_person( 'Jerry' ).
lo_weak = NEW cl_abap_weak_reference( lo_person ).

Tuesday, 4 July 2017

Functional programming – Simulate Curry in ABAP

As I mentioned in What should an ABAPer continue to learn as an application developer, function programming language is a mind -blower to ABAPers who have got used to ABAP as an imperative programming language.

One of important concept in functional programming is Currying.

Currying intensively manipulates functions.

Lazy Loading, Singleton and Bridge design pattern in JavaScript and in ABAP

According to Wikipedia Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed. It can contribute to efficiency in the program’s operation if properly and appropriately used.

In this blog, I will use an example of SCN log on to illustrate its usage in JavaScript and how to simulate the implementation in ABAP.

Sunday, 2 July 2017

Singleton bypass Trap – ABAP and Java

Recently I meet with an issue using Spring which finally turns out that my bean is initialized multiple times although it is expected to be a singleton. As a result I look into the possible scenario that might bypass the expected singleton behavior.

This blog introduces two possible scenarios which will cause your singleton design fail to work as expected.

Saturday, 1 July 2017

Gate Way Service Creation Using The CDS Views With Parameters

How to create the Gate Way service using CDS Views with Parameters and Without Parameters:

Pre-requisite is to learn basics about the Core Data Services , Basic understanding about SADL Frame work.

Step 1: Create the CDS view in Eclipse or Hana Studio.

Here I am creating two CDS views in Hana Studio

Creating CDS View for the House Bank Details

Thursday, 29 June 2017

SAP HANA ABAP: SQLScript: Functions Part-1

The Goal of AMDP implementation is always to remove any additional logic required at the abap layer i.e. avoid loops, further joins, formatting or data conversions. To achieve this, we can leverage HANA SQL functions to ensure the that the data being returned from AMDP is complete and needs zero or a light touch while passing to the ABAP Layer.

Wednesday, 28 June 2017

BOPF Creation Using CDS Views & ODATA Publish

Creating the business object using the cds views to enable ODATA service enabled:

1.Root node creation for example : ZBO_MARA (Root node)

For the root node need to specify the annotation: @ObjectModel.modelCategory: #BUSINESS_OBJECT

Zbo_mara is the Root node and created the associations with zbo_marc and zekpo nodes

@ObjectModel.compositionRoot: true

Tuesday, 27 June 2017

Database Connections – Prepublished

This blog is a prepublication of that documentation.

Database Connections


An AS ABAP uses database connections to access databases. A database connection defines the address of the database system (database host), the database user, and hence the associated database schema that is accessed. The Open SQL and Native SQL statements of an ABAP program use a database connection of the current work process to access a database. By default, the standard connection is used to access the ABAP database schema of the standard AS ABAP database. By opening a secondary connection, it is also possible to access databases or database schemas other than the standard database. This makes possible a number of options, for example, data can be passed to and committed in other databases or in other database schemas. The secondary database does not need to be part of an AS ABAP here, but it does need to be supported by SAP. Connections called service connections can also be used to access the standard database.

How to create CDS view which supports navigation in OData service Part 5

Continues Part 4 How does annotation @OData.publish work

So far we have a working CDS view ready for us to create a UI5 application on top of it via Smart Template in WebIDE within just a couple of minutes. Once done, the UI5 application will display the data from our CDS view like below.

Saturday, 24 June 2017

How does annotation @OData.publish work Part 4

In part1 of this tutorial, the old way to create OData service on top of CDS view is introduced.

@OData.publish: true


Just add this annotation to your CDS view and the odata service is automatically created, no need for you to go to code SEGW any more.

Friday, 23 June 2017

How is view source in Eclipse converted to ABAP view in the backend Part 3

Continue What objects are automatically generated after you activate one CDS view Part 2.

Let’s review what we have learned so far. Through SQL trace and debugging, we have learned below:

1. When we click activate button in ABAP development tool ( I call it Eclipse now in this blog ), there are several corresponding ABAP objects generated and table entries inserted. Through debugging we know lots of related logic are implemented in package SDDL.

Wednesday, 21 June 2017

What objects are automatically generated after you activate one CDS view Part 2

Continues Part 1 My CDS view self study tutorial – Part 1 how to test odata service generated by CDS view

You paste the following source code for a simple CDS view into ABAP development studio and activate it:

@AbapCatalog.sqlViewName: 'zjerrySQL0208'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'test 233'
@ObjectModel: {
   createEnabled,
   deleteEnabled,
   updateEnabled

Tuesday, 20 June 2017

SAP Screen Personas for Web Dynpro ABAP – Cross Session Scripting

Introduction


With SAP Screen Personas there is now the option to add client-side scripting to existing Webdynpro for ABAP applications. For a first introduction to scripting please have a look at the Overview Blog of Matthias Heitmann.

With scripting it’s now possible to automate re-occurring or complex tasks. However there is a technical restriction: The script is always tied to the (technical) application. There is no possibility to define a script, which runs across different applications or even different browser windows. This heavily limits the applicability of scripting for automation.

Monday, 19 June 2017

A list of some “magic” tables and reports I collect in my daily work for ABAP development

During my daily work I get to know the existence of some magic tables and reports which can enable me to achieve some work more efficiently and conveniently. Now I shared them with you.

  • Magic tables

    • CUS_IMGACH – IMG Activities
Suppose I know the BAdI definition CRM_PRODIL_ADD_DATA and I would like to find the customizing path in SPRO where I can also manipulate it. Unfortunately the where used list in SE18 does not support to search BAdI definition by customizing activities.

Sunday, 18 June 2017

How to test odata service generated by CDS view Part 1

Prerequisite


I have created two simple CDS views. They are:

@AbapCatalog.sqlViewName: 'z20160310'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'consume view test '
@ObjectModel: {
  type: #CONSUMPTION,

Friday, 16 June 2017

Step by step process to upload and download document in webdynpro abap

This document will provide the step by step process from uploading a pdf document from presentation server to application server and save the document from application server to presentation server.

How to publish your GUI-based SAP List Viewer (ALV) report in ABAP Web Dynpro

In this blog I will explain how any GUI-based ALV report can be displayed quite easily in ABAP Web Dynpro (WDA). The development is based on two out-of-the-box ABAP-tools: Class CL_SALV_BS_RUNTIME_INFO and the List Viewer for Webdynpro. More information about this class can be found here and some excellent documentation for the List Viewer for Webdynpro can be found here.

Thursday, 15 June 2017

An small example to learn Garbage collection in Java and in ABAP

Both Java and ABAP can support automatic garbage collection. As an application developer the GC process are completely transparent for us and in our application code most of the time we should never call the GC API provided by Java or ABAP. Nevertheless it helps us to write more robust code with comparatively lower memory consumption if we have some basic understanding about the trigger point of Garbage collection.

Tuesday, 13 June 2017

Repository Information System for WebClient UI component context node and their attributes

Some key requirements:


1. I would like to know how many UI Component has used component set for example PROD_ALL defined in runtime repository.

SAP ABAP Development, SAP ABAP Tutorials and Materials

Monday, 12 June 2017

Test Seams and Test Injections simplify ABAP Unit Tests

Introduction


I will describe my experiences with ABAP Unit Tests and Test Seams. The techniques described here can be used for new code, but they are especially valuable while working with Legacy code.

Legacy Code is defined by Michael Feathers as Code without tests. Andrea Goulet defines Legacy Code as code without communication artifacts. This is a modern interpretation of the word. So in this definition a code that is new, can be called Legacy Code even by the developers who wrote the code. Just because they did not add the tests or communication artifacts they would have needed to maintain their own code properly.

Saturday, 10 June 2017

ADBC and JDBC

Recently during my self study on PostgreSQL I made some practice to connect PostgreSQL in Java programming using Java Database Connectivity – JDBC. In fact I found out that there are lots of commonality between these two technologies.

There is a demo program demo_adbc_query mentioned in SAP help to demonstrate the use of ADBC.

Thursday, 8 June 2017

Writing DCLs on Union Views in CDS – Part 1

Let us consider the following scenario:
  • There are 4 CDS views V1 , V2 , V3 and V4
  • There is another  CDS view V5 which is a union of views V1,V2,V3,V4 .
Now there is a DCL required to be defined on V5 which is a union view, which should display only authorized records from these 4 views V1,V2,V3 and V4.

When AND/OR condition is used between aspect pfcg_auth statements in a DCL, the requirement is not fulfilled because, when one of the four views pass through the authorization, it applies its result to rest all three views and similarly when any one of the view fails to pass through the authorization, even then it applies its result to rest all three views. So either all records get displayed or none get displayed because of AND/OR logic, which is not expected in the current scenario

Wednesday, 7 June 2017

Play around with JSONP in nodeJS server and ABAP server

In my blog Cross domain request in ABAP and Java with two workaround I introduce the step how to deal with Cross Domain issue using Cross-origin resource sharing ( CORS ) supported by almost all modern browsers.

And there is another alternative for cross domain issue, that is JSONP which can work on legacy browsers which predate CORS support.

Tuesday, 6 June 2017

SAP HANA ABAP: SQLScript Date/Time Functions

As we all know that in any reporting or data analysis system, the main objective is to convert the source data into the meaningful information which can be of business relevance. This is to facilitate the stake holders to take decisions effectively and efficiently.

If we break the above scenario to the HANA developer level, we need to have the knowledge on various functions available in SQLScript to develop a meaningful information for reporting and make our life easier as a developer.

Monday, 5 June 2017

SAP HANA ABAP: CDS/AMDP – The Real Picture

CDS and AMDP have been talk of the town since long time. SAP HANA Developers are trying their level best to try their hands on both of these artifacts. Not to mention they face a lot of challenges while achieving all their reporting requirements using these, which were being done at ABAP layer( SE38 ) previously

Challenges/Solutions:

1. In understanding what’s the difference between the performance of a simple select query which is written at the ABAP Layer and the same select query written at the DB layer using CDS or AMDP using SQL Script Code.

Friday, 2 June 2017

ABAP OO Event handling (register/unregister)

OO Events is very imported and handling them is very easy in ABAP.

We need handler method to register event

METHODS : handle_event_raised FOR EVENT event_raised OF lcl_event_raiser.

then we need to set this method as handler

SET HANDLER me->handle_event_raised FOR i_raiser.

Build an Cross Site Scripting example in Java and ABAP

In this blog, I just show how to build a simple XSS example in Java and then try to implement the same in ABAP as well.

I have a github repository where a simple Java Servlet is developed.

Simply clone it locally and run as Server via url: http://localhost:8080/jerrytest, and it will print out the user gent field of the current http request.

Thursday, 1 June 2017

The Prototype Design Pattern At Work

In this blog, see how the prototype design pattern is used for item cloning in an ABAP system.

Item Clone

In this example, we will work on an imaginary purchase requisition application where the user has to enter the vendor code (LIFNR), material number (MATNR), unit price (PREIS and WAERS), and quantity (MENGE and MEINS) into the GUI. We will want it to be possible to enter multiple line items.

Tuesday, 30 May 2017

Step by step to use jChartFX in BSP application

In my blog CRM One Order statistic tool I develop a small tool to print out the statistics of number of assigned line item for all business documents in the system.

The tool has the following three sections of output in SAPGUI.
This section means there are 1 order which has 5000 line items, 1 order has 2000 items, 1 order has 1998 items …

Friday, 26 May 2017

Replicate ABAP database table definition to PostgreSQL

Recently I am doing self-study on PostgreSQL which is a very popular object-relational and open source database.After I have played around with it a while I have great interest to replicate some of my CRM table to PostgreSQL and manipulate the table there for practice purpose.

The table in PostgreSQL could be created via command line or SQL script, the latter works almost exactly the same as what we do in HANA studio, which means a developer who has HANA studio development experience can pick up PostgreSQL very quickly.
Suppose I have to create a new table in PostgreSQL which has exactly the same fields as the table COMM_PRODUCT in CRM:

Export ABAP transparent table content to PostgreSQL table

Now ABAP table COMM_PRODUCT is successfully replicated to PostgreSQL:

SAP ABAP PostgreSQL, SAP ABAP Guide, SAP ABAB Tutorials and Materials

Wednesday, 24 May 2017

ABAP ICF handler and Java Servlet

This blog will not introduce how an ICF handler class in ABAP or a Servlet in Java are developed, but focus the way those instances of handler class or Servlet are spawned by Web Server.
Let’s first study the Servlet spawn behavior in Java.

Servlet in Java


According to Servlet specification, http request against a given url will be served by the same single instance of servlet.

For example, I have developed a simple Servlet which just returns “Hello world” as response. I map it with url starting with “/Hello”.

Tuesday, 23 May 2017

PO Service line item quantity exceed validation against PR quantity…

Scenario


Service PO creation / change scenario – Service Quantity increasing more than requested in PR.

If we are creating PO with respective to RFQ, we can increase the any service line item quantity whatever we wanted. There is no proper SAP validation exist in PO for the POs which are created with reference to RFQ. This scenario is related to only service POs.

Friday, 19 May 2017

Thursday, 18 May 2017

Interface In between SAP and MULESOFT

  • Introduction

This Document gives an in-detail approach to create an interface in between SAP and COUPA, with help of MULESOFT middleware application. It has step by step activites to be done in both SAP and MULESOFT applications. Technically Mulesoft integration is very stress-free comparatively with other middleware applications to interact with could base applications.

Use ABAP Channels to build a trace tool used in my daily work

In that blog some demo examples are explained. After going through those impressive tutorials and demos, have you ever thought about building some useful stuff for your daily work by leverage this powerful feature in ABAP?

As ABAPers we use various trace / monitor tools in our daily work, such as SAT and ST05. And in CRM, all business transactions are managed by so called One Order framework. This framework uses function module CRM_ORDER_MAINTAIN to create, update and delete the document.
Just look at this long list of importing parameters

Wednesday, 17 May 2017

Functional Programming – Try Reduce in JavaScript and in ABAP

In that blog I use the curry idea in the example below:

SAP ABAP Tutorials and Materials, SAP ABAP Certifications

output:

jerry-java

In this blog, as blog title, I will show another approach by leveraging built-in function reduce in JavaScript Array and Reduce keyword in ABAP to fulfill the same requirement.

Tuesday, 16 May 2017

A real case to use REDUCE to finish a task in daily work

Have you ever used REDUCE keyword to resolve a real task in your daily work? For me not till today.

There is a table CRM_JSTO which stores the object guid together with the status object name it uses.

SAP ABAP Tutorials, SAP ABAP Guide, SAP ABAP Syllabus

Friday, 12 May 2017

Locators in ABAP Open SQL

Recently I learned a new approach to access database table content without having to transport the column data into ABAP program using locator.

I make modifications on this sample. The modified one:

REPORT demo_db_locator.

DATA: otr_text_locator TYPE REF TO cl_abap_db_c_locator,
      length           TYPE i.

DATA: pattern  TYPE string VALUE 'ABAP',
      lv_index TYPE int4 VALUE 1.

Thursday, 11 May 2017

Merge table cells vertically in adobe table

One of the common requirements for complex table design in adobe forms.

Step 1: Create table.

SAP ABAP Tutorials and Materials, SAP ABAP Adoble

Simple Remote Query

Introduction


I thought that this way to handle data type could be also useful for reading specific database records defined on backend system database. Remote database records can be read by means of META_READ_TABLE and RFC_READ_TABLE standard function modules;  these modules are useful and powerful but for sure they are not developer-friendly because of its table parameters: options, fields and data. In details:

Tuesday, 9 May 2017

Cross domain request in ABAP and Java with two workaround

Cross Domain Request in ABAP


Create a new ICF node in tcode SICF, implement the following source code in its handler class.

SAP ABAP Guide, SAP ABAP Tutorials, SAP ABAP Certifications

Saturday, 6 May 2017

Virtual Fields in CRM Reporting Framework

Use Case


In one of our applications, we have a search over the 1Order documents.

It uses the tables:
  • CRMD_SRV_SUBJECT (Service Subject) and
  • CRMD_SRV_OSSET (Service Subject Reference Object).
However, we need to pass the following “Reasons” as search criteria.

Thursday, 4 May 2017

NoITAB – A Stack

Internal Tables


ABAP’s internal tables are dynamic data objects that allow to process large quantities of data with the same structure, thereby taking care of dynamic memory management. So they are good at storing database table data and this makes them ubiquitous.

There seems to be no alternative. Complex data structure are usually mapped to internal table to avoid additional effort to implement a special data structure that will probably have poor performance anyway.

Wednesday, 3 May 2017

Change log for Z-Table Maintenance (via SCDO)

Generally we don’t need table logging for custom table maintenance (SM30), but it is important and needed for some cases. All customizing tables are automatically recorded by default but if you use regular Application tables (master and transaction data), you’re about to get your hands dirty .)

SAP ABAP Tutorial, SAP ABAP Materials, ABAP Guide, ABAP Certifications
Sample Z-Table

Tuesday, 2 May 2017

Add documentation in Custom Program (.docs)

Introduction:


I am going to show, how we can add documentation in Custom program.

I have searched in SCN network too many times, to achieve this functionality but not get any clue, so i have decided once i will achieve this functionality in my program. I will write regarding this functionality, I know this is very small thing however i have spoiled one day for this.

Eight different sort algorithms implemented in ABAP

Some application developers think that it is enough to know SORT keyword and how to use sorted table in ABAP for their daily work without knowing how SORT is done internally. For me I can not say this assumption is wrong. I personal preference is to know something more thoroughly. We have learned various sort algorithms in the university, here I just list my implementation on some of them using ABAP for my personal study purpose.

For each sort algorithm I will create a static public class with a sort method which accepts an internal table with unsorted Integer and an output table which are sorted. For simplification reason the element in the internal table only consists of unsigned integers ( >= 0 )

Monday, 1 May 2017

Bitwise operation ( OR, AND, XOR ) on ABAP Integer

For training purpose I need to explain to my ABAP team colleagues about how bitwise operation on Integer in Java like below is done.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guide

Saturday, 29 April 2017

Adding UAN Number to PaySlip – Enhancing HINCEDTO Program

Employees Provident Fund Organisation, India (EPFO) has launched a Universal Account Number (UAN) to provide a number of facilities to its members through a single window. In SAP a new subtype 08 ( Universal Account Number ) has been created for Infotype 185 to store Universal Account number.

Basically we design payslip through HR form editor ( Tcode PE51 ) and we add tables, fields to HR Form classes (PE51_Checktab).

Thursday, 27 April 2017

String Template in ABAP, ES6, Angular and React

As an ABAP you probably be very familiar with String Template.

String Template in ABAP


A string template creates a string from literal text, embedded expressions, and control characters in a string expression. The most powerful feature I like is we can insert ABAP variable inside the template by wrapper variable with “{ }”, see one example below:

Wednesday, 26 April 2017

Tag(Marker) Interface in ABAP and Java

“Specific predefined global interface. By integrating the tag interface, classes or other interfaces stand out against the ABAP runtime environment. A tag interface generally does not contain its own interface components, but instead assigns a particular task to the integrating classes or interfaces and changes the way they are handled by the ABAP Compiler.“
And in fact this is not a specific concept of ABAP, but exists in many other language as well.

ABAP tag interface


One of the most famous tag interface in ABAP is if_serializable_object.

Tuesday, 25 April 2017

OOP Updates in ABAP 7.4 and ABAP 7.5

SAP introduced the concept of OO programming in ABAP in the year 2000. Since then, it’s been the recommended method of programming. Let’s describe the new features of ABAP that relate to OO programming.

1 Upcasting/Downcasting with CAST


In OO programming, a downcast is a process in which you turn a generic object, like a monster, into a more specific object, like a green monster. An upcast is the reverse. This functionality has been available in ABAP for a long time, but it gets a lot easier in 7.4.

Monday, 24 April 2017

Setup ESR connection between ABAP system and AEX (ERP to PO / SPROXY)

Check Transaction SPROXY on the ABAP system to ensure that ESR of PI/PO is connected.

If this is not given, you need the following setup steps:

1) Create 2 RFC destinations (Type G) on your ABAP System.

The name of the first on has no naming convention. This name will be used in sxmb_adm as URL.

Sunday, 23 April 2017

Various Proxy Design Pattern implementation variants in Java, ABAP and JavaScript

This blog gives an introduction about various proxy design pattern implementation variant in Java and ABAP.

Below paragraph is quoted directly from Wikipedia:

“A proxy, in its most general form, is a class functioning as an interface to something else. The proxy could interface to anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate. In short, a proxy is a wrapper or agent object that is being called by the client to access the real serving object behind the scenes. Use of the proxy can simply be forwarding to the real object, or can provide additional logic. In the proxy extra functionality can be provided, for example caching when operations on the real object are resource intensive, or checking preconditions before operations on the real object are invoked. For the client, usage of a proxy object is similar to using the real object, because both implement the same interface.“

Friday, 21 April 2017

Covariance in Java and simulation in ABAP

I am the trainer of one standard course “Programming Language Concept” within SAP and there is a set of concept Covariance and Contravariance, which has only built-in support by a subset of programming language like Java. For those ABAPers who don’t have chance to touch this concept in their daily work, I have built a small example to simulate how the concept works in ABAP as well for ease of understanding. The example explained in this example is just a prototype purely for training and education purpose.

Thursday, 20 April 2017

ABAP Call Monitor (SCMON) – Analyze usage of your code

Do you know that on average 60% of your custom code is in reality not executed in your productive landscape? Especially in SAP Business Suite migration projects like to SAP HANA or SAP S/4HANA such amounts of unused code result in huge adaptation efforts. Therefore SAP’s recommendation is to clean up your unused custom code before migration. But how can you identify the code that is not used?

The purpose of the ABAP Call Monitor (transaction SCMON) is to monitor the execution (usage) of ABAP code (function modules, method calls etc.) in your productive system. The advantage of the SCMON compared to the UPL (Usage Procedure Logging in SAP Solution Manager) is that using this tool you not only collect the usage data (how often a specific ABAP object was called), but also the information about the calling business process. Therefore as a result of the monitoring, you get a list of business transactions (callers) along with all ABAP objects that have been called within these business transactions including the number of calls.

Wednesday, 19 April 2017

Create dynamic proxy persistently in Java and ABAP

In my blog Implement CGLIB in ABAP I demonstrate how to create dynamical proxy class via CGLIB in Java and ABAP. The generated proxy class is actually a subclass which inherits the base class. Such class created by CGLIB is transient, which means the life time of generated class is only within the current session where it is created, which will not be persisted.

In this blog I will show how to create a globally persistent proxy class dynamically in Java and ABAP.

Tuesday, 18 April 2017

Simulate Mockito in ABAP

What is Mockito?

Mockito is a mocking framework, JAVA-based library that is used for effective unit testing of JAVA applications. In our unit test there are usually some dependency on other external service implementation for example network or database service. Usually in order to isolate our test code from these dependencies we have to create mock class against them. Mockito in Java can create transient mock class ( which is only available in current test session ) for us in a very easy way. See one example below:

Monday, 17 April 2017

Implement CGLIB in ABAP

What is CGLIB?

A Byte Code Generation Library which is high level API to generate and transform Java byte code. It is used in various scenarios such as AOP, testing, data access frameworks to generate dynamic proxy objects and intercept field access.

See one example in unit test.

In line 17, a new dynamic proxy class is generated as mock.
In line 19, we tell the proxy, “if get(0) is called on this mock class, then return mocked data “hello, world”.

Saturday, 15 April 2017

General properties of ABAP Classes / Interfaces

Every day you create or change ABAP class in class builder. When you activate your change, have you noticed a series of objects with several “=” in the middle part of each?

SAP ABAP Tutorials and Materials, SAP ABAP Guide, SAP ABAP Certifictions

Technically speaking, an ABAP class consists of several parts. In order to figure them out, I just create a simple class with the following source code: