ABAP Debugging Tips and Tricks



Similar documents
Exposing RFC as Web Service and Consuming Web Service in Interactive Forms in ABAP

Deleting the User Personalization done on Enterprise Portal

ALE Settings, for Communication between a BW System and an SAP System

BW Performance Monitoring

SAP CRM Campaign Automation

Step by Step Guide for Language Translation Tool

How to Modify, Create and Delete Table Entries from SE16

Configuration of Enterprise Services using SICF and SOA Manager

Creating Web Service from Function Modules/BAPIs & Integrating with SAP Interactive Forms

Creation and Configuration of Business Partners in SAP CRM

Creating Transaction and Screen Variants

Web Dynpro ABAP: ALV and Table in Popup Window

SAP FI - Automatic Payment Program (Configuration and Run)

Step by Step Guide How to Copy Flat File from Other Application Server to BI and Load through Info Package

How to Create an ecatt?

Step by Step guide of Report-to- Report Interface in BW Reporting

Restricting Search Operators in any Search View

Step by Step Procedure to Block and Debug a CIF Queue Flowing from R/3 to APO System

Standard SAP Configuration of SMS through HTTP with Third Party SMS Gateway

Web Dynpro: Multiple ALV Grids and Layouts in ALV

SAP CRM Middleware Configurations

SAP CRM System 6.0/7.0. For more information, visit the Customer Relationship Management homepage

How to Integrate CRM 2007 WebClient UI with SAP NetWeaver Portal

Transfer of GL Master from Source SAP System to a Target SAP System through IDOCS

How to Assign Transport Request for Language Translation?

A Step-by-Step guide on SMTP Configuration and File to Mail Scenario Using Process Integration Scenario in PI 7.1

Creating Content Using SO10 Objects and Text Symbols

Quick Viewer: SAP Report Generating Tool

SAP BW - Excel Pivot Chart and Pivot Table report (Excel)

LSMW: Upload Master Data using Batch Input Recording

Salesforce Integration Using PI: How to Perform Query and Other DML Operations Using the Enterprise WSDL

Creating and Scheduling Publications for Dynamic Recipients on SAP Business Objects Enterprise

Understanding BEx Query Designer: Part-2 Structures, Selections and Formulas

Step by Step Procedure to Create Broadcasters, to Schedule and to Enhance of SAP- BI Queries from Query Designer

Salesforce.com Integration Using SAP PI: A Case Study

Adobe Document Service Configuration and Troubleshooting Guide

Deploying Crystal Reports on Top of a SAP BI Query

SAP CRM 7.0 E2C Setup: CRM via Toolset

EzyScript User Manual

Guidelines for Effective Data Migration

How to Implement the X.509 Certificate Based Single Sign-On Solution with SAP Netweaver Single Sign-On

How to Generate Stack Xml for Ehp4 and Above Upgrade

Deleting the Requests from the PSA and Change Log Tables in Business Intelligence

Understanding BW Non Cumulative Concept as Applicable in Inventory Management Data Model

Display Options in Transaction SE16

SOS SO S O n O lin n e lin e Bac Ba kup cku ck p u USER MANUAL

Order Split Usage in Production Orders

Tutorial - Creating Pop Up Window Using New Features in WebDynpro Java CE 7.1 Ehp1

Release Strategy Enhancement in Purchase Order

Create Automatic Mail Notification/ Alert for Process Chain Monitoring

SDN Contribution Beginners guide to CRM Interaction Center (IC) Winclient setup

Step by Step Procedures to Load Master Data (Attribute and Text) from FlatFile in BI 7.0

Configuring HTTPs Connection in SAP PI 7.10

How to Configure an Example SAP Cloud Applications Studio (PDI) Solution for SAP Cloud for Customer

Workflow Troubleshooting and Monitoring in SAP ECC 6.0

Understanding OLAP Processor and RSRT

CloudCall for Salesforce- Quick Start Guide. CloudCall for Act! CRM Quick Start Guide

Data Flow from LBWQ/SMQ1 to RSA7 in ECC and Delta Extraction in BI

Working with SAP BI 7.0 Data Transfer Process (DTP)

SAP CRM-BW Adapter an Overview

Configuration Guide. Remote Backups How-To Guide. Overview

SAP Workflow in Plain English

EVALUATION ONLY. WA2088 WebSphere Application Server 8.5 Administration on Windows. Student Labs. Web Age Solutions Inc.

Installing S500 Power Monitor Software and LabVIEW Run-time Engine

Message handling in SAP CRM Web UI

BI 7.0 and EP 7.0 Integration using Template Installer

