ABAP Program Warning
Hi Experts,
I got below error when checking an ABAP program, which was generated in maintaining datasouce with RSA6.
Description:
Type Group RSFH
In Unicode programs, the "-" character canot appear in names, as it does here in the name "RSFH_C_TFMETHODE-TEST".
Any input will be very appreciated.
Thanks,
Bill
Hi
It should be Warning Message, not an error i think.. Which Version of SAP you are working...
Still you can Execute the Program, as if its only Warning..
You can see that in the Attributes of the Program..
If it has a Program name , then goto SE38 -> give program name -> select Attributes Radio button.-> display....
You can see that is unicode enabled or not....
\[removed by moderator\]
Edited by: Jan Stallkamp on Jul 9, 2008 8:27 AM
Similar Messages
-
What is the use of "#ec * in a abap program
Hi,
i want to know that is the use of "#ec * in an abap program.
i heard that it is used to supress the warning messages which we get when we do extended syntax check.
fist of all i want to know is it true r false and if its true then i want to know more about it.
regards,
maqsoodHi
Yes it's true.
If you put "#ec * at the end of a abap code row, you can suppress the warnining messages of extended program check.
Every kind of warning has own sign, you find out them while running extended check.
It's a way to clear the useless messages.
For example, you have created an include where you have defined several routines you have to use in several programs, but every program don't use all routines of that include, or you dynamically call those routines, so if you run the extend check for a certain program you can get a warning like that:
FORM PLUTO not called directly
Now you can't delete the routine from the include, because it can be used by other program, but you can hide that message by "#ec CALLED:
FORM <MY_FORM>. "#EC CALLED
ENDFORM.
Max -
Use of ERP Infoset inside ABAP program
Hello experts,
I created a quite complex InfoSet which is supposed to extract business relevant information from FI tables (above all BSID and BSAD) and provide them to users as a mean to interpret data. I'd like to use those data in a custom ABAP program with an extended logic, but I'm not sure how to use it inside my code.
The final result should be to send daily updates on BSAD activities to BI system, and given that BSAD does not have (as far as I know) any mean to completely track creation/modify actions, I came out with the InfoSet solution that make use of an additional field (called update_timestamp) derived from a complex query.
Any help/suggestion on how to overcome the issue will be greatly appreciated.
Best regards
Davide RizzoHi
Yes it's true.
If you put "#ec * at the end of a abap code row, you can suppress the warnining messages of extended program check.
Every kind of warning has own sign, you find out them while running extended check.
It's a way to clear the useless messages.
For example, you have created an include where you have defined several routines you have to use in several programs, but every program don't use all routines of that include, or you dynamically call those routines, so if you run the extend check for a certain program you can get a warning like that:
FORM PLUTO not called directly
Now you can't delete the routine from the include, because it can be used by other program, but you can hide that message by "#ec CALLED:
FORM <MY_FORM>. "#EC CALLED
ENDFORM.
Max -
Forcing an error on ABAP program (SE38)
Hi all,
i'm creating an ABAP program on SE38 and i'm going to use it on a process chain.
I need that under certain condition the program return error so the process gets red and the chain don't continue.
How do i generate the error on the program ?
thx in advanceHi Juan,
you use the "MESSAGE" statement to give out any kind of messages (error, warning or information). I think you need to have a custom message class and a custom message in the class. Please look into SAP help for syntax and usage.
Thanks and Regards
Subray Hegde -
hi all,
i need to design flow chart for checking for a program whether it satifies the abap coding standards or not. who to do it. if possible send me graphical representations [flow charts] or links to find programming standards.
some of my requirements in that folw chart are
1. how to recognize a blank space in a given program,
2. how to recognize a comment,
3. how to check wheteher a keyword is used or not,
4. how to identify the ' :' symbol
thanks & regards,
suresh babu aluri.plz go through this documementaion,
i think its helpful.
ABAP Programming StandardsContents
1. Objective 5
2. Naming Conventions 5
2.1 Codes for naming conventions 5
2.1.1 Module Codes 5
2.1.2 Free text 6
2.2 Naming Convention of Development Objects 6
2.2.1 Package 6
2.2.2 Executable Program 6
2.2.3 BSP Application 7
2.2.4 Logical Database 8
2.2.5 SAP Scripts /Smartforms 9
2.2.6 Idocs 9
2.2.7 Transaction Code 10
2.2.8 Function Groups 10
2.2.9 Dictionary Objects 11
2.2.10 Message Class 11
2.2.11 Enhancement Projects (User Exits) 11
2.2.12 LSMW Objects 12
2.2.13 Classes 12
2.2.14 BOR Object Types 13
2.2.15 Screen / Transaction Variants 13
2.2.16 Area Menu 13
2.3 Naming of Sub-Objects 13
2.3.1 Program Sub-Objects 13
2.3.2 SAP Script /Smartform sub-objects 14
3. General Programming Guidelines 14
3.1 Modification Logs 14
3.2 Program Organization 15
3.2.1 Executable Programs 15
3.2.2 Dialog Programs 15
3.3 Package 15
3.3.1 Adding Components to existing objects 15
3.3.2 Creation of New Objects 15
3.4 Program Messages 15
3.4.1 Adding Messages to existing landscapes 15
3.4.2 Creation of New Objects 16
3.5 Dictionary Objects 16
4. Structure of ABAP Programs 16
4.1 Type 16
4.2 Status 18
4.3 Authority Check 18
4.4 Program Structure 19
4.4.1 Declaration data for global data, classes and selection screens 19
4.4.2 Container for Processing Blocks 19
4.4.3 Calling Processing Blocks 20
4.5 Screen Flow Logic (Dialog Programs) 20
4.5.1 Place the AT EXIT COMMAND at the beginning of the flow logic. 20
4.5.2 Use FIELD and CHAIN statements to keep fields in error open for correction. 20
4.6 Main Program 20
4.6.1 Events 20
5. General Coding Standards 21
5.1 One command per line 21
5.2 Indented Source Code 21
5.3 Extended Syntax Check 21
5.4 Reusability and Modularity 21
5.5 Text Handling 21
5.6 Usage of System Variables 22
5.7 Chaining Statements 22
5.8 Common Routines 22
5.9 Dialog Messages 22
5.10 Function Keys 23
5.11 Enqueuing and Dequeuing Data Objects 23
5.12 Error Handling (SY-SUBRC) 23
5.13 General Conventions and Hints 24
5.14 Parameters in Sub-Routines 24
6. Performance Standards 25
6.1 General Tips on Performance Tuning 25
6.1.1 Avoid Redundant code 25
6.1.2 Subroutine Usage 25
6.1.3 Case vs. Nested IF 25
6.1.4 Using the MOVE Statement 25
6.1.5 SELECT Queries 25
6.1.6 Using the READ statement 27
6.1.7 Hashed table 27
6.1.8 Transporting 28
6.1.9 Using LDB 28
6.1.10 Append Lines of 28
6.1.11 Use WHILE 28
6.1.12 DELETE <itab> WHERE 28
6.1.13 Using WHERE clause in LOOP .ENDLOOP 28
1. Objective
The objective of this document is to describe general programming guidelines, methodologies, Naming conventions and performance guidelines for all the programs developed for SAP Project.
2. Naming Conventions
This chapter describes the naming conventions to be followed for naming the programming objects for SAP project.
2.1 Codes for naming conventions
The variable portion of naming convention is given with Code ID given in angle brackets(<>). Use the following tables for replacing code IDs with codes in the object naming.
2.1.1 Module Codes
Code ID: mm
Code Description
FI Finance
CO Controlling Module
MM Materials Management
PP Production Planning
SD Sales & Distribution
QM Quality Management
PM Plant Maintenance
IM Inventory Management
WM Warehouse Management
BC Basis Module
BW Business Warehouse
WF Workflows (Master Data Management)
HR Human Resources
EBP EBP
PS Project Systems
PCP Synpro: Product Costing
PAP Synpro: COPA
DP APO : Demand Planning
SP APO : Supply Network Planning
DS APO : Production Planning & Detailed Scheduling
AT APO : Global ATP
TP APO : Transportation Planning/Vehicle Scheduling
CI Core Interface
LC Live Cache
2.1.2 Free text
Code ID: ffff
Developer should replace ffff with meaningful text. The text can be multiple words separated by underscore.
2.2 Naming Convention of Development Objects
2.2.1 Package
Naming Convention: Z<mm>_<ffff>.
Notes:
1. Replace <mm> with Module codes given in section 2.1.1 above.
2. Replace <ffff> with the sub-landscape of the Module that this Message Class caters to as illustrated in examples below.
3. The maximum permissible length for development class is 30 characters
Examples:
Dev. Class Description
ZFI_AR FI: Account Receivables
ZCO_CCA CO: Cost Center Accounting
2.2.2 Executable Program
Naming Convention: Z<mm>_<ffff>.
Notes:
1. Replace <mm> with module codes given in section 2.1.1 above.
2. Replace <ffff> with meaningful text as illustrated in examples below.
3. The maximum permissible length for program name is 30 characters. However, the name should be restricted to 25 characters to accommodate appropriate Include naming as described in 2.2.2.
Examples:
Program Name Description
ZFI_VAT_RET FI: Report for VAT Return
ZMM_AUTO_GR MM: Automated Goods Receipt
ZSD_XX_STCK_SHORTAGE SD: Stock shortage report for stock allocation
2.2.2.1 Includes for executable programs
Naming Convention: Z<mm>_<ffff>_<Inn>.
Notes:
1. All includes of executable program will be prefixed by Z, followed by the same program name as described in 2.2.2 above.
2. Replace <Inn> with include type and sequence number. Use the following table for includes.
Include Type ID Description
TOP Top Include.
Fnn Subroutine pool (Forms)
Inn PAI Modules
Onn PBO Modules
Xnn Other Includes
The maximum permissible length for Include name is 30 characters.
Examples:
Include Name Main Program Name Description
ZFI_VAT_RET_TOP ZFI_VAT_RET FI: Report for VAT Return Top Include
ZFI_VAT_RET_F01 ZFI_VAT_RET FI: Report for VAT Return Forms
ZMM_AUTO_GR_TOP ZMM_FR_AUTO_GR MM: Automated Goods Receipt Top include
ZMM_AUTO_GR_F01 ZMM_FR_AUTO_GR MM: Automated Goods Receipt Forms
2.2.3 BSP Application
2.2.3.1 Main Application
Naming Convention: BSP Applications shall follow the same Naming Convention as Executable Programs i.e. Z<mm>_<ffff>.
Notes:
1. Replace <mm> with module codes given in section 2.1.1 above.
2. Replace <ffff> with meaningful text as illustrated in examples below.
2.2.3.2 Pages & Controllers
Naming Convention: <ffff>
Notes:
1. Replace <ffff> with meaningful text, that adequately describes the function of the page/controller
2.2.3.3 Theme
Naming Convention: Z_<ffff>.
Notes:
1. Replace <ffff> with meaningful text
2.2.3.4 Mime Objects:
Naming Convention: <ffff>
1. A MIME Object can be logo for the company.
2. Replace <ffff> with meaningful text, that adequately describes the function of the MIME objects
2.2.3.5 Controller and Handler Classes:
See section Classes (Section 2.2.133)
2.2.3.6 BSP Extension
Naming Convention: Z_<ffff>
Notes:
1. Replace <ffff> with meaningful text
2.2.3.7 BSP Layout elements id
Label: lb_fffff
Input field: if_fffff
Button: b_fffff
Text Edit: te_fffff
Text View: tv_fffff
Radio button Group: rbg_fffff
Radio button: rb_fffff
Check Box Group: cbg_fffff
Check Box cb_fffff
Tray tr_fffff
Tabstrip ts_fffff
Tableview tab_fffff
1. Replace <fffff> with meaningful text
2.2.4 Logical Database
Naming Convention: Z<mm>_<ffff>.
Notes:
1. Replace <mm> with module codes given in section 2.1.1 above.
2. Replace <ffff> with meaningful text
3. The maximum permissible length for LDB name is 20 characters. However, the name should be restricted to 15 characters to accommodate appropriate Include naming
4. LDB Program and LDB Program Includes shall follow the naming convention Auto-Generated by SAP
2.2.5 SAP Scripts /Smartforms
Naming Convention: ZF<mm>_<ffff>.
Notes:
1. Replace <mm> with module codes given in section 2.1.1 above.
2. Replace <ffff> with meaningful text as illustrated in examples below.
Examples:
Form Name Description
ZFFI_EMP_CONF Employee Confirmation Letter
ZFFI_ANN_TO Annual Turnover Letter To Customers and Vendors
2.2.6 Idocs
2.2.6.1 Idoc Types
Basic Type :
Naming Convention : ZB<FFFF>NN
Notes:
1.Replace <NN> with sequence number.
3. Replace <ffff> with meaningful text.
Extension Type : ZX<Basic type name>_NN
Notes:
1. Replace <NN> with sequence number .
2.2.6.2 Message Types
Naming Convention : ZM<mm><ffff>.
Notes :
1. Replace <mm> with module codes given in section 2.1.1 above.
2. Replace <ffff> with meaningful text .
2.2.6.3 Process Code
Naming Convention : Z<ffff>.
Notes :
1. Replace <ffff> with meaningful text ..
2.2.6.4 IDOC Segments
Naming Convention : Z1<ffff>.
Notes :
1.Replace <ffff> with meaningful text as illustrated in examples below.
2.2.7 Transaction Code
Notes:
1. The tcode name is provided by SAP TIN The Developer must write a mail to SAP Tin asking for the T-Code name with a filled form.
The form can be found at :
2.2.8 Function Groups
Naming Convention: Z<mm><ffff>
Notes:
1. Replace <mm> with relevant module code as given above
2. Replace <ffff> with meaningful text.
2.2.8.1 Function Group Include Programs
Naming Convention: LZ<Function Group><Inn>.
Notes:
1. All includes of Function Group program will be prefixed by LZ, followed by the Function Group name
2. Replace <Inn> with include type and sequence number. Use the values from the table given in 2.2.2.1
Examples:
Include Name Function Group Name Description
SAPLZMMPURCHASING ZMMPURCHASING F.Group-Purchasing: Main Program
LZMMPURCHASINGO01 ZMMPURCHASING F.Group-Purchasing: PBO
LZMMPURCHASINGI01 ZMMPURCHASING F.Group-Purchasing: PAI
LZMMPURCHASINGF01 ZMMPURCHASING F.Group-Purchasing: Forms
LZMMPURCHASINGTOP ZMMPURCHASING F.Group-Purchasing: Data Declarations
2.2.8.2 Function Modules
2.2.8.2.1 Normal Function Modules
Convention: Z_<mm>_<ffff>.
Notes:
1. Replace <mm> with relevant module code as given above.
2. Replace <ffff> with meaningful text.
2.2.8.2.2 IDOC Function Modules
Convention: Z_IDOC_<mode>_<msg type>.
Notes:
1. Replace <mode> with INPUT or OUTPUT depending on whether the function processes incoming or outgoing IDOC.
2. Replace <msg type> with the IDOC message type.
2.2.9 Dictionary Objects
Tables: Z<mm><ffff>
Structures: ZS<mm><ffff>
Views: ZV<mm><ffff>
Data Element: ZDE<mm><ffff>
Domain: ZDO<mm><ffff>
Table Type: ZTT<mm><ffff>
Type Group: Z<ffff>
Search Help: ZSH<mm><ffff>
Lock Object: EZ<mm><ffff>
Notes:
1. Replace <mm> with module code given above.
2. Replace <ffff> with meaningful text.
2.2.10 Message Class
Naming Convention: Z<mm>_<ffff>.
Notes:
1. Replace <mm> with Module codes given in section 2.1.1 above.
2. Replace <ffff> with the sub-landscape of the Module that this Message Class caters to as illustrated in examples below.
3. The maximum permissible length for development class is 30 characters
Examples:
Msg. Class Description
ZFI_AR FI: Account Receivables
ZCO_CCA CO: Cost Center Accounting
2.2.11 Enhancement Projects (User Exits)
Convention: Z<XX><nn>.
Notes:
1. XX is the application area code e.g. for sales it is SD etc.
2. 'nn' is one up number for one application area. It starts with 001.
3. Maximum length of the Project name is 8.
Example: The name of the SD enhancement project can be ZSD001.
2.2.12 LSMW Objects
2.2.12.1 Project
Naming Convention: ZM_<ffff>.
Notes:
1. 1. Replace <ffff> with meaningful text
2. The maximum permissible length for Project name is 16 characters. But please limit it to 12.
Example : ZM_VENDOR
2.2.12.2 SubProject
Naming Convention: ZM_<ffff>_<n>.
Notes:
Suffix Project name with a running sequence no.
Example : ZM_VENDOR_1
2.2.12.3 Object
Naming Convention: ZM_<ffff>_<n><n>.
Notes:
Suffix Subproject name with a running sequence no.
Example : ZM_VENDOR_11
2.2.13 Classes
Naming Convention: ZCL_[IM/DF/BSPCO/BSPHN/BADI]_<ffff>.
1. IM: Implementation Class;
DF: Definition Class
BSPCO: BSP Controller class
BSPHN: BSP Handler class
BADI : BADI implementation
2. Replace <ffff> with meaningful text: In case of Implementation classes, it should preferably be the same as that of the Definition Class
3. Example:
IMPLEMENTATION Class: ZCL_IM_REBATE_SETTL
DEFINITION: ZCL_DF_REBATE_SETTL
2.2.14 BOR Object Types
Object Convention Example
Supertype Z<ffff> ZLVAPPL
SubType Z<SuperType><nn> ZZLVAPPL01
Program <Subtype> ZZLVAPPL01
1. Replace <nn> with a running 2 digit serial Number
2. Replace <ffff> with meaningful text
2.2.15 Screen / Transaction Variants
Naming Convention: <tcode>_<ffff>
Where:
1. Replace <tcode> with the t-code that will be assigned to this Variant
2. Replace ffff with a meaningful text
E.g.:
For an SE16 variant for table KONA that will be used by T-Code Z_CH_SD_001:
Z_CH_SD_001_KONA
2.2.16 Area Menu
Naming Convention: Z<mm>_<Main Menu>_<Sub Menu> <ffff>
Where:
1. Replace <mm> with the Module code
2. Followed by the hierarchical position of the immediate parent of this Area Menu
3. Followed by a Meaningful text for this Menu
E.g.:
ZSD
ZSD_TAB
ZSD_TAB_VIEW
ZSD_TAB_UPDT
Notes:
1. Clusters of Transactions should be introduced as Sub-Menus rather than as Folders
2. As a gradual process, the current Clusters that exist as Folders should also be replaced with Sub-Menus
2.3 Naming of Sub-Objects
2.3.1 Program Sub-Objects
Naming of all the internal components of a program will be consistent across the project.
Naming Convention: <Prefix>ffff.
Notes:
1. Replace <Prefix> with the component prefix values given in the table below.
Program Component Prefixed by
Program Constants C_
Global Variables W_
Types Definition T_
Global Structures WA_
Global Internal Tables I_
Select-Options SO_
Parameters PO_
Table Type TT_
Field Symbols FS_
Ranges R_
Local Constants LC_
Local Variables L_
Local Static Variables LS_
Local Internal Tables LI_
Local Work Area LWA_
Local Range LR_
Field Groups FG_
Container CO_
Macro MA_
Important: The Same sequence as above must be followed in the Data declaration part of all the ABAP/4 programs.
2.3.2 SAP Script /Smartform sub-objects
Naming of all the internal components of a SAPScript/SmartForm shall follow the same convention as for Programs (2.2.2), with the addition of the Field Label on the FRS. E.g. if the FRS has labeled a field for Sales Order Number as Field 27 on the Layout, the variable name should be W_27_VBELN.
3. General Programming Guidelines
3.1 Modification Logs
At the top of every ABAP Object Modified by a Developer, there should be a Modification Log Every Line Created/Changed by the developer should be Identifiable by the TR Number.
ABAP Patterns: Following Patterns should be used for Uniform ModLogs:
Nature of Change Pattern to Use
New Development ZZNEWPROG
In-Line Logs ZZLINE
Modification Logs at the Top of Object ZZMODLOG
3.2 Program Organization
All the programs will be organized as described below.
3.2.1 Executable Programs
TOP Include: For global data declarations
Form Include: For definition of all the FORMs.
3.2.2 Dialog Programs
TOP Include: For global data declarations
Form Include: For definition of all the FORMs.
PBO Include: Include for PBO Modules
PAI Include: Include for PAI Modules
3.3 Package
All the related objects within a sub-module of SAP will be developed under a single Package.
3.3.1 Adding Components to existing objects
When adding new workbench components to existing Objects, the same Package will be used as has been used for the existing Components
3.3.2 Creation of New Objects
When creating new Objects or new Sub-lanscapes, Packages used should have the Naming convention as in Section 2 Above
3.4 Program Messages
All the messages within a sub-module of SAP will be grouped under a single Message Class.
3.4.1 Adding Messages to existing landscapes
When adding new messages for existing Objects, the same Message Class will be used as has been used for the existing Objects
3.4.2 Creation of New Objects
When creating new Objects or new Sub-landscapes, Message classes used should have the Naming convention as in Section 2 Above
3.5 Dictionary Objects
Whenever you create a Z table in system always include MANDT field as the first field, except when the table contains client independent data. Also create the table with attribute Data Class as USER.
4. Structure of ABAP Programs
4.1 Type
When an ABAP program is run, its processing blocks are called. ABAP programs are controlled from outside the program itself by the processors in the current work process. For the purposes of program flow, we can summarize the screen processor and ABAP processor into the ABAP runtime environment. The runtime environment controls screens and ABAP processing blocks. It contains a range of special control patterns that call screens and processing blocks in certain orders. These sections are also called processors. When a ABAP program is run, the control passes between various processors.
In the R/3 System, there are various types of ABAP program. The program type determines the basic technical attributes of the program, and must be set when created. The main difference between the different program types is the way in which the runtime environment calls its processing blocks.
When an application program is run, it must at least call the first processing block from outside the program, that is, from the runtime environment. This processing block can then either call further processing blocks or return control to the runtime environment. When an ABAP program is started, the runtime environment starts a processor (dependent on the program type), which calls the first ABAP processing block.
The following program types are relevant to application programming:
Type 1
Type 1 programs have the important characteristic that they do not have to be controlled using user-defined screens. Instead, they are controlled by the runtime environment, which calls a series of processing blocks (and selection screens and lists where necessary) in a fixed sequence. User actions on screens can then trigger further processing blocks.
Type M
The most important technical attribute of a type M program is that it can only be controlled using screen flow logic and run via a transaction code which is linked to the program and one of its screens (initial screen).
ABAP programs with type M contain the dialog modules belonging to the various screens. They are therefore known as module pools.
Type F
Type F programs are containers for function modules, and cannot be started using a transaction code or by entering their name directly.
Type F programs are known as function groups. Function modules may only be programmed in function groups. The Function Builder is a tool in the ABAP Workbench that is used to create function groups and function modules. Apart from function modules, function groups can contain global data declarations and subroutines. These are visible to all function modules in the group. They can also contain event blocks for screens in function modules.
Type K
Type K programs are containers for global classes in ABAP Objects. Type K programs are known as class definitions. The Class Builder is a tool in the ABAP Workbench that can be used to create class definitions.
Type J
Type J programs are containers for global interface in ABAP Objects. Type J programs are known as interface definitions and are created in the Class Builder.
Type I
Type I programs - called includes - are a means of dividing up program code into smaller, more manageable units. The coding of an include program can be inserted at any point in another ABAP program using the INCLUDE statement. There is no technical relationship between include programs and processing blocks. Includes are more suitable for logical programming units, such as data declarations, or sets of similar processing blocks. The ABAP Workbench has a mechanism for automatically dividing up module pools and function groups into include programs.
4.2 Status
P = SAP standard production program
K = Customer production program
S = System program
T = Test program
Application
Categorize the program according to the purpose it fulfills.
4.3 Authority Check
Authority checks will be carried out as given in the respective FRSs.
4.4 Program Structure
ABAP programs are responsible for data processing within the individual dialog steps (ie. events) of an application program. This means that the program cannot be constructed as a single sequential unit, but must be divided into sections that can be assigned to the individual dialog steps. To meet this requirement, ABAP programs should have a modular structure. Each module is called a processing block. A processing block consists of a set of ABAP statements. When a program is run, effectively a series of processing blocks is called. Therefore, they should not be nested but modularized.
Each ABAP program consists of the following two parts:
4.4.1 Declaration data for global data, classes and selection screens
The first part of an ABAP program is the declaration part for global data, classes, and selection screens. This consists of:
All declaration statements for global data. Global data is visible in all internal processing blocks and should be defined using declarative statements that appear before the first processing block, in dialog modules, or in event blocks. Local data should not be declared in dialog modules or event blocks.
All selection screen definitions.
All local class definitions (CLASS DEFINITION statement). Local classes are part of ABAP Objects, the object-oriented extension of ABAP.
Declaration statements which occur in procedures (methods, subroutines, function modules) form the declaration part for local data in those processing blocks. This data is only visible within the procedure in which it is declared.
4.4.2 Container for Processing Blocks
The second part of an ABAP program contains all of the processing blocks for the program. The following types of processing blocks are allowed:
1. Dialog modules (no local data area)
2. Event blocks (no local data area)
3. Procedures (methods, subroutines and function modules with their own local data area).
Whereas dialog modules and procedures are enclosed in the ABAP keywords which define them, event blocks are introduced with event keywords and concluded implicitly by the beginning of the next processing block.
All ABAP statements (except declarative statements in the declaration part of the program) are part of a processing block. Non-declarative ABAP statements, which occur between the declaration of global data and a processing block are automatically assigned to the START-OF-SELECTION processing block.
4.4.3 Calling Processing Blocks
Processing blocks can be called from either the ABAP program or using ABAP commands which are themselves part of a processing block. Dialog modules and event blocks are called from outside the ABAP program. Procedures are called using ABAP statements in ABAP programs.
Calling event blocks is different from calling other processing blocks for the following reasons:
An event block call is triggered by an event. User actions on selection screens and lists, and the runtime environment trigger events that can be processed in ABAP programs. Define event blocks for the events that the program needs to react to (whereas a subroutine call, for example, must have a corresponding subroutine). This ensures that while an ABAP program may react to a particular event, it is not forced to do so.
4.5 Screen Flow Logic (Dialog Programs)
4.5.1 Place the AT EXIT COMMAND at the beginning of the flow logic.
Example:
PROCESS AFTER INPUT
MODULE EXIT_1170 AT EXIT-COMMAND.
MODULE PAINT_1170.
4.5.2 Use FIELD and CHAIN statements to keep fields in error open for correction.
Example:
PROCESS AFTER INPUT.
MODULE EXIT_1170 AT EXIT-COMMAND.
CHAIN.
FIELD BTCH1170-JOBNAME.
FIELD BTCH1170-USERNAME.
FIELD BTCH1170-FROM_DATE.
FIELD BTCH1170-FROM_TIME.
MODULE PAINT_1170.
ENDCHAIN.
4.6 Main Program
4.6.1 Events
The Program MUST NOT be coded without the use of Proper Coding blocks
Initializations
Top-of-page during line-selection
At Selection-Screen
At Line-Selection
At User-Command
At Pfn
Start-Of-Selection
Top-Of-Page
Get
End-Of-Page
End-Of-Selection
NOTE: The coding for each event should be logically split into forms (subroutines). That is to say, each event will comprise mostly of PERFORM statements.
5. General Coding Standards
5.1 One command per line
Each ABAP/4 command consists of a sentence ending with a period. Multiple commands can be on one line; however, as a standard start each new command on a new line. This will allow for easier deleting, commenting, and debugging.
5.2 Indented Source Code
The ABAP/4 editor has a "Pretty Printer" command to indent by 2 positions specific lines of code and add subroutine comments. Event keywords are typically not indented.
5.3 Extended Syntax Check
Extended Program Check (EPC) to be done on each object to make sure the code is Syntactically correct. There should be no Error/warning messages in the code.
5.4 Reusability and Modularity
If a block of code is executed more than once, it should be placed in a subroutine at the bottom of the code. This makes the code more readable, requires less indentation, and is easier to debug since the debugger can jump through an entire subroutine via a PF key. Also, when possible parameters should be passed to and from subroutines to make the purpose easier to understand and reduce the need for global variables. Always document the purpose of each parameter.
5.5 Text Handling
Text elements must be used to display any text messages.
5.6 Usage of System Variables
The system variables should be used wherever possible. The SY-SUBRC is to be checked after any function call, selection operation, etc.
5.7 Chaining Statements
Consecutive sentences with an identical beginning shall be combined into a chained statement.
Example:
Instead of the statements
MOVE SY-MANDT TO D00001-MANDT.
MOVE SY-LANGU TO D00001-SPRAS.
A chained statement shall be used
MOVE:
SY-MANDT TO D00001-MANDT,
SY-LANGU TO D00001-SPRAS,
SY-UNAME TO D00001-BNAME.
5.8 Common Routines
Standard sub-routines should be implemented as FUNCTION's rather than a FORM (ie. SUBROUTINE). A FUNCTION is easier to maintain and can be easily tested without a calling program. Standard SAP function modules are also available and the function library should be used to check if function modules already exist for a function that needs to be performed i.e.POPUP_TO_CONFIRM_LOSS_OF_DATA etc.
Includes can also be created for re-usable or common code e.g. common data declaration statements.
5.9 Dialog Messages
Dialogue messages are stored in table T100. Programmers shall check to see if an appropriate message exists before adding a new message. Programs shall use the message-id which corresponds to the SAP module that the program most relates to.
5.10 Function Keys
PF-keys should be programmed to execute functions where required. SAP Standard function keys should be used where appropriate. The most commonly used buttons should be displayed as pushbuttons in the application toolbar.
5.11 Enqueuing and Dequeuing Data Objects
All database objects being processed by a program, for purposes other than for display, shall be enqueued before such processing is executed. If the enqueue is unsuccessful, then a message shall be returned stating why the enqueue was unsuccessful.
Enqueue and Dequeue objects should be created via the data dictionary.
5.12 Error Handling (SY-SUBRC)
Return codes shall always be checked immediately after an event which returns a code.
Eg. Function calls, Select statements, Updates etc.
The value of SY-SUBRC is 0 when successful and generally produces a value of 4 when unsuccessful (there are a few exceptions).
Therefore, rather check SY-SUBRC with:
IF SY-SUBRC <> 0
than with
IF SY-SUBRC = 4 (which is redundant and makes the system do a double check)
Error messages displayed to the user must be clear and descriptive.
Remember to group related / dependant steps together and to Rollback all changes for steps in that group should any one of them fail, thus maintaining the integrity of the system.
Check whether an Error Log, (file), must be produced by your program and if so check on the format of the file.
If any Error Logging is done to a custom table in the database then make sure this table is maintained and monitored correctly. (Dev. Note)
Transaction SE91 provides the facility to create and utilize messages in their appropriate message class. Elaborate on the message if necessary, using the long text documentation for that message number.
5.13 General Conventions and Hints
There should be NO hard coding of values in programs easy maintainability
For amounts, use the CURRENCY command in write statements to automatically convert fields into their correct decimal format. The currency specified in the write statement is treated as a key for the table TCURX. If no entry exists for the currency specified, the system assumes two decimal places.
For quantities, use the UNIT command in write statements to automatically convert fields into their correct decimal format. The contents of the unit specified are used on table T006. If no entry exists for the unit specified, the formatting has no effect.
Use the LIKE statement as often as possible to declare DATA variables instead of an explicit TYPE declarations.
Try to use the INCLUDE statement with standard SAP structures and tables for your structures and internal tables where possible. If you use the include statement to include other program components in your code then document what those components are, what they do and how to use them.
Try to make use of standard SAP Function Modules wherever possible rather than building your own. Use the pull down functionality in transaction SE37 to find suitable standard function modules.
Make use of the SAP PATTERN tool to automatically insert the standard code for:
CALL FUNCTION
MESSAGE ID
SELECT*FROM
PERFORM
AUTHORITY-CHECK
WRITE
CASE
CALL DIALOG
The standard date format to use is DD/MM/YYYY. (Dev. Note)
The standard time format to use is HH:MM:SS.
5.14 Parameters in Sub-Routines
Naming convention for Parameters in subroutine is P_
6. Performance Standards
6.1 General Tips on Performance Tuning
6.1.1 Avoid Redundant code
Avoid leaving "dead" code in the program. Comment out variables that are not referenced and code that is not executed. To analyze the program, use the Program Analysis function in SE38 -> Utilities -> Program Analysis.
6.1.2 Subroutine Usage
For good modularization, the decision of whether or not to execute a subroutine should be made before the subroutine is called.
Example:
IF f1 NE 0.
PERFORM sub1.
ENDIF.
FORM sub1.
ENDFORM.
6.1.3 Case vs. Nested IF
When testing fields "equal to" something, one can use either the nested IF or the CASE statement. The CASE is better for two reasons. It is easier to read and after about five nested IFs the performance of the CASE is more efficient.
6.1.4 Using the MOVE Statement
When records a and b have the exact same structure, it is more efficient to MOVE a TO b than to MOVE-CORRESPONDING a TO b.
6.1.5 SELECT Queries
The performance of any ABAP program mainly depends on the ABAP Queries used in it. More optimum the queries , better the performance. Take care of the points mentioned nin the following sections while writing any ABAP queries.
6.1.5.1 Using all the keys in SELECT statement
When using the SELECT statement, study the key and always provide as much of the left-most part of the key as possible. The SELECT * command is to be avoided everywhere.
6.1.5.2 Fetching Single Record
If the entire key can be qualified, code a SELECT SINGLE not just a SELECT. If all the keys are not available, we should use SELECT UPTO 1 ROWS if we are interested only in the first record.
6.1.5.3 Avoid SELECT-ENDSELECT
Selecting data into an internal table using an array fetch versus a SELECT-ENDELECT loop will give at least a 2x performance improvement. After the data has been put into the internal data, then row-level processing can be done.
Example:
select ... from table <..>
into <itab>
where ...
loop at <itab>
<do the row-level processing here>
endloop.
6.1.5.4 Using Indexs
Use indexes wherever possible. Tune the Query so that optimum Indexing will happen.
6.1.5.5 Provide all the keys
Give as many keys as possible in the WHERE clause to optimize the database fetching. Use the Index fields in the first position to optimize performance.
6.1.5.6 Avoid INTO CORRESPONDING
Avoid using INTO CORESPONDING FIELDS of Table. Instead, explicitly mention the fields. Else, The Table Fields should be in the same sequence as the selection
6.1.5.7 SELECT statement inside LOOP
Do not write SELECT statements inside the loop. Instead, use the FOR ALL ENTRIES Command
Before using FOR ALL ENTRIES command, check that the
1. Corresponding Internal table is not empty. If the Internal table is empty, the statement will select ALL the entries in the Database
2. The Internal table is sorted by the Filed used in the Where Clause: This makes selection faster
6.1.5.8 Nested SELECT statement
Avoid Using nested SELECT statements. Instead, make use of different internal tables to fetch the data, and Use Nested LOOPS to read them.
6.1.5.9 Select Distinct
Whenever its possible avoid SELECT DISTINCT, instead select data into internal table, sort and use DELETE ADJACENT DUPLICATES
6.1.5.10 Use of OR in Where Clause
Do not use OR when selecting data from DB table using an index because The optimizer generally stops if the WHERE condition contains an OR expression.
e.g.
Instead of
SELECT * FROM spfli WHERE carrid = LH
AND (cityfrom = FRANKFURT OR
city from = NEWYORK)
Use
SELECT * FROM spfli WHERE (carrid = LH AND cityfrom = FRANKFURT)
OR (carrid = LH AND cityfrom = NEWYORK).
6.1.5.11 Order By
ORDER BY will Bypass buffer. So, performance will decrease. If you want to sort data, it is efficient to SORT them in INTERNAL TABLE rather than using ORDER BY. Only use an ORDER BY in your SELECT if the order matches the index, which should be used.
6.1.6 Using the READ statement
When reading a single record in an internal table, the READ TABLE WITH KEY is not a direct READ. The table needs to be sorted by the Key fields and the command READ TABLE WITH KEY BINARY SEARCH is to be used.
6.1.7 Hashed table
If the number of entries in the Internal Table is high then use Hashed Table with Keys to access the table.
6.1.8 Transporting
With READ or MODIFY Statements use TRANSPORTING
6.1.9 Using LDB
In order to improve performance in case of an LDB, individual tables can be excluded from selection. Under the section Table Selection in the Documentation of LDB the fields with proper description has been given those fields can be set in the application report at the time of INITIALIZATION or at the START OF SELECTION. This can enhance the performance.
6.1.10 Append Lines of
Whenever it is possible use APPEND LINES OF to append the internal Tables instead of using loop and then APPEND Statement.
6.1.11 Use WHILE
Use WHILE instead of a DO+EXIT-construction, as WHILE is easier to understand and faster to execute
6.1.12 DELETE <itab> WHERE
Use DELETE <itab> WHERE for deleting records from an internal table.
e.g.
Instead of
LOOP AT <itab> WHERE <field> = 0001
DELETE <itab>.
ENDLOOP.
Use
DELETE <itab> WHERE <field> = 0001.
6.1.13 Using WHERE clause in LOOP .ENDLOOP
Use:
Sort ITAB by NAME.
Loop at itab where name EQ SY-UNAME
Endloop.
Instead Of:
Read itab with key name = SY-UNAME.
L_tabix = sy-tabix.
Loop at itab from l_tabix.
If name eq bijoy
Endif.
Endloop. -
Can ABAP program and a Java apps access the same DB table?
If an ABAP program and a Java apps access the same DB table, how does the Enqueue services from ABAP and Java communicate with each other to ensure locking consistency (if they even communicate with each otehr at all)?
Or there wont be such situation because there are separate schema for ABAP stack and Java stack?
Your help is greatly appreciated.Hello!
A while ago I was a subject to criticism too for not granting points to helpfull answers. I appeared to be ungratefull, but I'm actually not (I guess the same goes for Vincent). I absolutely agree that good people who provide helpfull answers deserve (at least) points, but I didn't quite get the whole idea with points untill I was explicitly warned. I took some time to correct this and I granted points for all my past questions, generously, with "interest rates" for waiting.
My point is:
The pointing system is good, but unintuitive and not documented. I suggested this at that time, and I see that nothing has changed since. I see also that I'm not the only one who has experienced missunderstandings.
I repeat the message to SDN people: Please provide some info on pointing system! A few sentences behind a "What's this?" link would do. It's not such a hard work.
Thanks!
Kind regards,
Igor Barbaric -
How to debug the abap program ?
how to debug the abap program ?Can anybody explain me in details.
Hi
Debugger
This section of the ABAP Workbench documentation provides information on how to use the Debugger as a test tool for finding errors in the source code of an ABAP program.
Functional Overview
Use
The ABAP Debugger is an integrated test tool within the ABAP Workbench. You use it to check the program logic and to find errors in the source code of an ABAP program. In the Debugger, you can step through the source code of a program. The running program is interrupted after each step, allowing you to check its processing logic and the results of individual statements.
As of Release 6.10, you can also run Business Server Pages (BSP) in the debugging mode. You can also display and set breakpoints here. Business Server Pages can be displayed in the Object Navigator when you select an appropriate application under BSP Application.
Features
The Debugger provides an efficient means of identifying errors in ABAP programs. It contains the following functions:
Ways of starting the Debugger
Choosing different views
Choosing different execution options in the Debugger
Displaying source code in the Debugger
Setting and deleting breakpoints
Setting and deleting watchpoints
Stopping a program at a particular statement or event
Displaying and changing field contents at runtime
Displaying ABAP Objects and references
Displaying and positioning strings
Setting and deleting database locks
Opening the ABAP Editor, or Object Navigator
System settings and runtime warnings
Starting the Debugger
There are two possible strategies for starting the Debugger in the ABAP Workbench:
By setting breakpoints then running the program
By running the program in debugging mode.
Setting Breakpoints
A breakpoint is a signal in a specific line of the program source code. This signal indicates to the ABAP runtime processor to stop the program at the relevant line and start the ABAP Debugger. A distinction is made between static and dynamic breakpoints. For further information about the different types of breakpoints and how to use them, refer to Breakpoints.
Direct Processing
You can start the Debugger without previously having set breakpoints. This is the best procedure to use when you want to test a program right from the beginning. It is also a useful procedure if you are not overly familiar with the program and therefore are not sure where best to set breakpoints. You can start the Debugger as follows:
From the Object Navigator
Select a report or transaction and choose Program ® Test ® Debugging.
From the ABAP Editor
Choose Program ® Execute ® Debugging (or the Debugging pushbutton).
From any screen
Choose System ® Utilities ® Debug ABAP.
From any screen
Enter /h in the command field.
Display Modes in the Debugger
When you are debugging a program, there are various display modes that you can use. All of the display modes have the same structure. The top part of the screen displays an extract of the program source code. The bottom part displays the information specifically available in that display mode. There are also pushbuttons on the screen allowing you to switch to the most frequently-used display modes.
Display Modes Available Using Pushbuttons
Fields
The scrollable field display contains the contents of up to eight fields. The contents of the three most important system fields are always displayed. This is the default display mode in the Debugger. See also Processing Fields
Table
Displays the contents of an internal table. This mode allows you to display and edit the entries in an internal table. See also Processing Internal Tables
Breakpoints
A scrollable display containing up to 30 breakpoints. Next to each breakpoint is a counter. You can also delete breakpoints in this display. See also Managing Dynamic Breakpoints
Watchpoints
You can set a watchpoint for a field so that the program is interrupted whenever the value of that field changes. This display mode contains a list of watchpoints, the fields and programs to which they are assigned, the current values of the fields, and the conditions upon which the watchpoint is activated. See also Setting Watchpoints
Calls
This mode displays the current sequence of events, and the sequence of calls up to the current breakpoint. The last active call is displayed at the top of the list; previous calls are listed in reverse chronological order. When an event (for example, START-OF-SELECTION) concludes, it is deleted from the display.
Overview
This mode displays the structure of the program. It lists its events, subroutines, and modules, and shows which sections belong to which events. It also displays the section currently being processed.
Settings
This mode displays the current Debugger settings. You can change the settings by selecting or deselecting various options. For further information, refer to Settings and Warnings
Other Display Modes
You can access other display modes by choosing Goto ® Display data object.
Single field
Displays the contents and technical attributes of a field.
Structured
field
Displays the components of a structure, along with their contents and attributes. If you double-click a component, the system displays detailed information for it.
Strings
Display the content and current length of the string. You can also display part of the content by means of offset and length.
Internal table
Displays the type, line numbers and contents of an internal table.
Object
Displays the structure of an ABAP Object.
For further information on these displays, refer to Displaying Attributes and Displaying ABAP Objects
Checking System Programs for Errors
To check a program or program component that is part of the ABAP Workbench (for example, the Screen Painter), you must use the system Debugger. To start the system Debugger, choose System ® Utilities ® Debug System from any screen. To stop the system Debugger, choose Debugger ® Debugging off.
Displaying Program Attributes
You can display the attributes Fixed Point Arithmetic, System Program, and Unicode Checks of the program that has just been executed by choosing Goto ® Further Information ® Program Attributes.
Restarting the Debugger
If you choose Debugging ® Restart, debugging mode is stopped and the system takes you to the initial screen of the last transaction you called. If, for example, you started an ABAP program in debugging mode from transaction SE38 (ABAP Editor), choosing Debugging ® Restart will take you back to the screen titled ABAP Editor: Initial Screen. If you want to restart the program in debugging mode, choose Debugging.
Breakpoints
Apart from direct execution of an ABAP program in the Debugger, it is also possible to start the Debugger call by the exact setting of a breakpoint. This is achieved by setting one or more of these breakpoints in the program. A breakpoint is a signal at a particular point in the program that tells the ABAP runtime processor to interrupt processing and start the Debugger. The program runs normally until the breakpoint is reached.
There is also a special kind of breakpoint called a watchpoint. When you use watchpoints, the Debugger is not activated until the contents of a particular field change. For further information, refer to Watchpoints.
Breakpoint Variants
The Debugger contains different breakpoint variants:
Static
The BREAK-POINT statement in an ABAP program. Static breakpoints are not normally user-specific. However, you can make them user-specific.
Directly-set
dynamic breakpoints
Can be set in the ABAP Editor or the Debugger. Dynamic breakpoints are always user-specific, and are deleted when you log off from the R/3 System.
Breakpoints
at statement
The Debugger stops the program directly before the specified statement is executed.
Breakpoints
at subroutine
The Debugger stops the program directly before the specified subroutine is called.
Breakpoint at function module
The Debugger stops the program directly before the specified function module is called.
Breakpoint at method
The Debugger stops the program directly before the specified method is called.
Breakpoints at system exceptions
The Debugger stops the program directly after a system exception, that is, after a runtime error has been intercepted.
Static Breakpoints
Static breakpoints are not normally user-specific. Once a user has inserted the statement BREAK-POINT or BREAK name in an ABAP program, the system always interrupts the program at that point for that user or only for the user name. This procedure is only useful in the development phase of an application, when the program execution is always to be interrupted at the same place. For further information, refer to Static Breakpoints.
In HTTP sessions, a static breakpoint is skipped if you did not set additional dynamic HTTP breakpoints in the editor of a BSP page. Instead, a corresponding system log entry is written, which can be checked using transaction SM21.
Dynamic Breakpoints
Dynamic breakpoints are user-specific. Therefore, you should use them if you only want the program to be interrupted when you run it yourself, not when it is being executed by other users. All dynamic breakpoints are deleted when you log off from the R/3 System.
Dynamic breakpoints are more flexible than static breakpoints, because you can deactivate or delete them at runtime. They have the following advantages:
You do not have to change the program code
You can set them even when the program is locked by another programmer
You can define a counter that only activates the breakpoint after it has been reached
Special dynamic breakpoints are useful when you want to interrupt a program directly before a particular ABAP statement, a subroutine, or an event, but do not know exactly where to find it in the source code. Event here is used to refer to the occurrence of a particular statement, for example, or calling up a method. Special dynamic breakpoints are user-specific. You can only set them in the Debugger. For further information, refer to Dynamic Breakpoints.
In HTTP sessions, the system stops both at static and dynamic breakpoints if a dynamic breakpoint was set in the editor of a BSP page before program execution.
Lifetime and Transfer of Breakpoints
A static breakpoint remains intact as long as the BREAK-POINT or BREAK-POINT name statement is not removed from the source code. Without saving, dynamic breakpoints only remain intact in the relevant internal session. However, they are effective during the entire user session, if they are saved by choosing Breakpoints ® Save in the ABAP Debugger. For more details on the subject of sessions and user sessions, refer to Modularization Techniques in the ABAP keyword documentation.
If you call an HTTP session during a user session, only the HTTP breakpoints are loaded when the HTTP session is started. You activate HTTP debugging in the ABAP Editor by choosing Utilities ® Settings ® HTTP Debugging. Depending on the setting, the system then displays either the HTTP or standard breakpoints in the Editor.
If you call an update session during a user session, breakpoints that were defined beforehand in the calling processing unit are copied to the new update session, where they can be displayed under Breakpoints. If, in the ABAP Debugger, you check Update Debugging under Settings and then, for example, call the update module func using CALL FUNCTION func IN UPDATE TASK, a new window is opened in which you can debug this function module in the update session. All the breakpoints that were set in the calling processing unit can also be processed here.
Breakpoints at Statements
You can use this special kind of dynamic breakpoint to interrupt a program directly before an ABAP statement is processed.
Prerequisites
You must already be running the program in the Debugger.
Procedure
To set a breakpoint at an ABAP statement:
1.Choose Breakpoint ® Breakpoint at ® Statement...
The following dialog box appears:
2.Enter the ABAP statement.
The system sets a breakpoint at all points in the program at which the ABAP statement occurs.
3.Choose ENTER.
The breakpoint applies to all lines containing the specified statement.
Result
The system confirms the breakpoint and adds it to the list in the display. When you finish your debugging session, the breakpoint is automatically deleted unless you have explicitly saved it.
Breakpoints at Subroutines
You can use this special kind of dynamic breakpoint to interrupt a program directly before a subroutine is called.
Prerequisites
You must already be running the program in the Debugger.
Procedure
To set a breakpoint for a subroutine:
Choose Breakpoint ® Breakpoint at ® Event/Subroutine.
The following dialog box then appears:
Enter the name of the subroutine before which you want to interrupt the program. By default, the Program field contains the name of the program that is currently active. The system sets a breakpoint wherever the specified subroutine occurs in the program code.
Choose ENTER.
Result
The system confirms the breakpoint. The breakpoint is added to the breakpoints displayed.
Breakpoints at Function Module
You can use this kind of dynamic breakpoint to interrupt a program directly before a function module is called.
Prerequisites
You must already be running the program in the Debugger.
Procedure
To set a breakpoint for a function module:
Choose Breakpoint ® Breakpoint at ® Function module...
The following dialog box appears:
Enter the name of the function module before which you want to interrupt the program. The system sets a breakpoint wherever the specified event, module pool, or subroutine occurs in the program code.
Choose ENTER.
Result
If you entered a valid function module name, the system confirms that the breakpoint has been set. If the function module exists in the system, the new breakpoint is added to the display list.
Breakpoints at Methods
You can use this special kind of dynamic breakpoint to interrupt a program directly before a method is called.
Prerequisites
You must be already running the program in the debugger.
Procedure
To set a breakpoint for methods:
1. Choose Breakpoint ® Breakpoint at ® Method...
The following dialog box then appears:
2. Enter the name of the method and class before which you want to interrupt the program. A breakpoint is then set each time the specified processing block appears in the source code.
3. Choose ENTER.
Result
The system confirms the breakpoint. The breakpoint is added to the list in the display.
Breakpoints at System Exceptions
You can use this special form of dynamic breakpoint to interrupt a program immediately after a runtime error has occurred.
Prerequisites
You must already be running the program in the Debugger.
Procedure
To set a breakpoint at a system exception:
Choose Breakpoint ® Breakpoint at ® System exception.
Result
The system confirms the breakpoint. The breakpoint is added to the breakpoints displayed.
When a system exception is triggered, a warning triangle appears in the line containing the statement that caused it. If you double-click the warning triangle, the internal name of the runtime error appears.
Static Breakpoints
You should only use static breakpoints during the development phase of an application. You must remove them from your program before you transport it.
Setting Breakpoints
To set a static breakpoint, use the ABAP statement BREAK-POINT . Place the breakpoint in the line at which you want to interrupt the program.
program RSDEBUG_01.
if SY-SUBRC 0.
break-point.
endif.
When you run the program, the runtime processor interrupts it when the breakpoints occur. You can number your breakpoints to make them easier to identify ( BREAK-POINT 1, BREAK-POINT 2 ).
Static breakpoints are not normally user-specific. The program is, therefore, always interrupted as soon as the runtime processor reaches the line containing the breakpoint. The program is interrupted regardless of the user who executes it.
However, you can set user-specific static breakpoints using the BREAK statement followed by your user name. For example, if you use the statement BREAK SMITH , the program is only interrupted when user Smith runs it. Although user-specific breakpoints appear in the program code, they are not active when other users run the program. You should, however, be careful if an application is being used by several users with the same name.
Deleting Breakpoints
Since static breakpoints apply to all users, you must remove them from the program once you have finished testing it. In the ABAP Editor, you can find breakpoints quickly by choosing Utilities ® Global search. You can also use the Extended Program Check to find them.
If you do not remove static breakpoints from your program, they will be transported to your production system. This could cause serious problems in the production system.
Dynamic Breakpoints
You can set up to 30 dynamic breakpoints without changing the program code. Dynamic breakpoints can be set either in the ABAP Editor or directly in the Debugger.
Setting Dynamic Breakpoints in the ABAP Editor
You can set dynamic breakpoints in the ABAP Editor regardless of whether you are in display or change mode. You can also set breakpoints directly from within the Debugger at runtime. To set a dynamic breakpoint in the ABAP Editor:
Position the cursor on the line of the source code at which you want to set the breakpoint.
Choose Utilities ® Breakpoints ® Set or the Stop icon. The system confirms that the breakpoint has been set.
To display a list of all dynamic breakpoints in a program, choose Utilities ® Breakpoints ® Display. You can use this list to navigate to a particular breakpoint or to delete one or more breakpoints from the program.
Setting Dynamic Breakpoints in Debugging Mode
To set a dynamic breakpoint in the Debugger:
Position the cursor on the line in which you want to set the breakpoint.
Select the line by double-clicking it or choosing Breakpoint ® Set/delete.
The system sets the breakpoint, and displays a small stop sign to the left of the relevant line. If the line already contained a breakpoint, it is deleted.
When you finish your debugging session, the breakpoint is automatically deleted unless you have explicitly saved it.
Saving Breakpoints
If you want to leave the Debugger temporarily, you can save your dynamic breakpoints so that they are still active when you return to the Debugger within the same terminal session.
To save the breakpoints that you have set in the Debugger:
Choose Breakpoint ® Save.
The system saves all of the breakpoints that you have set in the current program. These breakpoints will remain active until you either explicitly delete them or log off from the system.
You can also delete breakpoints that you have saved:
By deleting individual breakpoints from the display and then saving again. In this case, only your selected breakpoints will be deleted.
By choosing Breakpoint ® Delete all. In this case, the system deletes all dynamic breakpoints.
Managing Dynamic Breakpoints
The ABAP Debugger provides a convenient user interface for managing breakpoints. To open the breakpoint display, choose Breakpoints, or, from the menu, Goto ® Control debugging ® Breakpoints.
Example
Functions
This display mode contains the following functions for breakpoints:
Breakpoint Display
The scrollable breakpoint display contains up to 30 dynamic breakpoints. For breakpoints that you set directly, the program name and line number at which the breakpoint occurs are displayed. For special breakpoint forms, the list displays the statements, events, subroutines, and module calls at which the relevant breakpoints are set.
Counter
In the breakpoint display, you can specify a counter. When you use a counter, the breakpoint is not activated until it has been reached a specified number of times. For example, if you enter 5 for the counter, the breakpoint is not activated until it is reached for the fifth time. After the breakpoint has been activated, it remains so, and the counter no longer appears in the breakpoint display.
Deleting Breakpoints
Position the cursor on the breakpoint that you want to delete, and either double-click the line or choose Breakpoint ® Set/delete. To delete all breakpoints, choose Breakpoint ® Delete all.
Activating and Deactivating Breakpoints
Position the cursor on the breakpoint that you want to activate or deactivate and choose Breakpoint ® Activate/deactivate.
Watchpoints
Like a breakpoint, a watchpoint is an indicator in a program that tells the ABAP runtime processor to interrupt the program at a particular point. Unlike breakpoints, however, watchpoints are not activated until the contents of a specified field change. Watchpoints, like dynamic breakpoints, are user-specific, and so do not affect other users running the same program. You can only define watchpoints in the Debugger.
Use
You set watchpoints in the Debugger to monitor the contents of specific fields. They inform you when the value of a field changes. When the value changes, the Debugger interrupts the program.
Features
You can set up to five watchpoints in a program.
See also Setting Watchpoints.
You can also specify the conditions on which a watchpoint is to become active.
You can specify logical conditions between up to five conditional watchpoints.
See Specifying a Logical Expression.
You can define watchpoints as either local or global. If you define a global watchpoint, it is active in all called programs. Local watchpoints are only active in the specified program.
You can change and delete watchpoints.
See Changing Watchpoints.
You can use watchpoints to display changes to the references of strings, data and object references, and internal tables.
See Memory Monitoring with Watchpoints
Setting Watchpoints
If you want to interrupt a program when the contents of a field or structure change, use a watchpoint. You can set up to five watchpoints, including watchpoints for strings.
A watchpoint can be either local or global. Local watchpoints are only valid in the specified program. Global watchpoints are valid in the specified program, and also in all the other programs it calls.
Procedure
To set a watchpoint, start the Debugger and proceed as follows:
Choose Breakpoint ® Create watchpoint or the corresponding pushbutton. The Create Watchpoint dialog box appears:
Decide whether you want to set a local or global watchpoint.
Enter the program and the name of the field for which you want to set the watchpoint. In the Program field, the name of the program currently running is always defaulted.
If you want your watchpoint to be activated each time the contents of the field change, the definition is now complete, and you can return to the Debugger by pressing ENTER .
To create a conditional watchpoint, that is only activated when a particular situation arises, choose one of the following relational operators.
Operator
Meaning
<
Less than
<=
Less than or equal
=
Equal
<>
Not equal
=
Greater than or equal
Greater than
You can use the Comparison field option to specify whether the comparison is to be carried out with a value that you specify or with the contents of another field. Depending on your choice from step 6, enter a value or a field for the comparison.
Result
The system confirms the watchpoint and adds it to the list in the display. When you finish your debugging session, the watchpoint is automatically deleted unless you have explicitly saved it.
Specifying Logical Links
If you have more than one conditional watchpoint, you can specify a logical link between them:
OR
Only one of the specified conditions must be met
AND
All of the conditions must be met.
Changing Watchpoints
Choose Goto ® Control debugging ® Watchpoints or the Watchpoints pushbutton to display the watchpoint list. The following dialog box appears:
Choose the pencil icon in the line containing the watchpoint you want to change.
Change the watchpoint attributes in the Create/Change Watchpoint.
Choose ENTER .
Deleting Watchpoints
You cannot delete watchpoints by choosing Breakpoint ® Delete or Breakpoint ® Deactivate/activate. Instead, proceed as follows:
Choose Goto ® Control debugging ® Watchpoints or the Watchpoints pushbutton to display the watchpoint list.
Choose the trashcan icon in the line containing the watchpoint you want to delete.
Memory Monitoring with Watchpoints
You can use watchpoints to display changes to the references of strings, data and object references, and internal tables. By placing an ampersand (&) in front of the object name, you can display the reference in question in hexadecimal format. With internal tables, you can also display the table header by placing an asterisk (*) at the beginning of the name.
&objectname
Displays the references of strings, internal tables as well as data and object references
*itab
Displays the table header of the internal table itab
Example
If a watchpoint is set for the object in question at runtime, the program is stopped as soon as the reference is changed. A short dump can be intercepted in this way to stop the program being terminated when the memory is overwritten.
Analyzing Source Code
The Debugger contains an extensive range of functions that help you to analyze the source code of a program. You can step through the source code of a program in four different ways. For further information, refer to Stepping Through the Source Code
For information about functions within the source code display, see Displaying the Source Code
There are also different display modes that provide various information and display the contents of individual fields, tables, and so on:
Reward if usefull -
I Wonder whether it is possible to write an abap program
which fulfills following requirement.
just like the tcode which is used to log off /nex.
but it closes all sap windows without warning on the same server.
what i want,
i want to write a progam and then create a tcode for that say zex.
on entering that tcode the system close all sap window on the same server except one.
eg:
say i have opened 4 sessions of prd server. and i want to close 3 of them.
then i execute custom tcode say zex. and out of 4 --3 sessions will be closed.
no of sessions to be closed = total no of open sessions - 1.
dont know whether it is possible>
ur suugesstions wanted.
there are FM present.
THUSRINFO
call 'syst_logoff'.
but none of them suits to my requirement.,Get list of modes and delete specific modes are not easy, you will mostly require use of "forbidden" call system command like ThUsrInfo.
What if you want to try ?
Look at include TSKHINCL for opcode values, perform some where-used on those constants, if unlucky you find SAP report using the system calls, if you are lucky the call is executed in a useful function module (name starting with TH_)
The result could look like following samples, informative only, neither tested nor intended to be tested...
DATA: tid TYPE utid,
modes TYPE sy-index,
mode_list type table of modus with HEADER LINE,
modus type modus.
* Current session id (Look at TH_USER_INFO)
CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_usr_attr
ID 'TID' FIELD tid. " Id of current session
* Number of modes (Look at form modus_liste of RSM04000_ALV)
CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_mode_count
ID 'TID' FIELD tid
ID 'MODES' FIELD modes. " number of modes
CHECK modes GT 1.
* List of modes with transaction (Look at TH_SELECT_MODE)
*CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_get_mode_list
* ID 'TID' FIELD tid
* ID 'MODE_LIST' FIELD mode_list. " mode list
* Delete a Mode (Look at TH_DELETE_MODE)
CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_delete_mode
ID 'MODE' FIELD mode.
Try in a sandbox...
Regards,
Raymond
PS: /nex is not an actual transaction, trying to enter in debug mode (even system) in what is probably a C program gives little chance of success... -
Is it possible to call ms-dos command in abap program?
Hi,
is it possible to call ms-dos command in abap program?
Thanks.Hi Cemil,
You probably have your answer here:
[Re: DOS/Windows command in app server;
You create your external command with SM69 (you can test it with SM49).
Then you call this command with function module "SXPG_COMMAND_EXECUTE".
(See function group SXPT for all the calls to external commands).
Regards,
Thomas -
Can we use is null in our select statement in ABAP program
hi,
I want to use 'is nul' or 'not null' in select statement of my ABAP program for any field. I have written below query but I am getting sy-subrc = 4 and getting no data. Can anyone resolve this.Hi,
I think you've posted your question on the wrong forum. This is the SAP Business One development forum which is not part of ERP and doesn't include any ABAP or Netweaver programming.
For a list of forums please see here:
http://forums.sdn.sap.com/index.jspa
Kind Regards,
Owen -
How to upload Excel file in BI using function module in abap program
How to upload Excel file in BI using function module in abap program?
Hi Anuj,
To upload the file , you can try a standard program "RSEPSFTP" .
while you execute the program , a selection screen appears in which the inputs should be give as
RFC destination - The target server name
FTP command- PUT
local file - your file name
local directory - path of your local file
remote file - your target file name
remote directory - where it has to be stored
Hope this is useful for you
Thanks & regards
Anju -
How to get a parameter from BPC and use it in ABAP program
Hello gurus!
I got a problem...
SAP BPC will send parameters such as year, division, category, company code and so on via script logic to SAP BW.
I need to get these parameters from BPC and use them in a ABAP program as a filter.
This ABAP program will do several routines and return new values to BPC. It must be made on ABAP and I need to filter data to avoid performance issues.
Does anybody knows how to do it? or have a example of it?
Thank you in advance.
Regards,
Rubens KumoriHello, I'm looking for a suggest.
I need to pass two parameters (users can input them in a data manager package in bpc) to a BAdI.
In this BAdI I write a code that store those parameters in a InfoObject.
The problem is:
- one parameter is for CATEGORY value. CATEGORY is a dimension of the application and I read the value with a code like this:
READ TABLE it_cv INTO l_s_it_cv
WITH TABLE KEY dim_upper_case = 'C_CATEGORY'.
- other parameter is a generic DATE. this parameter is not a dimension of the application and I don't know how I can retrieve this value in BAdI.
READ TABLE it_cv INTO l_s_it_cv
WITH TABLE KEY dim_upper_case = '.....'.
The data manager dynamic script is:
PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%")
PROMPT(TEXT,%SELECTED_DAY%,"Write the date (format YYYYMMDD)",)
I also have a dynamic constant that assign the name %CATEGORY_DIM% to "C_CATEGORY" value.
Can anyone help me?
thanks a lot
Edited by: Luca Novali on Feb 13, 2012 3:49 PM -
How to copy/download all ABAP programs in a text with a single report ?
How to copy/download all ABAP programs in a text format with a single report/TC ?
How to copy/download ABAP source code with all include programs ?....
we need to search & copy all include programs everytime....Hi,
check this link
downloading programs
Regards -
How To Call a Broadcasting Template within an ABAP program
I was wondering if anyone knew how to call the Broadcast template via an ABAP program so it will execute? The scenario that I have is we are doing validations via BW. We put the data (for conversion reasons) through validation rules and then load a data target. From this, there are 2 situations that could occur:
1) There are errors
2) There are not any errors
If #1 is true, then I would like to execute the Query Broadcasting Template that I have created. If #2 is true, then I would like to execute another process via the ABAP program. In the past, I was successful using exception reporting via reporting agent, since I was able to call that program but the report did not look good at all. Please let me know if there is a program that I could call in order to execute this broadcast that I have set up.
Best Regards,
TimHello,
although this is an old threat, but do you have any hints on how to dynamically change the template when broadcasting?
kind regards
Murat -
Sometimes RSCRM ABAP program is taking much time
Hi,
I am working in SAP BW 3.1 system. We have one RSCRM Abap program to send the data to Data stage team.
We kept this process in process chain. Some times it takes much time. If i cancel that job and repeat this process it will complete in few minutes.
Please suggest me what would be the reason.
ThanksYou may want to take a look at the following OSS Notes:
[OSS Note 605213 - RSCRM: Performance|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=605213]
[OSS Note 989461 - RSCRM:code for improving performance in VALUES_READ|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=989461]
[OSS Note 1137302 - RSCRM: Memory usage optimization|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1137302]
Maybe you are looking for
-
Preview Icons Missing after Drag and Drop from Cumulous/Mediadex
When using Cumulous to drag images from the catalogue to a folder, the image icon reverts to the generic .eps. or tiff or jpg. Let me add this this is inconsistent. Some images from the folder retain their icon identity, while others don't. Further,
-
ICM : Unable to login into DETECTIVE Business role
Hi , When I try to log in into DETECTIVE role ,I got issue "Security settings are not maintained, contact your system administrator" . I have SAP_ALL access and I copied the pfcg role which is assigned to business role and provided full authorization
-
Error CX_RSR_X_MESSAGE during DTP execution
Hello, I'm trying to load data from PSA into the infocube using DTP All packages have loaded successfully except one with the error CX_RSR_X_MESSAGE Error Message: An exception occurred that was not caught. The exception 'CX_RSR_X_MESSAGE' was raised
-
Hi: We are using OC4J 9.0.3 that is bundled into 9iAS 9.0.3 on Windows 2000. We are starting/stopping OC4J using Enterprise Manager Web Site. Is there a way to display java logs (System.out's in the code) somewhere when we access a web application th
-
So, Verizon Wireless released the 602 update to the Gingerbread OS for the Droid X, and the calendar reminder popups (notifications) are still NOT working properly. This is VERY frustrating, as I use these notifications (reminder pop ups) for everyt