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.