Organizational Management- Organizational Structure Creation

Query OLAP Cache Optimization in SAP BW

Enabling Kerberos SSO in IBM Cognos Express on Windows Server 2008

Merge PDF files in ABAP

SAP Training System Access

ABAP for Functional Consultants

Sage 300 ERP Sage CRM 7.2 Integration Guide

Multi Level Purchase Order Release Strategy

Wakanda Studio Features

Virtual Office Remote Installation Guide

WebSphere Business Monitor

ABAP How To on SQL Trace Analysis

Different Types of Alerts for Process Chains. Table of Content

ABAP Proxy Interfacing

Process Controlled Workflow SRM 7.0 (Using BRF)

Direct Subcontracting Process (SAP SD & MM)

Converting and Exporting Data in XML Format

StreamServe Persuasion SP4 StreamServe Connect for SAP - Business Processes

Data Extraction and Retraction in BPC-BI

ivms-4200 Client Software Quick Start Guide

How To Install Cubase Patch Script On A Computer Or A Mouse Or Keyboard

Creating Bill of Materials with Winshuttle Transaction

Reverse Transport Mechanism in SAP BI

Extractor in R/3 and Delta Queue

Appendix 1 Install RightNow on your PC

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

How to Develop Programs for SAP Mobile RF

Table of Contents. Passing Data across Components through Component Controller between Two Value Nodes

Currency Conversion using Variables in SAP BI -Reporting

Table of Content. SAP Query creation and transport Procedure in ECC6

WA2262 Applied Data Science and Big Data Analytics Boot Camp for Business Analysts. Classroom Setup Guide. Web Age Solutions Inc.

Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1

PTC Integrity Eclipse and IBM Rational Development Platform Guide

Transcription:

Applies to: This article applies to all SAP ABAP based products; however the examples and screen shots are derived from ECC 6.0 system. For more information, visit the ABAP homepage. Summary This article gives a list of useful tips and tricks which will make debugging and coding easier. Author: Sai Santosh K Company: IBM India Pvt. Ltd. Created on: 6 th July 2009 Author Bio Sai Santosh is a Sr. Consultant working in IBM India Pvt. Ltd.; he has 6 years of SAP programming experience in various SAP solutions including SD, CRM Channel Management and HR. 2009 SAP AG 1

Table of Contents Debugging Tips and Tricks... 3 Finding event handlers... 3 Using Classic debugger... 3 Using New debugger... 4 Skip breakpoints... 4 Script recording and playback... 5 Check sorting before READ BINARY SEARCH... 6 Debug RFC calls... 6 Scenario 1: Calling a custom RFC FM... 6 Scenario 2: Calling a Standard RFC FM... 6 Debugging a Popup Window... 7 External breakpoints... 8 Saving breakpoints... 8 Update debugging... 9 VMC Java debugging... 9 Miscellaneous... 9 Related Content... 10 Disclaimer and Liability Notice... 11 2009 SAP AG 2

Debugging Tips and Tricks SAP provides a very powerful debugger, knowing all its features would make debugging fun and fast. Below I list out a few relatively hidden features of the debugger which I have personally found to be very helpful. I discovered these features either by exploration, came across them on the web or via colleagues. Finding event handlers Class methods can be registered as event handlers dynamically at run time, we might be interested in finding which method is registered as the event handler for an event, and SAP debugger provides a way to determine this. Using Classic debugger Double click on the variable to reach the Object/Class display section, now click on the Events button, this displays a list of events raised by the class and their corresponding handlers. 2009 SAP AG 3

Using New debugger Key in the reference variable in the Objects tab, now click on the Display Events button this displays a list of events raised by the class and on expanding the dropdown their corresponding handlers are shown. Skip breakpoints The new ABAP debugger gives an option to skip the first n occurrences of a breakpoint; this would be useful while debugging loops as we might want to skip the first n executions of the loop. Or the first n times a function module / subroutine is called. The below screen shot shows where we can enter the number of times the breakpoint should be skipped. Note: The breakpoint tool can be displayed either by adding it as new tool or navigating to the Break/Watchpoints tab. 2009 SAP AG 4

Script recording and playback While debugging complex programs, or testing a user exit, we generally have to perform a set of repetitive actions in the debugger before reaching the point in code we are actually interested in. The actions might be anything from launching a transaction to adding a few lines to an internal table. Any action we perform on the SAP GUI can be automated using Script Recording & Playback!! Just start the Script recorder by pressing the Customize Local Layout button (Alt + F12) and select Script Recording and Playback as shown below. Then hit the Record Script button and perform the set of actions as you would generally do them. The VB script gets saved in the default SAP work directory. You can play it back using the Playback script button and the entire set of operations is performed automatically!! Note: Scripting has to be enabled on your SAP system for this to work. Enabling scripting on a production system is NOT recommended. 2009 SAP AG 5

