Skip to content
Jan 17 17

Mastering The Web Dynpro Debugging tool

by admin
Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest

ABAP

Jonathan Andre is a lead ABAP developer at IT Partners. Jon is also the President of Andre Technical Consulting LLC located out of Centreville, Virginia. Jon has over 5 years experience with SAP, with a concentration on ECC SD, MM, and IS-OIL modules. Jon’s focus has been in the areas of ABAP OOP and ABAP Web Dynpro. He can be reached at jon.andre@itpsap.com

This month’s article will be a study in the use of little-known tool available in the ABAP Debugger, the Web Dynpro Tool. The author is a co-worker and a friend.  I first worked with Jon during his tenure as a SAP ABAP developer on a DOD project. Jon is an extremely intelligent and motivated developer. His desire to take “ownership” of the task assigned and see it through to completion is evidence of his strong work ethic and commitment to excellence. I am sure you will find this month’s post informative and actionable in your current working environment.

Introduction to the Web Dynpro Debugger Tool

Web Dynpro can be a tricky technology to master. The complex interaction of views, windows, components and contexts can at times be difficult to understand and frustrating to work with. Debugging Web Dynpro applications with the standard debugger is often even more frustrating than developing for it. It requires navigating an endless number of web of objects, never quite knowing the best way to reach the next view or window you want to investigate.

Fortunately, SAP has provided a very useful Web Dynpro tool that can be used to debug Web Dynpro applications. This tool allows users to analyze their Web Dynpro applications real time in a structured format that resembles regular Web Dynpro development in SE80.

This post will focus on introducing the Web Dynpro tool using an example scenario that I often see in practice. Along the way, I’ll attempt to point out other useful features that should help readers become more comfortable with the Web Dynpro tool, and debugging Web Dynpro applications in general.

Preparing to Use the Web Dynpro Tool

In this example we have a view element (a TextView to be exact) that is displaying the incorrect information (not actually true, but let’s pretend). This TextView displays the current sequence number of a bill of material item, so I would like to determine when it is being populated and what business logic is being used to populate it. (see below)

Web Dynpro

Before I’m ready to begin using the Web Dynpro tool, I need some very basic information about the element and view I am investigating (I have explained where to find this information at the end of this article for those less familiar with Web Dynpros).

  1. Component of the view: /SAPPSSRM/WDC_DO_SUBCON
  2. View itself: V_SUBCON
  3. TextView ID: ZSUBCON_SEQUENCE_NO_EDITOR
  4. Context Node of Attribute: ZSUBCON_COMP
  5. Name of Node Attribute: SEQUENCE_NO
  6. This can all be determined by navigating to the view within the Web Dynpro Explorer in SE80.

For this particular case, I notice that there is a context binding for my TextView.  TextView ZSUBCON_SEQUENCE_NO_EDITOR is bound to ZSUBCON_COMP->SEQUENCE_NO, and so by tracking the value of the SEQUENCE_NO attribute, I will be able to determine the value of the TextView itself.

Web Dynpro

With this information in hand, I would also like to set a breakpoint with the WDDOMODIFY method of the V_SUBCON view controller to serve as a good starting point in the investigation. (see below)

Web Dynpro WDDOMODIFY

After we set our breakpoint, we are ready to execute Web Dynpro application and, hit our breakpoint. Once the code has stopped at this point and our debugger has opened, we can retrieve the Web Dynpro tool and begin the investigation.

read more…

Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest
Dec 20 16

Using Operating System Commands in ABAP

by admin
Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest

ABAPAnthony Cecchini is the President of Information Technology Partners (ITP), an SAP consulting company headquartered in Pennsylvania, with offices in Vienna, VA. ITP offers comprehensive planning, resource allocation, implementation, upgrade, and training assistance to companies. Anthony has over 20 years of experience in SAP business process analysis and SAP systems integration. His areas of expertise include SAP NetWeaver integration; ALE development; RFC, BAPI, IDoc, Dialog, and Web Dynpro development; and customized Workflow development. You can reach him at ajcecchini@itpsap.com.

Interacting with the HOST OS using ABAP

SAP does such a good job of abstracting its surrounding environment that we rarely take the features of its host operating system into account. The reality is that ABAP isn’t particularly good at solving certain problems. Rather than trying to reinvent the wheel with convoluted solutions, it’s best to solve these problems with the right tool. And sometimes, that tool is sitting on the operating system just waiting to be used.

