Monday 8 July 2013

JULY 8

I learned to know the Program Types, Report Components and created the first program.


Exploring the Development Environment

development object is anything created by a developer. Examples of development objects are programs, screens, tables, views, structures, data models, messages, and includes.
The R/3 system contains tools for creating and testing development objects. These tools are located in the R/3 Development Workbench. To access any development tool, we go to the workbench.
The workbench contains these tools to help us create development objects:


  • The ABAP/4 program editor where we can create and modify ABAP/4 source code and other program components
  • The Data Dictionary where we can create tables, structures, and views
  • The Data modeler where we can document the relationships between tables
  • The Function library where we can create global ABAP/4 function modules
  • The screen and menu painters where we can create a user interface for our programs
The following testing and search tools are also available:


  • the ABAP/4 Debugger
  • the SQL trace tool used to tune SQL statements
  • the runtime analyzer for optimizing our program's performance
  • a where-used tool for impact analysis
  • a computer-aided test tool for regression testing
  • a repository search tool for finding development objects
  • the Workbench Organizer for recording changes to objects and promoting them into production

All development objects are portable, meaning that we can copy them from one R/3 system to another. This is usually done to move our development objects from the development system to the production system. If the source and target systems are on different operating systems or use different database systems, our development objects will run as-is and without any modification. This is true for all platforms supported by R/3.


Discovering Program Types

There are two main types of ABAP/4 programs:
  • reports
  • dialog programs

Defining Reports

The purpose of a report is to read data from the database and write it out. It consists of only two screens.



The first screen is called the selection screen. It contains input fields allowing the user to enter criteria for the report. For example, the report may produce a list of sales for a given date range, so the date range input fields would appear on the report's selection screen.
The second screen is the output screen. It contains the list. The list is the output from the report, and usually does not have any input fields. In our example, it would contain a list of the sales that occurred within the specified date range.
The selection screen is optional. Not all reports have one. However, all reports generate a list.


Defining Dialog Programs

Dialog programs  are more complex at the program level. They can contain any number of screens, and the screen sequence can be changed dynamically at run time. On each screen, we can have input fields, output fields, pushbuttons, and more than one scrollable area.


Discovering Report Components

ABAP/4 reports consist of five components
  • Source Code
  • Attributes
  • Text elements
  • Documentation
  • Variants
Only the source code and program attribute components are required. The rest of the components are optional.
All development objects and their components are stored in the R/3 database.


Discovering the Program Run-time Object

ABAP/4 programs are interpreted; they are not compiled. The first time we execute a program, the system automatically generates a run-time object. The run-time object is a pre-processed form of the source code. However, it is not an executable that we can run at the operating system level. Instead, it requires the R/3 system to interpret it. The run-time object is also known as the generated form of the program.
If we change the source code, the run-time object is automatically regenerated the next time we execute the program.



Introduction to Program Naming Conventions

The company we work for is a customer of SAP. Therefore, programs that we create at our company are called customer programs.
Customer development objects must follow naming conventions that are predefined by SAP. These conventions are called the customer name range.  For Programs-
  •  the customer name range is two to eight characters long 
  • the program name must start with the letter y or z. SAP reserves the letters a through x for their own programs.

Creating My First Program

What follows is a description of the process that we will follow to create a program.
When we sign on to R/3 to create our first ABAP/4 program, the first screen we see will be the SAP main menu. From there, we will go to the Development Workbench, and then to the editor. We will enter a program name, and create the program. The first screen we will see will be the Program Attributes screen. There, we must enter the program attributes and save them. We will then be allowed to proceed to the source code editor. In the source code editor, we will enter source code, save it, and then execute the program.

We can follow this procedure to create our first program. 
  1. From the R/3 main menu, select the menu path Tools->ABAP/4 Workbench. A screen with the title ABAP/4 Development Workbench is displayed.
  2. Press the ABAP/4 Editor button on the application toolbar. The ABAP/4 Editor: Initial Screen is displayed.
  3. In the Program field, type the program name Zdemo_program.
  4. Press the Create button. The ABAP/4: Program Attributes screen is displayed. The fields containing question marks are required.
  5. Type My First ABAP/4 Program  in the Title field. By default, the contents of this field will appear at the top of the list.
  6. Type "executable program" in the Type field. It indicates the program is a report.
  7. Type "test program" in the status field.
  8. Type "Basis"  in the Application field. The value in the Application field indicates to which application area this program belongs. The complete list of values can be obtained by positioning your cursor on this field and then clicking on the down-arrow to the right of it..
  9. To save the program attributes, press the Save button on the Standard toolbar. The Create Object Catalog Entry screen is displayed.
  10. Type "$TMP" in the package field and press the Local Object button. The program attributes screen is re-displayed. In the status bar at the bottom of the screen, the message "Attributes for program saved" appears. 
  11.  The ABAP/4 Editor: Edit Program screen is displayed.
  12. At line 1 it contains the statement Report zdemo_program.If it does not contain this statement , type it then.
  13. On line 2, type write 'Hello SAP world'. Use single quotes and put a period at the end of the line.
  14. Press the Save button on the Standard toolbar.
  15. To execute your program, choose the menu path Program->Execute. A screen with the title My First ABAP/4 Program is displayed, and the words Hello SAP world are written below it. This is the output of the report, also known as the list.
These are the Common Problems Encountered While Creating a Program and Their Solutions

Trouble
Solution
When we press the Create button, we get a dialog box saying Do Not Create Objects in the SAP Name Range.We have entered the wrong program name. Our program names must start with y or z. Press the Cancel button (the red X) to return and enter a new program name.
When we press the Create button, we get a dialog box with an input field asking for a key.We have entered the wrong program name. Our program names must start with y or z. Press the Cancel button (the red X) to return and enter a new program name.
We are getting a Change Request Query screen asking for a Request Number.On the Create Object Catalog Entry screen, do not enter a value in the Development class field.
Press the Local Object button instead.
Various transaction codes (T-codes) are used in ABAP/4. Most frequently used one are:
  • se38 - ABAP editor 
  • se11 - ABAP dictionary
  • se51 - screen painter
  • se80 - object navigator

In the above given steps for creating program, we can replace step 1 and step 2 by using T-code se38. It will directly take us to program field.