Check sorting before READ BINARY SEARCH Before delivering the code, we can use this option to make sure all internal tables are properly sorted before READ BINARY SEARCH is performed on them. If the table is not sorted a runtime error is generated. This ensures that the READ statement does not return incorrect results. Path (old debugger): Settings tab Debug RFC calls When an RFC function module is called it is usually not possible to debug the call, using the below techniques we can achieve the same. For this example we are calling an RFC enabled FM in ECC system from CRM system. Scenario 1: Calling a custom RFC FM STEP 1: Add an infinite loop in the remote custom Function Module (adding a DO. ENDDO. statement at the start of the FM would be enough). STEP 2: Execute your program in the CRM system. The execution stops at the RFC call, because of the infinite loop. STEP 3: Now login to the ECC system and go to transaction SM51 select the process which is executing the RFC and navigate to the menu: Program/Session->Program->Debugging this triggers the debugger session in a separate window. Scenario 2: Calling a Standard RFC FM When we are debugging a standard program we cannot add the infinite loop, hence we cannot go to SM51 and debug the work process. The RFC destination for the ECC system has a User specified, the RFC function module gets executed using this users credentials. Usually the basis team set up the RFC user as non Dialog user, this does not allow debugging. Contact your Basis team and get this changed to a dialog user enabling you to debug RFC function calls via the normal debugger. Note: User name configured in the RFC destination (transaction SM59) 2009 SAP AG 6

Note: User type for the RFC User (transaction SU01D) Debugging a Popup Window Sometimes we might want to start debugging from a popup window / information message, in this case we cannot type /h as the OK Code box is not available. Method 1: For this create a text file (say debugger.txt) on your desktop, and type the below lines into the file: [FUNCTION] Command=/H Title=Debugger Type=SystemCommand Now drag the file onto the popup window / information message and debugging is enabled! Method 2: From any SAP windows press the Customize Local Layout button (Alt + F12) and select Create Shortcut in the window that appears make the below changes and click Finish. A file is generated on your desktop or SAP workspace. Now drag the file onto the popup window / information message and debugging is enabled! 2009 SAP AG 7

External breakpoints In order to debug ABAP code which is called via Portal or any external system you can need to follow a two step approach. Firstly enter the user ID using which you would login to the portal / HTTP application, this can be done in on of the workbench development utilities (SE38, SE37, SE80, etc) choose Utilities Settings Debugging External Debugging. Secondly set external breakpoint at the required position in the ABAP code using the Set/Delete External Breakpoints button. Now when the external application is run the ABAP debugger opens in a separate window. More details can be found here. Saving breakpoints If you need to debug the same code again and have a set of breakpoints in place, you can create a Session to save the breakpoints and settings. Later this session can be loaded by any user, and the same set of breakpoints is restored. Path: New Debugger: Debugger -> Debugger Session -> Save Classic Debugger: Debugging -> Sessions Note: This example uses the classic debugger. 2009 SAP AG 8

Update debugging We might want to debug an Update Function module, but these do not run in the same user session as the debugger, hence they cannot be debugged directly. If we enable the Update debugging option then a separate debugging session opens after COMMIT WORK. This is useful in debugging update terminations. Path (classic debugger): Settings tab Path (new debugger): Use the menu path: Settings -> Display/Change Debugger Setting VMC Java debugging When writing requirement routines / formulas using Java in the IPC (Internet Pricing Configurator), we might have to debug the IPC code. To do this follow the below steps: 1. Set the parameter PRC_RFC in user parameters (SU3 transaction Parameters tab) 2. Now execute the relevant transaction / program the parameter PRC_RFC makes the execution stop before an IPC Pricing call is made. Press F5 to enter into the FM, now an information message appears which says that the Java debugging is ready and mentions the port on which the debugger is waiting. 3. In another session open the transaction VMCJDB, you will see the ports which are open for debugging. Double clicking on the port will attach the debugger to the debugging session. Detailed information can be found in SAP Help here. Miscellaneous There are lots of other features to explore such as: 1. Memory inspector. 2. Activatable checkpoints. 3. Performance Analysis. 4. Update management (SM13). 2009 SAP AG 9

Related Content Debugger functions Remote Function Calls IPC Debugging For more information, visit the ABAP homepage. 2009 SAP AG 10

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document. 2009 SAP AG 11