For instance, at one of our current clients, I was working on their EDW team and needed to archive a file from a “process” directory to an “archive” directory after processing. I was surprised to see a relatively seasoned developer was using ABAP logic to achieve this. They were opening a new file in the “archive” directory, writing the contents, and closing the file and finally deleting the file from the “processing” directory. I changed the code to utilize the UNIX MOVE command. It was much less code and leveraged the existing UNIX Command.

In this blog, I want to show you how to interact with the host operating system of SAP NetWeaver AS ABAP. Specifically, I’ll introduce you to a framework that SAP provides as part of the standard to define external commands in a highly portable manner. After explaining the basics of this framework, we will look at an example of how to define and use the external commands.

Programming in ABAP with External Commands

Unlike other programming interfaces provided in ABAP, there is no built-in language statement that you can use to execute external commands. Instead, you must define these commands within the system so that they can be executed via standard API functions. Let’s begin by exploring how to maintain the external commands.

Maintaining External Commands

OS Host External commands are maintained using Transaction SM69. As you can see from the screen shot below, a lot of commands are delivered by SAP in every NetWeaver system; consequently, it’s always a good idea to see if SAP has already configured the command you’re looking to execute instead of creating a new command definition from scratch.

SM69 Maintain External Commands

OK, let’s take a deeper look. In order to show you how to configure your own custom external commands, let’s look at one delivered by SAP. The PING command is available on any SAP NetWeaver AS ABAP host. The PING command will determine whether an IP address is reachable on a network.

read more…

Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest
Nov 12 16

Running ABAP Traces in the New Debugger

by admin
Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest

ABAPAnthony Cecchini is the President of Information Technology Partners (ITP), an SAP consulting company headquartered in Pennsylvania. ITP offers comprehensive planning, resource allocation, implementation, upgrade, and training assistance to companies. Anthony has over 20 years of experience in SAP business process analysis and SAP systems integration. His areas of expertise include SAP NetWeaver integration; ALE development; RFC, BAPI, IDoc, Dialog, and Web Dynpro development; and customized Workflow development. You can reach him at ajcecchini@itpsap.com.

Running Traces in the ABAP Debugger

I was recently on a Skype learning session at a client where the topic was “Advanced Debugging Techniques”. The developer delivering the live training was showing examples of using Debugger Scripting. For those that need a refresher on what that is, check out our blog post, Fast, and Easy SAP ABAP Debugger Scripting.

While explaining how to execute a statement trace for an SAP ABAP Program using the delivered script “RSTPDA_SCRIPT_STATEMENT_TRACE”, one of our new ABAP developers asked if there was a way to trace SQL, similar to running ST05. And this Blog post was born…

The Answer is a resounding YES! Not only can you trace SQL, but you can trace buffers, RFC’s, Enqueues, and the Classic SE30 ABAP Trace.

Lets run an example using the ST05 Performace trace. If you need a refresher on what this trace is, and how to interpret it take a look at our blog post ABAP Database SQL Analysis Using The Performance Trace parts one and two. Please note you also require ECC SAP_ABA release 702.

Running ST05 in the ABAP Debugger

First, we need to be debugging something with SQL. So for this blog post I am going to use a liitle program ztony_demo_traces. Here is the code below:

REPORT ztony_demo_traces.

TABLES: vbak.

SELECT *
FROM vbak
INTO vbak.
ENDSELECT.

BREAK-POINT.

SELECT SINGLE *
FROM vbak
INTO vbak
WHERE vbeln = '0000004969'.

BREAK-POINT.

OK, let’s put a BREAK_POINT on the first select and run the program. The debugger should pop up and land you in the Standard Tab.

read more…

Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest
Oct 25 16

New Features in ABAP 7.4 – Enhanced Search Helps

by admin
Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest

ABAPAnthony Cecchini is the President of Information Technology Partners (ITP), an SAP consulting company headquartered in Pennsylvania. ITP offers comprehensive planning, resource allocation, implementation, upgrade, and training assistance to companies. Anthony has over 20 years of experience in SAP business process analysis and SAP systems integration. His areas of expertise include SAP NetWeaver integration; ALE development; RFC, BAPI, IDoc, Dialog, and Web Dynpro development; and customized Workflow development. You can reach him at ajcecchini@itpsap.com.

Search Helps in ABAP 7.4

At some point in your ABAP career, you probably will develop a search help for a screen field to aid the user in entering correct data. In the “Classic” days (Everything old in SAP is Classic) these were called Match Codes.This blog post is not a tutorial on how to create a search help, please see the SAP ABAP 7.4 help for that. Instead, I am going to introduce you to some new functionality that became available in ABAP 7.4.

First, let’s quickly review what a search help is…

A Search Help, a repository object of ABAP Dictionary, is used to display all the possible values for a field in the form of a list. This list is also known as a hit list. You can select the values that are to be entered in the fields from this hit list instead of manually entering the value, which is tedious and error prone.

