Showing posts with label abap basics. Show all posts
Showing posts with label abap basics. Show all posts

Wednesday, May 4

WD4A-Format the Values appearing on value Axis of Business Graphic

Web Dynpro ABAP has a great feature  of displaying data in a graph. This is possible by using the Business Graphic UI element of web dynpro ABAP. There are various types of graphs possible. Some of them are bar, area, portfolio, point, column diagram, histogram etc. one beatifully created graph is shown in the image below.
There are mainly two things a developer has to know while creating a business graph. The series and the category. What appears on the X axis is called category and the what appears on the Y axis is called the series. There are two types of series in web dynpro ABAP viz simple series and complex series. When the developer knows what all values need to be plotted and exactly how many series will be required at the design time, simple series is used. In this post I will discuss simple series mainly.
The above shown graph is a stacked graph. There are various ways in a chart type can be represented. One important thing to notice in the above graph is the format of the Y Axis values. There is a property called format in the Y Axis or the value axis. When we specify a particular format, all values displayed on the Y axis are displayed in that format. How do we specify a format. To specify a format, there is a syntax. Ideally, Y Axis would have numbers. But due to specific requirements, text can be appended before and after the number.

This is how it can be done.
Put the free text in inverted commas. If you want to create space between the free text and the other text or the number, put spaces in the inverted commas after the free text. For example :

$Abs$Sep10" USD" gives the label 1234.5689 USD for a value of 1,234.56.


“The percentage value is “$Percent0.“ %“ gives the label The percentage value is 25 %.


Related Articles :

Basics of Web Dynpro ABAP
ABAP Data Types and Objects
ABAP Statements
WD4A - Topics to be covered in the upcoming posts
WD4A - Introduction
WDA - SAP Logon Procedures
WD4A-Navigate from one view to another and back to previous view
WD4A - How to Calculate next 12 months from current month in web dynpro ABAP
WD4A - Validate Inputs in a web dynpro ABAP Application

Friday, March 11

ABAP Data Types and Objects

There are physical units with which ABAP statements work at runtime. These units are called program data Objects. Data object occupy space in memory.
There are some technical attributes associated with each ABAP data object. Like Data type, field length,
and number of decimal places.

The data type tells how the contents of a data object should be interpreted by ABAP statements.
data type can also be defined independently.
This can be done in the declaration part of an ABAP program using the TYPES statement. This can also be done in the ABAP Dictionary.
The data types you will use in a program depend on how you will use your data objects.
ABAP program can pass simple input data to the database also it can process
and out a large quantity of structured data from the database. following
data types are present in ABAP.

Predefined Types
Five predefined non-numeric data types:
Date (D), Time (T), Character string (C), Numeric character string (N) and
Hexadecimal (X)

Three predefined numeric types:
Packed number (P), Integer (I) and Floating-point number (F).
For D, F, I, and T,field length is fixed. For C, N ,X and P field length gets determined when you declare the data object in your program.
in a business context , Data type P is useful as it can give exact calculations. number of decimal places should be specified When you define an an object of type P.

User-defined Types
Own elementary types can always be defined using the TYPES statement.the basis of elementary data types will be predefined data types.For eg: we can define a data type P_3 with three decimal places. This is based on the predefined data type P. So now elementary data objects can be defined using elementary data types. Elementary data types can be used to form Aggregated data types
An aggregated data type can be an internal table or a structure.

Structures
ABAP does not have predefined
structures. We need to define structures, either in the ABAP program in
or in the ABAP Dictionary.
What is a structure used for ? structures can group work areas that belong together logically. For example,
Structures can contain elementary as well as aggregated data types
Internal Tables
Internal tables is a series of lines that all have same data type.
Characteristics of internal table are :

line type.
The line type can be any ABAP data type - a
Structure, an elementary type or an internal table.
key
key is used to identify lines in the internal table.
Access type
How ABAP statements will access the entries of the internal table is determined by the access type.
three access types are unsorted tables, sorted index tables and hash tables.
For index tables, access to the table entires is done by specifying the index or the key.
Hashed tables can only be accessed by specifying the key.
The system has its own hash algorithm for managing the table.

Data Types for Reference
in ABAP Objects , references are used to refer to objects. There are reference variables where we store the references. The way the program handles a reference is determined by it data type. there are various types of interface and class reference variables.
Reference variable can become component of a internal table or a structure.

Declaring Data Objects
Declaration of data objects in done using the declarative statements of ABAP. This is done before actual execution of the program starts.
The interface parameters of the routine become local data objects as soon as the routine is called. If technical attributes for the data type of these data objects is defined during interface definition then it is ok otherwise the data object take up the attributes of the parameter assigned to it at runtime.

Related Articles :

Basics of Web Dynpro ABAP
ABAP Statements
WD4A - Topics to be covered in the upcoming posts
WD4A - Introduction
WDA - SAP Logon Procedures
WD4A-Format the Values appearing on value Axis of Business Graphic
WD4A-Navigate from one view to another and back to previous view
WD4A - How to Calculate next 12 months from current month in web dynpro ABAP
WD4A - Validate Inputs in a web dynpro ABAP Application

ABAP Statements

ABAP Source code consists for comments and statements.
Various kind of ABAP statements are :
Declarative statements
They define data type or declare data objects. A collection of declarative statement in the program is called declaration part.
Examples of declarative keywords: TYPES, DATA, TABLES


Modularization Statements

processing blocks in an ABAP program are defined by these statements.
The modularization keywords are of two types:
 Event Keywords and Defining keywords

Event Keywords are used to define event blocks. There are no
special statements to conclude processing blocks – a processing block ends when the next proc block starts.
Examples of event keywords are:
START-OF-SELECTION, AT USER-COMMAND, AT SELECTION SCREEN,
Defining keywords Are used  to define dialog modules, methods , subroutines, function modules.
We can conclude them using the ENDstatements.

Examples of definitive keywords: MODULE ... ENDMODULE.
FORM ..... ENDFORM, FUNCTION ... ENDFUNCTION.


Control Statements

within a processing block , Control statements control the flow of an ABAP program
according to certain conditions.
Examples of control keywords: IF, WHILE, CASE


Call Statements

Call Statements call processing blocks
The block can reside anywhere either in the same program or in other program.
Examples of call keywords:
SUBMIT, LEAVE TO, PERFORM, CALL, SET USER-COMMAND,


Operational Statements

Operational Statements process the data.
 Examples of operational keywords:
MOVE, ADD. WRITE,

Database Statements

Database Statements access the tables form central database
system. These are of 2 types: Open SQL and Native SQL.
Open SQL
Open SQL contains only Data Manipulation
Language (DML) statements, such as , IINSERT, DELETE and SELECT.No
Data Definition Language (DDL) statements (such as CREATE TABLE or CREATE INDEX) are present in open SQL..
Functions of this type are contained in the ABAP Dictionary
ABAP programs that use only Open SQL statements to
access the database are fully portable ie they can be run on a different database or operating system. Database interface helps in the conversion of OPEN SQL into commands of the relevant database.

Native SQL
These statements go directly from the database interface to the database without
being converted. It is possible to use DDL operations in native SQL. The ABAP Dictionary uses
Native SQL for database tables creation.it is recommended to use open sql in ABAP programs. Data dictionary used native sql and is created for DDL so better make use of Data dictionary if you are creating a ABAP program.