Debugging
Debugging
In SAP Tables, for some fields data we can see in different color (Green) as shown below.
Ex:
Table: VBAK
Fields: Sales Type, Sales Org, Division, Distribution Channel
Method 1:
Steps:
Put a Cursor on that field and Press F1 ( Fn + F1 )
Click on Technical Information
For Sales Org field in VBAK table, we are getting data from TVK0
If we go go TVK0 we can see the information about Sales Org
Method 2:
Go To SE11 – provide the table VBAK and find the filed VKORG
For example in VBAK we have Document Category (VBTYP ) field and for this value information
is maintained
GO TO SE11 – VBAK Table – SEARCH FOR VBTYP Filed and double click
on Data element
Requirement:-Suppose if we need to find, How many programs are using a custom table,
generally we use Where used button and find the list.
Output:-
Certainly! This solution can help many SAP consultants and fresher’s who are working where
used list for a table.
Purpose of this document:
This document will detail the process of debugging in SAP ABAP programming.
What is Debugging?
Debugging entails analyzing a program's flow to identify and rectify defects or
bugs. SAP distinguishes itself from other programming languages by involving the
analysis of various objects during the debugging process. Consequently, diverse
techniques are employed for debugging different object types.
Advantages of Debugging:
1) Pinpointing the exact cause of an issue
2) Efficient use of resources
3) Enhanced program logic
4) Improved code quality
5) Better collaboration among
teams 6)
Types of Debugging techniques:
1) Classic Debugging
2) New ABAP Debugger
Classical Debugger:
The predominant debugging method in SAP ABAP is the classic debugging technique,
widely employed by developers. This approach includes the placement of breakpoints
within the code, which halts program execution. This interruption provides developers
with the opportunity to scrutinize the values of variables, tables, and other data
objects.
External Breakpoint
Set outside the program code, often in the ABAP Editor or Debugger, with a
broader scope that can affect multiple users working on the same program.
https://www.linkedin.com/in/milan-victor-xavier-
1713b3192
Milan Victor – SAP
MILLU138@GMAIL.COM
ABAP/Webdynpro/CDS/ODATA/SAP UI5/FIORI
Place the cursor over the line and press the session breakpoint button.
UtilitiesSettingABAP EditorDebuggingUser ID
https://www.linkedin.com/in/milan-victor-xavier-
1713b3192
Milan Victor – SAP
MILLU138@GMAIL.COM
ABAP/Webdynpro/CDS/ODATA/SAP UI5/FIORI
https:// kedin.com/in/milan-victor-xavier-
www.lin 1713b3192
Milan Victor – SAP
MILLU138@GMAIL.COM
ABAP/Webdynpro/CDS/ODATA/SAP UI5/FIORI
Click over the error message and that will open the one window where we can see the
message number and class.
Message Number:
FR180 Message Class:
FR Message Number:
180
Then press the execute button. After that dynamic breakpoint will be triggered.
https://www.linkedin.com/in/milan-victor-xavier-
1713b3192
Milan Victor – SAP
MILLU138@GMAIL.COM
ABAP/Webdynpro/CDS/ODATA/SAP UI5/FIORI
Here we can see all possible ways to set the breakpoints. But here we are going to use
breakpoint at message option.
https://www.linkedin.com/in/milan-victor-xavier-
1713b3192
Milan Victor – SAP
MILLU138@GMAIL.COM
ABAP/Webdynpro/CDS/ODATA/SAP UI5/FIORI
Next, give the Message ID and Number in the correct fields and click the ok button to set the
breakpoint based on the message ID and number.
These are the steps to set the breakpoint based on the message, like the same we can set it for
Function module, class methods, perform, etc.
https://www.linkedin.com/in/milan-victor-xavier-
1713b3192
Milan Victor – SAP
MILLU138@GMAIL.COM
ABAP/Webdynpro/CDS/ODATA/SAP UI5/FIORI
Watch Points:
Watchpoints are breakpoints with a specific purpose – monitoring the values of variables or
expressions at runtime. While traditional breakpoints pause program execution to allow you to
inspect the code, watchpoints take it a step further by actively tracking the changes in variable
values. This can be immensely helpful in locating the source of a bug or understanding the flow
of your program.
Benefits of Watchpoints:
Dynamic Monitoring
Reduced Breakpoints
Efficient Issue Identification
Enhanced Debugging Experience
https://www.linkedin.com/in/milan-victor-xavier-
1713b3192
Milan Victor – SAP
MILLU138@GMAIL.COM
ABAP/Webdynpro/CDS/ODATA/SAP UI5/FIORI
Here you have to give the variable and Condition to set the watch point. I will set the
watchpoint for the currency field with a value of USD. That means if the currency field is USD
means then only watchpoint will be triggered.
After giving the variable name and condition we need to press the ‘OK’ button, then we will
receive the message below.
Then we have to press F8, whenever the currency is USD that time watchpoint will be triggered.
https://www.linkedin.com/in/milan-victor-xavier-
1713b3192
Milan Victor – SAP
MILLU138@GMAIL.COM
ABAP/Webdynpro/CDS/ODATA/SAP UI5/FIORI
1) Strategic placements
Place breakpoints where they matter the most. Focus on critical decision
points, loops, and areas where you suspect issues might arise.
3) Conditional Breakpoints
Enhance your debugging efficiency by setting conditions for breakpoints. Pause
execution only when specific criteria are met, reducing unnecessary
interruptions
5) Documentation
https://www.linkedin.com/in/milan-victor-xavier-
Consider adding comments or documentation explaining the purpose of
1713b3192
breakpoints. This can be especially helpful when revisiting code or when
collaborating with other developers
Conclusion:
Breakpoints in SAP ABAP are more than just tools for finding and fixing bugs;
they are your allies in understanding, optimizing, and mastering your code. By
strategically placing breakpoints, utilizing different types, and following best
practices, you can streamline your debugging process and become a more
proficient ABAP developer.
Remember, breakpoints are not just for troubleshooting errors; they are
essential for gaining deep insights into your code's execution. So, embrace
breakpoints, use them wisely, and let them guide you through the intricate paths
of SAP ABAP development. Happy coding and debugging.
Scenario 1: in our custom program we want to see the behavior of one particular variable we
will ask SAP to stop the program when it reaches this variable for achieve our goal we will use
watchpoints let’s see how
Go to se38 and open your program in debug mode
Create watchpoint
Put the name of variable you want to check and click on the green button
Scenario 2: For example, there are 386 entries in the internal table. Let's see how to analyse the
227th record, i.e. the PO number "4500001592".
Go to se38 and open your program in debug mode
Create watchpoint
Because we want to see a particular value, we will create a watchpoint but this time our
variable will be a 'work area' with the field corresponding to our value.
You will get this message
Our task now is to find out exactly which line of the ABAP code contains this error by
debugging.
Just drag and drop the text file you saved on your desktop or laptop onto the pop- up screens.
You will get this message
The program will stop exactly at the point where this error occurs.
b) Debugging of Enhancement
Before we talk about debugging enhancement let’s see first what is enhancement and what is
the purpose of enhancement?
Enhancements: enables customers/clients to add custom business functionality to sap
standard software without changing at all the sap standard functionality (which is supposed
to be unchanged).
But to better manage the enhancements in the program and also to be sure not to change
the standard functionality of the sap, the best thing to do is to copy a standard program and
make the enhancements you want.
Now let’s see how we can debugging enhancement
Two things you should keep in your mind before starting debugging
enhancement:
Icon snail :
And(the F5 key) button remember (The F5 key): Allows you
to execute the code line by line
Our task now is to find out exactly which line of the ABAP code contains this error by
debugging.
Open the program in debugging mode
Go to breakpoint at message
Enter the information contained in the error message
And execute
As you can see above the program ABAP
Debug ing: Analyzing Memory Usage of Your
Programs
Like SQL statements, one of the most-notorious causes of ABAP performance problems is internal tables with many entries. Large
internal tables consume massive amounts of memory and CPU, for example, during copy, sort, or search operations.
You can use the ABAP debugger to create an overview of all internal tables of a program. The ABAP debugger is a tool for
performing functional troubleshooting in programs. You can find more detailed descriptions of the debugger in SAP literature under
ABAP programming. Youʼll find information on main memory usage both in the classic and the new debugger. You can set the
debugger in the ABAP Editor (Transaction SE38) via Utilities > Settings > Debugging.
Performance analysis using the ABAP debugger isnʼt a standard procedure and is best performed by an ABAP developer.
Rules When Debugging
Take the following advice into account when working with the ABAP debugger. During the debugging process, the ABAP
program may terminate and display the error message Invalid interruption of a database selection, or the system may
automatically trigger a database commit.
In either case, an SAP œṙ ḅ ḙǜǀ ḵĮ ṎḙẤṙ Ḃť ṙ ẃḮ ᾨœĮ ť ᾩhas been interrupted, and this may lead to
inconsistencies in the application tables. Therefore, you should only debug on a test system or in the presence of someone
who is very familiar with the program being analyzed and who can manually correct inconsistencies in the database tables if
necessary. See “Debugging Programs in the Production Client” in SAP Online Help for the ABAP debugger.
. Start the program to be analyzed. Then open a second session. Here you can monitor the program to be analyzed in the
work process overview (Transaction SM50). Enter the debugger from the work process overview by selecting the
Debugging function. By using the debugger several times in succession, you can identify the parts of the program that
cause high CPU consumption. Often, these sections consist of LOOP ... ENDLOOP statements that affect large internal
tables.
. To display the current memory requirements (in the “classic” debugger), select Goto > Other Screens > Memory
Use.
. Check for cases of unnecessary memory consumption that may have been caused by a nonoptimal program or inefficient
use of a program. As a guideline, bear in mind that a program being used by several users in dialog mode should not
allocate more than 100MB.
. As of SAP NetWeaver AS ABAP 6.20, you can use the classic debugger to create a list of program objects located in the
memory by selecting Goto > Status Display > Memory Use. Under Memory Consumption, the Ranking Lists tab contains
a list of objects and their memory consumption.
In SAP NetWeaver AS ABAP versions 4.6 und 6.10, you can obtain a memory consumption list by choosing Goto > System
> System Areas. Enter “ITAB-TOP25” in the Area field. This way, youʼll obtain a list of the 25 largest internal tables.
5. In the “new” debugger, you first display the memory analysis tool by clicking the button for the new tool and then
selecting Memory Analysis from the tools on offer in the Memory Management folder. The initial screen then displays
how much memory is allocated or used by the analyzed internal session. Click the Memory Objects button to go to the
list of the largest memory objects, which can be the internal tables, objects, anonymous data objects, or strings.
Memory Extracts
Moreover, you can create and then analyze a memory extract, that is, an overview of the objects that occupy memory space. You
can create a memory extract in any transaction by selecting System > Utilities > Memory Analysis> Create Memory Extract or
simply enter function code “/HMUSA”. The third option is to create a memory extract from program coding. Refer to SAP Help
for a description of the system class CL_ABAP_MEMORY_UTILITIES.
To evaluate the memory extract, start the Memory Inspector by selecting System _ Utilities > Memory Analysis > Compare
Memory Extracts in any transaction or via Transaction S_MEMORY_INSPECTOR. The Memory Inspector lists all memory extracts
in the upper part of the screen. In the lower part of the screen, you can find details about the individual memory extract.
Here, a distinction is made among the object types, programs, classes, dynamic memory request of a class, table bodies,
strings, and types of anonymous data objects. Youʼre provided with different ranking lists, according to which you can sort
the objects. For each memory object, youʼre provided with the values of bound allocated, bound used, referenced allocated,
and referenced used memories. You can find a detailed description of the ranking lists and the displayed values in SAP Help.
Memory Inspector
The Memory Inspector is particularly useful for examining transactions over a long period of time, as is the case in a customer
interaction center. Here, users frequently enter a transaction at the beginning of their workday and exit it when they go home.
In these “long-term” transactions, data often remains, and therefore memory consumption continuously increases.
The figure below shows an example of a memory extract. The dominator tree shows the hierarchical program structure
and the memory used by the program parts. With a size of 494MB, table LT_MEM is conspicuous. The next largest
object is the CL_GUI_ALV_GRID class with a size of 250 KB. Below this class, 130 KB are used by table MT_ATA.
Conclusion
In order to find potential performance bottlenecks, itʼs important to take a look at historical culprits such as SQL
and ABAP code. With tools such as the ABAP debugger and Memory Inspector, analyzing the memory usage in
your program becomes quite easy.
What is debugging?
Debugging is a vital aspect of software development as it involves employing techniques to
locate, rectify, and resolve errors. This process enables developers to navigate through their
code, examine variable values, and pinpoint the underlying cause of issues.
Debugging Technique/Modes
Start the ABAP Debugger: There are multiple ways to start the ABAP Debugger, depending on the
scenario:
1. Transaction Code: Enter the transaction code "/h” in the Search bar and press Enter. This
will activate the debugger for the current session.
After entering ‘/h’, press enter and the below message will be displayed.
Upon execution, the commencement of debugging triggers the display of the subsequent window
Commonly used debug keys:
F5: When we press F5 in debugging, you will go to the next step means your program
control goes to the next line.
F6: When you press F6 in debugging, it will execute the module without going into it. F6 works
for performs (subroutines), Function modules, Class methods, etc.
F7: When you press F7 in debugging, it will complete the current module/program in a single
step.
F8: When you press F8 in debugging, control will go to the next breakpoint if any, or completes
the program execution.
After displaying the above window, it is essential to establish a breakpoint before proceeding
to it. Prior to delving into the breakpoint concept, it is crucial to address the term 'BREAK-
POINT'.
Entering the name of the internal table/variable directly at the bottom of the window
allows for the immediate display of its values upon pressing enter.
The internal tables are displayed as strings as shown above it_ekpo. If one wants to see it as
fields, then double click on the internal table name in the below window then the internal table
is displayed as fields as below:
Once the program executes all breakpoints, pressing F8 will cause the execution to pause,
simultaneously deactivating the debugger and providing the desired output.
Co In concluding a blog post on debugging, it is crucial to
highlight the importance of debugging in the software
ncl
development process.
usi
Furthermore, it should be emphasized that debugging
on: can effectively save time and resources by identifying
and resolving issues early in the development cycle.
1. Difference between Standard and Customized Objects?
Standard Objects: are the objects which are provided by SAP itself, and these are non-
changeable objects. if we want to change then we require the Access Key.
C2
General
2. What is a Client?
Client is a 3-digit unique number which is used to identify the Development, Quality, and
Production
systems. And the Range is from ‘000’ to ‘999’
As part of this Bar, we have Command Field where we enter the Transaction Code.
Title Bar:
Status Bar:
6. Which tool is used to develop the Executable Programs?
8. What is a Package?
Package is like a container which is used to transport all the developed objects from one
system to another system. The Transaction is for creating package is SE80 (Object
Navigator)
NOTE: To Transport any objects, then that object should be in ACTIVE STATUS
In SAP ABAP, every statement must end with Period “ . ” , otherwise we will get this syntax
error.
11 What is Variable?
Variable is User Defined object which is used to store the
To COMMENT multiple lines, then select the block of line and use CTRL + <
To UNCOMMENT multiple lines, then select the block of line and use CTRL + >
If we want to comment from the middle of the line then use “ (Double Quotes symbol)
F3
Execute – F8 (Direct Processing on the Application Bar )
16. Reason for below Syntax Error?
The Reason for this syntax error is ABAP is SPACE SENSITIVE so we should maintain at
least one space between operator and values.
V_X=10. "Syntax Error
V_X = 10. "No Syntax Error
WRITE: / V_Z.
o If you do not have one, click Create Request, and provide a description
for it.
<!--Screenshot link example-->
2. Click Continue to complete the process.
Step 7: Check the Created Package
1. The package will now be visible in the Object Navigator under the Package
section.
2. You can now use this package to store your development objects (programs,
function modules, classes, etc.).
What is the purpose of TOC?
Using TR we can transport or move all changes/ Customize setting from DEV to QA to
Production System.
TR Naming Convention:
SID<K>90003
Ex: If TR DEVK90003 generated in development system then as per naming convention Here SID
is DEV
we use this customizing request if not using ABAP Logic during changes in
system.
How to Release TR
T code: SE01
If you know TR number then go to Display tab -> Put TR No. -> Click on Display Push Button.
1. Select Sub TR EH7K900456 --> Click on truck Icon Button so that Sub TR
will be release.
2. Again Select Main EH7K900455 --> TR Click on Truck Icon Button so that
Main TR will be release Note: System not allow you release first MAIN TR
VISHAL JAIN
Once you Release TR then Right Check mark will be visible next to TR
VISHAL JAIN
How To Revert SAP Released Transport Request
To Unreleased Status
3. In the Selection screen Enter Main TR number which you want to change
status.
VISHAL JAIN
4. Select TR and Click on binoculars
VISHAL JAIN
System Allow you change status From "R to D'" & SAVE it
VISHAL JAIN
For Information Purpose ;
Types of TR Status
Request
Type of Request
Varun N
ST01 = System Trace
1) Access the ST01 Transaction: -
Go to the SAP Easy access screen.
Enter the transaction code ST01 in the command field and press
Enter.
Varun N
Varun N
3) Set Trace Options (Optional): -
You can set filters in the down what all are the trace records,
such as:
User IDs = > Specify particular users to trace.
Transaction Codes = > Focus on specific transactions.
Programs = > Monitor specific programs.
Varun N
return to the ST01 screen, and click "Trace off" to stop
recording.
7) Display and Analyze Trace Results: -
Varun N
Click on "Analysis" in ST01 screen and specify the user,
date, and time to view the recorded data. Then execute
to see the Trace.
Varun N
queries, or other system problems.
Varun N
Based on that the security consultants give the
authorization, if fails by identify by using the return
codes in red color.
Note = > It is important to deactivate the trace when not in use.
Return Codes
RC = > 0 --- Authorization is successful.
RC = > 4 --- User has required authorization object, but
different
authorization Values.
RC = > 8 --- User does not have required authorization
values in the user buffer.
RC = > 12 --- User does not have access to authorization
object.
Varun N
Note = > ST01 trace should be applied in the local server
only. Hence before applying ST01 trace, ensure that user and
you are in the same system.
AL08 = > Users in each server.
Varun N
STAUTHTRACE
Exclusive authorization Trace.
Trace is applied across all application servers.
Note = > This T code is available in the updated version of SAP.
Perform Activities:
Varun N
o Inform the user to perform the actions that are causing
access issues, such as trying to execute a transaction
they cannot access.
Varun N
Stop the Trace:
o Once the activities are completed, go back to the
STAUTHTRACE screen, and click "Deactivate Trace".
Varun N
PFU
D
Mass User Comparison
Varun N
Then, click on execute.
4) Cleanups
It ensures that expired roles are removed from SU01, record of users.
Program related to PFUD = > PFCG_TIME_DEPENDENCY SM01
= > Lock T code
Reports are custom programs or scripts designed to extract and display data from the SAP system in a specified
format. They are used to provide insights and analytics on various business processes.
Types of Reports:
Examples:
Sales analysis report Inventory stock report Financial
statement report
Varun N
2.INTERFACES
Interfaces are mechanisms that enable data exchange between SAP and external systems. They ensure seamless
integration and communication across different platforms and applications.
Types of Interfaces:
Conversions refer to the data migration processes required when transferring data from legacy systems to SAP. This
step is critical during SAP implementation projects.
Examples:
Varun N
Migrating customer master data from a legacy CRM system Transferring historical sales data to SAP
Enhancements are modifications made to standard SAP functionality to meet specific business requirements
without affecting the integrity of the original SAP code. These modifications are usually implemented in a way that
preserves the ability to upgrade the SAP system.
Types of Enhancements:
User Exits: Predefined places in standard SAP programs where custom code can be inserted.
Customer Exits: Similar to user exits but typically more extensive and customizable.
Examples:
Custom validations during sales order creation Enhancing the functionality of standard reports
Adding custom fields to standard SAP screens
Varun N
5. FORMS
Forms are used to generate formatted documents from SAP data. These documents can be printed, emailed, or
faxed and are typically used for business transactions.
Examples:
Invoice forms
Purchase order forms
Delivery notes
Varun N
6. WORKFLOWS
Workflows automate business processes in SAP by defining a sequence of steps that involve multiple users or
systems. They ensure that tasks are completed in a predefined order and help in managing approvals and
notifications.
Components of a Workflow:
Tasks: Individual units of work assigned to users or systems.
Examples:
Purchase requisition approval workflow Leave request approval
workflow Invoice processing workflow
Varun N
1. Introduction to ABAP Editor
▪ ABAP editor is a tool for ABAP coding.
▪ It is one of the main tools of the ABAP workbench.
▪ The transaction code for ABAP editor is SE38.
▪ Any customized program must start with Z or
Y as first alphabet.
▪ A statement is a sequence of words that
ends with a period.
▪ In the ABAP editor, the keywords appear in blue color.
Varun N
▪ Convert uppercase/lowercase
4.Comments
▪ A comment is an explanation that is added to
the source code of a program to help the person
reading the program to understand it.
▪ Comments are ignored when the program is
generated by the ABAP compiler.
▪ The * character at the start of a program line
indicates that the entire line is a comment.
▪ The " character, which can be entered at any
position in the line, indicates that the remaining
content in the line is a comment.
▪ Shortcut to comment out lines - Ctrl +, ( , )
▪ Shortcut to uncomment lines - Ctrl +. ( . )
5.Data Types
▪ Data types are templates for creating data objects.
▪ A data type defines the technical attributes
of data objects.
▪ Data types do not use any memory space.
▪ Data types can be defined independently in
the ABAP program or in ABAP dictionary.
Varun N
▪ Data Objects
▪ A data object is an instance of a data type.
▪ A data object holds the contents or data.
▪ It occupies the memory space based upon the
data type specified.
▪ Example - DATA lv_empid(20) TYPE n.
lv_empid = 10.
Varun N
There are three categories of data types.
Elementary Types
Varun N
▪ Variable length data types - String , Xstring.
▪ Complex Data Types
▪ There is no pre-defined complex data type in ABAP.
▪ They are the combination of elementary data types.
▪ There are 2 types of complex data types.
▪ Structure type
▪ Table type
▪ Reference Data Types
▪ There is no pre-defined reference data type.
▪ It describes data objects that contain references
to other objects.
▪ They are of 2 types of reference data type.
▪ Data reference
▪ Object reference
▪ Example : DATA lo_object TYPE REF TO zclass.
▪ In the above syntax - DATA = keyword ,
lo_object = name of data object, TYPE REF TO =
keyword , zclass = name of already existing
class.
▪ Types of Data Objects
The Data objects are of 2 types.
Varun N
▪ Literals (Unnamed Data Objects)
▪ Literals don’t have any name that’s why they are
called as unnamed data objects.
▪ They are fully defined by their value.
▪ There are 2 types of literals.
▪ Numeric literals - Numeric literals have
sequence of numbers. Examples - 123 , -
4567 etc.
▪ Character literals - Character literals are
sequences of alphanumeric characters in
single quotation marks. Examples - ‘Test 123’
, ‘SAP ABAP’ etc.
▪ Named Data Objects
▪ Data objects that have a name are called as
named data objects.
▪ The various types of named data objects are as follows :
▪ Variables
▪ Constants
▪ Text symbols
▪ Variables
▪ Variables are data objects whose contents
can be changed.
▪ Variables are declared using the DATA, CLASS-
DATA, STATICS, PARAMETERS, SELECT-OPTIONS,
and RANGES
keyword.
Varun N
▪ Example
Varun N
DATA lv_empid(20) TYPE n. lv_empid = 10.
lv_empid = 20.
Constants
▪ Text Symbols
▪ A text symbol is a data object that is not
declared in the program itself.
▪ It is defined as a part of the text elements of the program.
▪ Character and Numeric Data Types
▪ The C(character) , N(numeric), D(date), T(time)
are considered as character(non-numeric)
data types.
▪ The I(Integer) , P(packed decimal), F(floating point)
are considered as numeric data types.
Write Statement
Varun N
DATA: number TYPE i VALUE 1,
name(25) TYPE c VALUE 'Leena'.
Conditional Statements
Varun N
▪ Multiple statements blocks are there, depends
upon the condition one block executes.
▪ If none of the If and elseif conditions are
satisfied, it goes to else part.
CASE Statement
▪ It is a conditional statement.
▪ Every case statement ends with endcase.
▪ Multiple statements blocks are there, depends
upon the condition one block executes.
▪ If none of the conditions are satisfied, it goes
to others part.
Varun N
Difference between Case C IF
Varun N
▪ Do loop is called as a unconditional loop.
▪ Every do loop ends with enddo.
▪ Syntax: Do <n> TIMES.
<statement block>. ENDDO.
While Loop
Varun N
▪ SY-SUBRC - System variable for return code
(successful = 0, not successful = other than 0).
SY-TABIX - It returns the current line index inside a loop.
Varun N
DATA: lv_1(10) type c VALUE 'NEC',
lv_2(10) type c VALUE 'Software',
lv_3(10) type c VALUE 'Solutions',
Split
Varun N
lv_out type string.
Condense
- Condense No-gaps
▪ To remove the entire spaces the addition no-
gaps is used with condense.
▪ Syntax : CONDENSE <c> NO-GAPS.
▪ In the above syntax : CONDENSE = keyword ,
<c> = string which we want to condense , NO-
GAPS = keyword.
Varun N
DATA : lv_5 type string VALUE ' NEC Soft
ware Solutions '.
CONDENSE lv_5 NO-GAPS. WRITE
lv_5.
output:- NECSoftwareSolutions
Strlen
Find
Varun N
FIND 'NEC' IN lv_5.
IF sy-subrc = 0. WRITE 'Found'.
else.
WRITE 'Not Found'.
ENDIF.
Output: - Found
Translate
Varun N
▪ We can translate a text based upon specific pattern also.
▪ Syntax : TRANSLATE <string> USING <pattern> .
▪ In the above syntax : TRANSLATE = keyword ,
<string> = the string which needs to be
converted , USING = keyword, pattern =
contains letter pairs.
DATA : lv_5 type string VALUE 'nEC software
company',
lv_pattern(10) type c VALUE 'nNsScC'.
Shift
Varun N
WRITE : / 'Left - ', lv_1.
Right - 012345
Circular - 4567890123
Substring Processing
Varun N
DATA : lv_value(30) type c VALUE '91-040- 6789990004',
lv_county(2) type c,
lv_city(3) type c,
lv_number(10) type c.
lv_county = lv_value+0(2).
WRITE : /'The Country Code - ' , lv_county.
lv_city = lv_value+3(3).
WRITE : / 'The City Code - ', lv_city.
lv_number = lv_value+7(10).
WRITE : / 'The Phone Number - ', lv_number.
Varun N
The various string comparison operators are as follows: CO (contains only)
IF lv_1 co lv_2.
WRITE : 'TRUE' , Sy-fdpos.
else.
WRITE : 'FALSE' , Sy-fdpos. ENDIF.
Output :- TRUE 20
Varun N
IF lv_1 CN lv_2.
WRITE : 'TRUE' , Sy-fdpos.
else.
WRITE : 'FALSE' , Sy-fdpos. ENDIF.
Output:- FALSE 20
CA (contains any)
DATA : lv_1(20) TYPE c VALUE 'Sathi@1234',
lv_2(20) TYPE c VALUE '0123456789'.
IF lv_1 CA lv_2.
WRITE : sy-fdpos.
ELSE.
WRITE : sy-fdpos.
ENDIF.
Output:- 6
NA (contains not any)
Varun N
CS(contains string)
ATA : lv1(30) TYPE c VALUE 'Sathish Derangula',
lv2(20) TYPE c VALUE 'Sathish'.
IF lv1 CS lv2.
WRITE : 'True' , sy-fdpos. ELSE.
WRITE : 'False', sy-fdpos. ENDIF.
Output :- TRUE 0
NS(contains no string)
IF lv1 NS lv2.
WRITE : 'True' , sy-fdpos. ELSE.
WRITE : 'False', sy-fdpos. ENDIF.
Output :- TRUE 30
CP (contains pattern)
Varun N
DATA : lv1(30) TYPE c VALUE 'Sathish Derangula',
lv2(20) TYPE c VALUE '*Dera*'.
IF lv1 CP lv2.
WRITE : 'True' , sy-fdpos. ELSE.
WRITE : 'False', sy-fdpos. ENDIF.
Output :- TRUE 8
NP(contains no pattern)
IF lv1 NP lv2.
WRITE : 'True' , sy-fdpos. ELSE.
WRITE : 'False', sy-fdpos. ENDIF.
Output :- TRUE 30
Varun N
▪ Internal Tables
▪ Internal table is a temporary storage of
data on application layer.
▪ Internal table stores any number of records at run time.
▪ A very important use of internal tables is for
storing and formatting data from a database
table within a program.
▪ Work Area in Internal Tables
▪ Work area is also a temporary storage of
data on application layer.
▪ Work area are single rows of data.
It is used to process the data in an internal table, one line at a time. Internal Table Operations
1. Append It is used to insert the data at the last of the internal table.
SYNTAX:- APPEND ls_emp to lt_emp.
2. Loop It is used to read the records one by one from the internal
table.
SYNTAX:-LOOP AT lt_emp INTO ls_emp.
ENDLOOP.
Varun N
SYNTAX:-
MODIFY lt_emp FROM ls_emp TRANSPORTING emp_na me.
6. Read table It is used to read the first matching record from the
internal table.
SYNTAX:-
READ TABLE lt_emp INTO ls_emp WITH KEY emp_id
= 9.
Varun N
9.Collect - It is used to make sum of numeric field values based
upon unique character (non-numeric) field values. The C(character)
, N(numeric), D(date), T(time) are considered as character(non- numeric) data types. The I(Integer) ,
P(packed
Varun N
Append Inserts the record at the last of the internal table whereas Insert inserts the record at
anywhere in the internal table.
Varun N
C. Hashed internal table
Hashing - It is a technique which directly returns the address of the record based upon the
search key without using the index.
Varun N
Varun N
DATABASE OPERATIONS
Database operations deal with the database tables. The various database operations are as
follows:
Selection Screen
Parameters
Varun N
▪ PARAMETERS <p> ...... DEFAULT <f> ......
▪ PARAMETERS <p> ...... OBLIGATORY ......
▪ PARAMETERS <p> ...... AS CHECKBOX ......
▪ PARAMETERS <p> ...... RADIOBUTTON GROUP <radi>......
▪ Select-Options
▪ Select-options are used to pass a range of inputs.
▪ The various Select-options variations are as
follows: SELECT-OPTIONS <seltab> FOR <f> ...
DEFAULT <g> [TO
<h>]
▪ Sign - I/E(include/exclude)
▪ Option - Relational operator (EQ, BT, LT etc.)
▪ Low - Low value
▪ High - High value
Varun N
Selection Screen Block
SELECTION-
SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT
-001.
Varun N
SELECTION-SCREEN : END OF LINE.
Varun N
ABAP Learning:
* Output
**********************************************************************
variable = '19891109'.
Varun N
Data Object:
* Example 3: Constants
**********************************************************************
Varun N
out->write( `c_text (TYPE STRING)` ).
out->write( c_text ).
out->write( '---------' ).
* Example 4: Literals
**********************************************************************
"uncomment this line to see syntax error (no number literal with digits)
* out->write( 12345.67 ).
Varun N
Arithmetic Calculations:
* Declarations
**********************************************************************
* Calculations
**********************************************************************
" comment/uncomment these lines for different calculations
result = 2 + 3.
* result = 2 - 3.
* result = 2 * 3.
* result = 2 / 3.
*
* result = sqrt( 2 ).
* result = ipow( base = 2 exp = 3 ).
*
* result = ( 8 * 7 - 6 ) / ( 5 + 4 ).
* result = 8 * 7 - 6 / 5 + 4.
* Output
**********************************************************************
out->write( result ).
Varun N
Varun N
String Processing:
METHOD if_oo_adt_classrun~main.
* Declarations
**********************************************************************
TYPES t_amount TYPE p LENGTH 8 DECIMALS 2.
* String Templates
**********************************************************************
* Format Options
**********************************************************************
"Date
* DATA(text) = |Raw Date: { the_date }|.
* DATA(text) = |ISO Date: { the_date Date = ISO }|.
* DATA(text) = |USER Date:{ the_date Date = USER }|.
"Number
* DATA(text) = |Raw Number { my_number }|.
* DATA(text) = |User Format{ my_number NUMBER = USER }|.
Varun N
* DATA(text) = |Sign Right { my_number SIGN = RIGHT }|.
* DATA(text) = |Scientific { my_number STYLE = SCIENTIFIC }|.
* Output
**********************************************************************
out->write( text ).
METHOD if_oo_adt_classrun~main.
* Declarations
**************************
* Input Values
**************************
number1 = -8.
number2 = 3.
* Calculation
**************************
* Output
**************************
out->write( output ).
ENDMETHOD.
Varun N
Varun N
Conditional Branching:
* Declarations
**********************************************************************
out->write( `--------------------------------` ).
out->write( `Example 1: Simple IF ... ENDIF.` ).
out->write( `-------------------------------` ).
IF c_number = 0.
out->write( `The value of C_NUMBER equals zero` ).
ELSE.
out->write( `The value of C_NUMBER is NOT zero` ).
ENDIF.
out->write( `--------------------------------------------` ).
out->write( `Example 2: Optional Branches ELSEIF and ELSE` ).
out->write( `--------------------------------------------` ).
IF c_number = 0.
out->write( `The value of C_NUMBER equals zero` ).
ELSEIF c_number > 0.
out->write( `The value of C_NUMBER is greater than zero` ).
ELSE.
out->write( `The value of C_NUMBER is less than zero` ).
ENDIF.
Varun N
* Example 3: CASE ... ENDCASE
**********************************************************************
out->write( `---------------------------` ).
out->write( `Example 3: CASE ... ENDCASE` ).
out->write( `---------------------------` ).
CASE c_number.
WHEN 0.
out->write( `The value of C_NUMBER equals zero` ).
WHEN 1.
out->write( `The value of C_NUMBER equals one` ).
WHEN 2.
out->write( `The value of C_NUMBER equals two` ).
WHEN OTHERS.
out->write( `The value of C_NUMBER equals non of the above` ).
ENDCASE.
Exception Handling:
* Declarations
**********************************************************************
DATA result TYPE i.
* Preparation
**********************************************************************
out->write( `---------------------------` ).
out->write( `Example 1: Conversion Error` ).
out->write( `---------------------------` ).
TRY.
result = c_text.
out->write( |Converted content is { result }| ).
CATCH cx_sy_conversion_no_number.
out->write( |Error: { c_text } is not a number!| ).
ENDTRY.
out->write( `---------------------------` ).
out->write( `Example 2: Division by Zero` ).
out->write( `---------------------------` ).
TRY.
result = 100 / c_number.
out->write( |100 divided by { c_number } equals { result }| ).
CATCH cx_sy_zerodivide.
out->write( `Error: Division by zero is not defined!` ).
ENDTRY.
out->write( `-------------------------` ).
out->write( `Example 3: Line Not Found` ).
out->write( `-------------------------` ).
TRY.
result = numbers[ c_index ].
out->write( |Content of row { c_index } equals { result }| ).
CATCH cx_sy_itab_line_not_found.
out->write( `Error: Itab has less than { c_index } rows!` ).
ENDTRY.
out->write( `----------------------` ).
Varun N
out->write( `Example 4: Combination` ).
out->write( `----------------------` ).
TRY.
result = numbers[ 2 / c_char ].
out->write( |Result: { result } | ).
CATCH cx_sy_zerodivide.
out->write( `Error: Division by zero is not defined` ).
CATCH cx_sy_conversion_no_number.
out->write( |Error: { c_char } is not a number! | ).
CATCH cx_sy_itab_line_not_found.
out->write( |Error: Itab contains less than { 2 / c_char } rows| ).
ENDTRY.
Change the values of constants c_number, c_text, c_index, and c_charin a way
that no exceptions are raised.
* Declarations
**********************************************************************
out->write( `----------------------------------` ).
out->write( `Example 1: DO ... ENDDO with TIMES` ).
out->write( `----------------------------------` ).
Varun N
DO c_number TIMES.
out->write( `Hello World` ).
ENDDO.
out->write( `-------------------------------` ).
out->write( `Example 2: With Abort Condition` ).
out->write( `-------------------------------` ).
"abort condition
IF number <= c_number.
EXIT.
ENDIF.
ENDDO.
Analyze the console output. Play around with the source code to get familiar with the
concepts; Uncomment different declarations of constant c_number to see how the different
values affect the result
* Declarations Varun N
**********************************************************************
* Example 1: APPEND
**********************************************************************
out->write( `-----------------` ).
out->write( `Example 1: APPEND` ).
out->write( `-----------------` ).
out->write( numbers ).
* Example 2: CLEAR
**********************************************************************
CLEAR numbers.
out->write( `----------------` ).
out->write( `Example 2: CLEAR` ).
out->write( `----------------` ).
out->write( numbers ).
out->write( `---------------------------` ).
out->write( `Example 3: Table Expression` ).
out->write( `---------------------------` ).
number = numbers[ 2 ] .
ENDLOOP.
Local Class:
*"* use this source file for the definition and implementation of
*"* local helper classes, interface definitions and type
*"* declarations
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
ENDCLASS.
Icon Strip
Desktop Strip:
Varun N
Loop At
Varun N
DEBUGGIN
G
1. Debugging
▪ Debugging is a technique by which we can find the error, correct the error
and detect the error.
2.Ways of Debugging
There are 2 ways of debugging.
▪ Set the breakpoint on any executable statement and program stops
automatically at that point.
▪ We can debug the code with the help of transaction code /h.
3. Execution Keys
There are 4 execution keys in debugging mode.
▪ F5 - Step by step execution
▪ F7 - Return
3. SY-UNAME: Username
Varun N
7. SY-LANGU: Logon language
8. SY-MANDT: Client (system identifier)
5.Static Breakpoints
6. Dynamic Breakpoints
The various operations on internal table in the debugging mode are as follows:
▪ Deleting a row from an internal table.
Varun N
Click on the Services of the tool symbol after we can find the Change table content where we
perform the internal table operations.
Varun N
9. Features - Setting Breakpoint at Keywords, FM’s and Messages
Varun N
10. Features - Deleting and Deactivating the Breakpoints
Varun N
11. Features - Find
▪ In the debugging mode, we can find the specific records of internal table.
▪ We need to do CTRL + F for the internal table data, one pop-up appears
to pass the column values, pass the input and it point to the records
having matching values.
▪ In the debugging mode, we can open the code in a new session without
closing the debugging session.
Varun N
13. Features - Save Parameters as Test Data (SE37)
▪ We can save the function module parameter values in the debugging mode.
▪ We can check the values of SAP memory and ABAP memory in the
debugging mode.
Only)
Varun N
15.Watchpoints
Watchpoints are used to monitor the values of variables, work areas and internal tables.
Varun N
16. Breakpoints and Watchpoints Comparison
The layouts are different and in desktop 2 we can see the ABAP STACK (It is based on the LIFO).
But in Standard desktop we can see both normal and ABAP STACK and Desktop 3 is just most
preferable one to debug.
Varun N
19.Way to Debug a Dialog Screen or Pop-Up Screen
Command=/H
Type=SystemCommand
▪ Then drag and drop this text document on the required dialog screen
or pop-up screen.
▪ We can use the script tab to stop the debugger on the selection of
specific tables and update of tables.
▪ We need to go to script tab, click on to load script and pass the name of
the script as per the requirement.
Varun N
After click on the Start Script and enter the table like MARA, MAKT, MARD.
Varun N
The various scripts for selection and updating of tables are as follows:
Note: To check the inserting and updating fields into DB tables in the debugging you should
change the normal debugging mode to update mode.
Varun N
Interview Questions for SAP SD Prepared by Balachandra
Marri
If you want to make the custom field visible on the sales order item screen:
1. Go to transaction SE51 for screen enhancement.
2. Identify the screen number for sales order items (e.g., SAPMV45A -
screen number 4900).
3. Add the custom field to the layout using the screen painter tool.
To populate the custom fields, you need to enhance the logic in the user exits or BAdIs.
ENDIF.
Varun N
Interview Questions for SAP SD Prepared by Balachandra
Marri
You need to ensure that the custom fields are correctly populated during order processing
(create/change/display).
1. Transaction VA01/VA02/VA03:
o When the sales order is created or updated, make sure the
custom field logic is executed in the corresponding user exit or
BAdI to populate the field.
2. Saving the Data:
o During save operations (VA01, VA02), the custom fields should
be correctly stored in the database table (e.g., VBAP) based on
your logic.
To add custom fields to the pricing field catalog in SAP, you need to follow a structured
Varun N
process involving enhancements of SAP structures and writing code in user exits to
ensure the custom fields are available during pricing determination. Below are the steps
to do this:
Varun N
Interview Questions for SAP SD Prepared by Balachandra
Marri
1. Go to Transaction SE11:
o Identify whether the field should be added to the header
(KOMK) or item (KOMP) communication structure.
After appending the fields to the communication structures, you need to ensure that these
fields are filled with the correct data during pricing.
Field FORM
USEREXIT_PRICING_PREPARE_TKOMK.
ZZPAYEE. ENDFORM.
ENDFORM.
Varun N
Interview Questions for SAP SD Prepared by Balachandra
Marri
After adding the custom fields to the communication structures and populating them
through the user exits, the next step is to add them to the pricing field catalog. The field
catalog determines which fields are available for use in pricing conditions.
If your custom field is used for determining pricing conditions, you may need to update the
access sequence and condition tables.
Varun N
1. Go to Transaction V/07:
o Modify the access sequence to include the new custom field.
2. Go to Transaction V/03:
Varun N
Interview Questions for SAP SD Prepared by Balachandra
Marri
Once the custom fields are added to the pricing field catalog and the necessary coding is
done, you can test the implementation:
2. Check the pricing calculation and verify that the custom fields are
being used in the pricing conditions.
3. Analyze the output and make sure the field is properly flowing
into the pricing communication structure and that the condition
records are being accessed correctly.
Additional Considerations:
If you want to display the custom field in pricing analysis, you may
need to modify the pricing analysis layout.
By following these steps, you can successfully add custom fields into the pricing field
catalog in SAP, and the fields will be available for use in pricing conditions and routines.
Varun N
Varun N