There are several types of Search helps:
Elementary search helps: This type implements a search path for determining the possible entries.
Collective search helps: This type contains several elementary search helps. A collective search help, therefore, provides several alternative search paths for possible entries.
Append search helps: This type can be used to enhance collective search helps delivered by SAP with customer-specific search paths without requiring a modification.

An example of an elementary search help is shown below. You will see the Search Help Icon icon next to the field. You enter a pattern and hit this icon or F4 and the hit list is displayed for you to choose from. (see below).

 Search help Screen
Search Help Hit List
So you want to find a book on ABAP, so you head over to your favorite browser and using Google start typing in ABAP and instantly you see search results. (see below)
google
What if this “type ahead” (Predictive) or “search engine like” functionality could be used in our ABAP 7.4 Search helps?

read more…

Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest
Sep 19 16

New Features in ABAP 7.4 – Internal Tables

by admin
Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest

ABAPAnthony Cecchini is the President of Information Technology Partners (ITP), an SAP consulting company headquartered in Pennsylvania. ITP offers comprehensive planning, resource allocation, implementation, upgrade, and training assistance to companies. Anthony has over 20 years of experience in SAP business process analysis and SAP systems integration. His areas of expertise include SAP NetWeaver integration; ALE development; RFC, BAPI, IDoc, Dialog, and Web Dynpro development; and customized Workflow development. You can reach him at ajcecchini@itpsap.com.

Internal Tables in ABAP 7.4

Internal tables are a core staple of programming in ABAP. In this blog, you’ll learn about some new ABAP code constructs that relate to internal tables introduced in ABAP 7.2 and ABAP 7.4.

Using Secondary Keys to Access Internal Tables in ABAP 7.4

All of us who have been developing in ABAP at one time or another have created a custom index on a database table. Why do we create a custom index or z-index? For performance… we recognize that a table could be queried in more ways then just by the primary key, so we setup customer indexes that we believe will be used by the Database Optimizer when determining the access path and thus make the query performant.

OK, back to internal tables, traditionally, if you wanted to read an internal table in two different ways (e.g.,looking for a material by Material Number or by Reference Number), then you either had to keep sorting the table just before a read, or have two identical tables sorted differently. Well now as of ABAP 7.2 can declare secondary keys for internal tables. The SAP Help states that using the secondary key could increases read access performance significantly. But, on the other hand, secondary keys also incur additional administration costs due to memory consumption and run-time.

For example, lets create a secondary index into the internal table IT_MARA for the column BISMT , this is just like having a secondary Z- index on BISMT in the database table definition. The internal table definition could be as shown below.
DATA: IT_MARA TYPE HASHED TABLE OF mara 
              WITH UNIQUE KEY matnr 
              WITH NON-UNIQUE SORTED KEY sort_key COMPONENTS bismt.

The SAP Help states that statements that previously only accessed the primary key have been enhanced so that access to secondary keys is now possible. Check out the help for a full list, but we will look at the READ TABLE statement here.

The code would look something like the below…

READ TABLE it_mara INTO wa_mara WITH KEY sort_key COMPONENTS bismt = lv_bismt.

Even though IT_MARA is a HASHED table, it is also a SORTED table with the key BISMT, so when we go looking for the record using BISMT a BINARY SEARCH is automatically performed.

 

Declaring Table Work Areas in ABAP 7.4

In release ABAP 7.4, the syntax for reading into a work area and looping through a table can now leverage INLINE DECLARATIONS, we discussed these in a prior ABAP 7.4 blog.

We learned that from 7.4 onward you no longer need to do a DATA declaration for elementary data types. It is exactly the same for the work areas, which are of course structures. Take a gander at the code below…

READ TABLE lt_mara WITH KEY matnr = lv_matnr INTO DATA(ls_mara).
LOOP AT lt_mara INTO DATA(ls_mara).

In the same way that you no longer need DATA declarations for table work areas, you also no longer need FIELD-SYMBOL declarations for the (common) situations in which you want to change the data in the work area while looping through an internal table. In ABAP 7.4, if you want to use field symbols for the work area, then the syntax is shown below…

READ TABLE lt_mara WITH KEY matnr = lv_matnr ASSIGNING FIELD-SYMBOL().
LOOP AT lt_mara ASSIGNING FIELD-SYMBOL().

Table Expressions in ABAP 7.4

What if I told you that you would never have to use the statement READ TABLE again to get a line out of an internal table?

read more…

Recommend This Post! Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on Pinterest

Pin It on Pinterest

Share This