You are on page 1of 35

15/06/2015 - 1st Class

-----------------------

ERP( Enterprise Resource Planning) :-


--------------------------------------
It is an enterprise-wide information System design to co-ordinate all the
resources,information and activities needed to complete business processes such as
order fulfillment, billing etc.

Purpose of ERP :-
-----------------
->It is the integration of all business processes and sub-processes into a single
unified system and this system is formulated and implemented in an organization to
effectively and efficiently reach the business goals of the organization.
->To implementing a Systems where a high degree of integration between applacations
is required.
->To manage the whole company in a single process.
->to improve productivity and to enable easy communication with clients and server.

Benefits of ERP :-
------------------
-> To increase productivity Cycles,integration of Systems and flexibility.
-> To enable new business to grow
-> Reduce expense on business process:- It enables the enterprise to improve work
efficiency and to easily maintain the inventory which reduces wasteful expenses on
stock.It enables scheduling and shift management.
-> Improve Accuracy :- It enables cost effective transactions, which are more
accurate as compare to manual systems.
-> Reduced need of Human Resources.

Evolution of ERP :-
------------------
ERP is the evolution of Manufacturing Requirements Planning(MRP-II).From Business
propective, ERP has expanded from co-ordination of manufacturing processes to the
integration of enterprise-wide backend processes.

Summarizes the Evolution of ERP from 1960s to 1990s :-


------------------------------------------------------
Periods Systems Descriptions
------- ------- ------------
1960s Inventory Management & control combination of IT and Business
Processes of maintaining the appropriarte level of Stock in a warehouse.

1970s Material Requirement Planning(MRP) Utilizes software applications for


scheduling production processes

1980s Manufacturing Reqiurement Planing(MRP II) It utilizes software


application for co-ordinating manufacturing processes from product planning to
product distribution.

1990s ERP Multi-Module application software for improving


the performance of the internal business processes. It includes application modules
for supporting marketing,finance,accounting and human resouces.

SAP : (System, Application and Product for Data Processing):-


-------------------------------------------------------------
SAP has a high level of integration among its individual application, has guarentee
consistency of data throughout the system and company itself.
SAP R/2 :-
----------
It is a set of co-ordinated business applications from SAP. It was the first
compact software package for the whole spectrum Business Applications.It is 2-tier
Architecture. SAP R/2 runs on mainframes such as IBM, Amdahl, siemens The Current
version of R/2 is 6.1. This mainframe is not open, so with the help of Application
Link Enabled technology, we can link with R/3 systems and share online data.

SAP R/3 :-
-----------
-> R/3 is tightly integrated, large scale Business Application for open client-
server system. and distributed open system it comes needed by most large
Corporations.
-> This Application co-exist in one homogeneous environment.
-> Production Database sizes range from 12 GB to near 3 TB.
-> Around 8000 Database Tables are shipped with the standard delivery R/3
Product.It Supports unlimited number of servers and a variety of hardware
Configuration.
-> SAP R/3 is 3-tier Architecture.

Landscape :-
------------
It identifies how the system are physically seperated in SAP implementation.
Example->

Developement Server ------> Testing (or) Quality Server ---------> Production


Server

Developement Server ----> Testing (or) Quality Server ------>Pre-Production


Server ---> Production Server

Dispatcher :-
--------------
It is a component which is responsible for Client request and Storing the request
in a queue.

Queue :-
--------
It is a temporary place or memory where all the request are stored based on the
types of request.
These requests are send to the service related to their request.

Services :-
-----------

1) Dialog Service :- It is used for I/O Operation.

2) Enqueue Service :- It is responsible for Applying the locks and releasing the
locks to maintain the consistency of data.

3) Update Service :- It is used for managing the database operation like


insert,delete,update,select,create etec.

4) Spool Service :- It is used for interacting with external devices.

5) Background Service :- It is responsible for managaing the background jobs like


executing a particular interlock time.
6) Messaging Service :- It is responsible for communicating between two SAP Server
and SAP - Non-SAP Server.
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
17/06/2015
-----------------------
Type of SAP Projects :-
------------------------------------
There are 5 types.........
1) Implememtation Project
2) Upgradation Project
3) Role-Out Project
4) Support Project
5) Enhancement Project

ASAP Methodolgy :-
-------------------------------
ASAP (Accelerated SAP) methodology has been a key part in ensuring that SAP
projects are delivered on time and within budget.
This has helped to overcome many of the issues previously identified with SAP
implementation.

ABAP WorkBench :-
--------------------------------
It is an environment containing set of tools like ABAP Editor, Object Navigator,
Function Builder, Class Builder,Smart Forms, Script etc.

Package :-
-----------------
It is a cointainer of development objects.
All Objects are stored in packages.

T-Code(Transaction Code) :-
---------------------------------------------
Transaction means performing some task/process to do the particular Business(es).
Code means piece of given Information.
E.g.,
SE38 : ABAP Editor
SE11 : ABAP Dictionary
SE21 : CREATE Package
BP : Business Partner

ABAP Data Dictionary :-


--------------------------------------
Data Dictionary is a central source of data in a data management system. Its main
function is to support the creation and management of data definitions(DDL).
Its works,
TABLE
VIEW
SEARCH HELP,
DOMAIN,
DATA TYPE,
etc.
Step to Create Database table..........
----------------------------------------------------------
Go to SE11->Provide Table name start from Z (or) Y e.g. ZEMP
-> Click at 'CREATE' Button
-> Goto "Delivery and Maintenance" Tab -> Provide info in Delivery Class and Data
Browser/Table View Maint.
-> Goto "Fields" Tab -> Provide Field name, Data Type,Length and Short Description
and Also check Key and Initials.
-> Select "Technical Settings" Button -> Provide Data Class and Size Category ->
Save(ctrl + S) and Revised<-> Active(Shift + F8)
-> Select Back(F3)
->Give Package Name and Save
->Check(ctrl + F2) and Activate(ctrl + F3).

Step to fill data in table manually....


-------------------------------------------------------
Goto "Utilities" Menu ->Table Contents -> Create Entries
-> Provide entry and save
-> go Back(F3)

Package Name : ZGBS_TRAINING_2015


-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
18/06/2015
-----------------------
Data Element :-
-----------------------
A Data Element is the description + Domain( Data Type + Length) i.e., so that a
data element is a pack of all such as data type,length,description.

Domain :-
--------------
It is used to define the Technical Attributes(Data Type and Length) and the Value
Ranges( Fixed Values and Intervals).
A domian is assigned to a data element.
All table fields or structure components that use this data element, have the value
range defined by the domain.

Advantages of Domain and Data Element :-


------------------------------------------------------------------
-> Data Elements are used to provide F1 Help.
-> Re-usability.
->Foreign Key Definition is only possible for fields with Data element

Step to create Domain :-


--------------------------------------
Goto T-Code : SE11
->Select "Domian" Radio Button -> Provide any meaningful name start with Z or Y
i.e. ZEMPID-> Select "Create" Button
->Provide Short Description,Data Type and No. Characters(Length)s
-> Save -> Provide Package Name ->Enter -> Check -> Activate.

Step to Create Data Element :-


------------------------------------------------
Goto T-Code : SE11
-> Select "Data Type" Radio Button -> Provide any meaningful name start with Z or Y
i.e. ZEMP_ID-> Select "Create" Button
-> Provide Short Description
-> Select "Domian" Radio Button -> Provide Domain Name
-> Select "Field Level" Tab -> Provide Short, Medium, Long and Heading Text/
Description
-> Save -> Provide Package Name ->Enter -> Check -> Activate.

Top-Down :-
------------------
Table Field -> Data Element -> Domian

Step to Create Data Element through Top-Down :-


-------------------------------------------------------------------------------
Give Field Name i.e. EMP_CLASS ->Provide Data Element any meaningful name start
with Z or Y i.e. ZGBS_CLASS -> Double Click on Data Element name
->Select "Save" -> Select "YES" (Create Data Element) -> Provide Short Description-
> Goto "Field Level" Tab and give shor, medium,long and Heading text/description
-> Goto "Data Type" Tab -> Provide Domian any meaningful name start with Z or Y
i.e.ZGBS_CLASS -> Double Click on Domain name-> Select 'Yes' -> SAVE
-> ENTER->Select "YES"(Create Domain) -> Provide Short Description,Data Type and
Length
-> Save -> Provide Package Name ->Enter -> Check -> Activate->Back(F3) -> Activate-
>Enter -> Back(F3) -> Check
-> Activate the Table.

Bottom-Up :-
--------------------
Domain -> Data Element -> Table Field

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
19/06/2015
-----------------------
Use of Lower-Case Check-Box in Domain :-
-------------------------------------------------------------------
-> To display as same as value provided

Step to Check the Lower-Case Check-Box in Domain :-


-----------------------------------------------------------------------------------
---
Goto Domain in Data Dictionary-> Select "Change" Button -> Select "Definition" Tab
-> Check "Lower Case" Check Box.
-> Save-> Check-> Activate.

Structures :-
-------------------
A Structure is a set of fields.
A Structures never stored data.
Structure never have any key.
IF 2 tables contain same 5 fields out of 8 fields,then better to define 5 fields in
Structure instead of Maintaining all the fields in both tables again and again
And call the Structure explicit into both Table.
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
23/06/2015
-----------------------
Steps to Create Structure :-
--------------------------------------------
Goto T-Code : SE11
-> Select "Data Type" Radio Button -> Provide any meaningful name start with Z or Y
i.e. ZEMPSTRUC-> Select "Create" Button
-> Select "Structure" Button in "Create Type" Popup-> Provide Short Description->
Select "Components" Tab
-> Provide value in Component and Component Type->Save->give Package Name -> goto
"Extras" Menu -> select "Maintain Enhancement Category"
-> Check "Can be Enhanced(Character-Type or Numeric )"-> Enter
->Check->Activate.

Include Structure( How to Use Structure) :-


--------------------------------------------------------------------
-> Goto SE11 -> Provide Table and select "Change" -> write ".INCLUDE" in field Name
and Structure name in "Data Element"
-> Save , Check and Activate
-> Select "Include" Field -> Selct "Expand All" Button.

Append Structure :-
---------------------------------
It attach the structure at the end of the table.
(or)
Add the set of fields at the end of the Existing Table(Already Created) i.e.,Either
Custom or Standard Table.
TO add the New Fields to the already completed tables at the end to make sure that
existing table structure is not distributed.
Nomenclature for Field in Append Structure always Starts with "ZZ...." such as
ZZPRODUCT as Field Name Because we appending the field in
Standard or Custom Table there may be any chances of avaibility of any field with
name.

Handling with Currency(Amount) and Quantity Fields in Table/Structure Creation :-


-----------------------------------------------------------------------------------
--------------------------------------------
AMOUNT :-
-----------------
Data Type :- CURR(Currency) = 10.00
Ref Data Type :- CUKY(Currency Key) = Either INR or $ or Euro

QUANTITY :-
-------------------
Data Type :- QUAN(Quantity) = 10.00
Ref Data Type :- UNIT(Unit of Measurement) = gram or KM or dyne

N.B. You must specify reference tables and reference fields for fields containing
currency amounts or quantity data.
You have specified either only the reference field or the reference table
and have not maintained either entry.
Field INDIAN_SAL: Decimal places are corrected to 2 (proposed value for
CURR)
ZCMPY-INDIAN_SAL (specify reference table AND reference field)
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
24/06/2015
-----------------------
Foreign Key:
---------------------
Field in one Table(Foreign Key Table) that is connected to another table(Check
Table) via Foreign Key Relationship
To Validate the data being entered in Foreign Key Table with a valid set of values
from Check Table.

Norms for defining Foreign Key :


---------------------------------------------------
a) Foreign Key definition is only possible for fields with Data Element i.e.,
Foreign Key Field should refer a Data Element Always.
b) The Domain name of the Foreign Key Field and Check Table field should be same
and make sure that at least the Data Type and length of the field must be same.
c)The Field in the Check table should be Primary Key.

N.B., Check table ZAEC has no key field with the domain
ZEMPID of the field COLLEGE_ID

Views :-
------------
A view is a logical subset of data from one or more tables.(as SQL Definition)
(or)
Combination of more than one tables with selected fields from those tables
condition based on same fields that are available in those tables.
It never contains any data physically.

Data about an application object is often distributed on several tables.


By Defining a view, we can define an application-dependent view that combines the
data.
The Structure of such a view is defined by specifying the tables and fields used in
the view.Field that are not required can be hidden.
A view can be used in ABAP Programs for Data Selection.

There are 4 types of view :


1)Database View :-
------------------------------
Application Specific Data often distributed on several database tables.
A database view provides an application specific view on such distributed data.

E.G., FI -> FKKVKP,DFKVKP


Combine both tables based on PK Field

2)Projection View :-
-------------------------------
Used to hide fields of a table.
This can minimize the interfaces e.g., you can see the database table but only read
and write the field contents actually needed.
A Projection View contains exactly one table.
Can't define any selection conditions for projection views.
3)Help Views :-
------------------------
Can be used as Selection Method in Search Helps.

4)Maintenance Views :-
-------------------------------------
Its permits to maintain the data distributed on several tables for one application
object at one time.
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
29/06/2015
-----------------------
Types of Tables:
-------------------------
1)Transparant Table -> One to One Relationship 1:1
2)Pooled Table-> One to many Relationship 1:N
---------------------------------------------------------------------------
Logical tables that must be assigned to a table pool when they are defined.
Several pooled tables can be combined in a table pool.
The data of these pooled tables are then sorted in a common table in the database.
More Number of tables are stored

3)Cluster Table-> One to many Relationship 1:N


---------------------------------------------------------------------------
Logical tables that must be assigned to a table cluster when they are defined.
They can also be used to store temporary data or texts, such as documentation.
Less Number of tables are stored.
-----------------------------------------------------------------------------------
------------------------------------------------------------------------
ABAP(Advanced Business Application Programming) :
-----------------------------------------------------------------------------------
--
ABAP is Event driven Programming Language.
ABAP Syntax :
----------------------
Each Statement should start with a keyword(Pre-defined) and ends with
Period/Dot(.).
N.B. ABAP is not case sensitive.

An Instruction/Statement is
------------------------------------------
Group of : Keywords + Variables + Operators + Datatypes + Constants etc.

Keywords :
-----------------
Whose Meaning is already known to the SAP System.
Keywords are Categorized according to their functionality.Such as

Declarative Key words: To Declare Variables, Constants. DATA,TYPE


S,TABLES,CONSTANTS etc.
DATA : wa type i.
Types: slis_list_type(1) type n.
Data : it type zaecstruc.
TABLES : zaec.
Constants :
Database Key Words: To Work with Database Operations such as
SELECT,UPDATE,INSERT,DELETE

Controlling Key Words: To Control the default flow of the program Execution. IF-
ELSEIF-ENDIF, DO-ENDDO,WHILE-ENDWHILE, LOOP-ENDLOOP etc.
IF a<b.

elseif b<c.

endif.

Do 5 times.

Enddo.
loop

endloop.
while a<b.

endwhile.

Definition Key Words: To define re-usable Modules(Blocks). FORM - ENDFORM,FUNCTION


- ENDFUNCTION,MODULE - ENDMODULE.

Calling Key Words:To re-usable Modules(Blocks) that are ready defined. PERFORM to
Call FORM ENDFORM, CALL FUNCTION to call FUNCTION - ENDFUNCTION, MODULE to Call
MODULE - ENDMODULE
Event Key Words:To Define Blocks. TOP-OF-PAGE,END-OF-PAGE.
Operational Key Words: WRITE,ADD,MOVE

Operators :
-----------------
Comparision
< LT,> GT,>= GE,<> or NE,= EQ,
,Arithmatic,
+,-,= a = b,** 2**2,/,DIV,MOD,
Logical,
AND,OR,NOR,NOT
select * from blah into wa where a = '1' and b = '2'.

COMPUTE
a = 3 COMPUTE a = 3

WRITE a+b.
write c.

Variables
CONTANTS : a type 1 value '1'.

List Processing Screen(LPS)


Selection Screen
: chain Statement

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
30/06/2015
------------------
Variables(or Data Objects) :
--------------------------------------------
To hold the values at program level and whose Value can be changed anywhere in the
program.
Technically,Variable is the Name of the Sequential Memory Locations(Space)
allocated on its type of data(Data Type).
Data : <VarName> TYPE <Datatype>.
E.g.,
Data a type i.
a = 1. 2 bytes
a = 2.
a = 8.

ABAP Contains the Following Pre-defined Data Types :


-----------------------------------------------------------------------------------
---
Non-Numeric Data Types:
-----------------------------------------
Character String(C),Numeric Character String(N),Date(D),Time(T).

Numeric Data Types:


---------------------------------
Integer(I),Floating-point number(F), Packed Number(P).
Data Type P is particularly useful for exact calculations in a business context.
When you define an Object with type P, you also specify a number of DECIMAL PLACES.

data : amt type p decimal 2.

amt = 10.50

Predefined Elementary ABAP Types:(All Field length specified in bytes)


----------------------------------------------------------
Data type Initial Field Length Valid Field Length Initial Value
Meaning
--------------- ----------------------------- ---------------------------- ------
------------ --------------
I 4 4 0 Integer(Whole Number)
F 8 8 0 Floating point number
P 8 1 - 16 0 Packed Decimal Number

Character(Non-Numeric) Types
--------------------------------------------------
C 1 1 - 65535 Text Field(Alphanemuric Characters)
D 8 8 00000000 Date Field(YYYYMMDD)e.g., 20150630
N 1 1 - 65535 0............0 Numeric Text Field(Numeric
Characters)NUMC (0123456789)
T 6 6 000000 Time Field(HHMMSS)121717

N.B., Data type N is not a numeric type. Type N can only conatins Numeric
Characters(0.....9),but are not represented internally as numbers.

Integers - Type I
--------------------------
The value range of type I numbers is -2 **31 to 2**31-1 and includes only whole
numbers.2,3, not 5.46
Non-Integer results of arithmetic operations are rounded,not truncated.
Packed Numbers- Type P
----------------------------------------
Type P data allows after the decimal point. data x type p decimal 14.
The valid size can be any value from 1 to 16 bytes.
Two decimal digits are packed into one byte,while the last contains one byte and
sign.(-/+)
Upto 14 digits are allowed after the decimal point.The initial value is 0.

Floating Point Numbers - Type F


--------------------------------------------------
The value range of type F numbers is 1 X 10**-307 to 1 X10**308 for positive and
negativenumbers, including 0(Zero).
Using I and F fields for Calculations is quiker than using P fields. Type P data to
meet accuracy requirements.

Character(Non-Numeric) Types
---------------------------------------------------

Constants
-----------------
To hold the fixed value at program level and whose value never changed after the
constant definition.

Syntax : CONSTANTS <Name> TYPE <Datatype> Value <Constant>.


Constants : c_a type c value 'A'.

Structure of ABAP Program


---------------------------------------------
Header

Global Declarations -> Block which declare all the global variables.

Processing Logic by Calling Reusable Blocks(Modules) -> Perform

Definition Of Reusable Blocks -> FORM ENDFORM -> usable components once define and
call the same again & again when the same business logic we needed.

Parameter : to accept the Input via Console(Screen) i.e., acts as SCANF in C.

Syntax : PARAMETER <name> type <Datatype>


[DEFAULT <Value>]
[OBLIGATORY].
Parameter : a type i default '1' obligatory,
b type i.

System Variable :
----------------------------
A variable, which is declared and filled by the SAP system with the Current
Information i.e., available in SAP System.
DATABASE Structure SYST
SYNTAX:
--------------
SY-<NAME> i.e., SY-DATUM
-----------------------------------------------------------------------------------
-----------
1. Write a Program to Print the below,
30.06.2015 Hello ABAPER
-----------------------------------------------------------------------------------
-------
The List of System Variables are :
Current Date : _____________________
Current Time : _____________________
User Name : _____________________
Database : _____________________
Program Name : _____________________
-----------------------------------------------------------------------------------
-------

2.Write a program to display the list of Modules in SAP,

List of Modules in SAP are


-----------------------------------------------------------------------------------
------
MM - Materials Managament
SD - Sales and Distribution
PP - Production Planning
HR - Human Resources
FI&CO - Finance & Control
CRM - Customer Relationship Management
SEM - Strategic Enterprise Management
-----------------------------------------------------------------------------------
------

3. Write a Program to Print the List of Important Days in a Year?

List of All Holidays in GBS Calendar


-----------------------------------------------------------------------------------
-----------
1st January - New Year
.
.
.
.
.
.
.
.
25th December - Marry Christmas
-----------------------------------------------------------------------------------
-------------

4.Accept two Floating point/Integer/Packed Number values from selection screen and
perform the following :
+,-,*,/,**,MOD and display the result.

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
01/07/2015
------------------
The following applies to these data types:
DF16_DEC and DF34_DEC
In database fields of this type, decimal floating point numbers are stored as a
packed number (format DEC).
The length and the number of decimal places must be specified when defining a data
type in ABAP Dictionary.
Calculations (SELECT with the aggregate functions SUM and AVG, UPDATE with SET +
and -) can be performed on the database for this type.
When there is a write to the database, the system implicitly rounds off to the
number of decimal places and decimal overflows can occur.

DF16_RAW and DF34_RAW


In database fields of this type, decimal floating point numbers are stored as
binary (In RAW format).
The length is set to 16 or 34 places.
Values can be sorted, compared, and used in indices.
For this type, no calculations can be executed on the database.
Since it is an SAP-specific format, corresponding fields also cannot be edited in
Native SQL statements using ADBC.
The scaling is lost when writing to the database.

DF16_SCL and DF34_SCL


Data type for decimal floating point numbers with scaling.
In database fields of this type, decimal floating point numbers are stored in the
same way as DF16_RAW or DF34_RAW (length 16 or 34 places, and the same restrictions
apply).
The scaling must be specified in a direct successor database field with type INT2.
When a decimal floating point number is written, this field is automatically filled
with the scaling and during reading, the scaling is automatically taken from it.

Alignment
----------------
By Default, Nemurics are right aligned and Non-Nemurics are Left-Aligned.
and which can be changed while output(display) but we never changed while input.

Parameter p_input type 1.


Write : p_input LEFT-JUSTIFIED.
Write : p_input RIGHT-JUSTIFIED.
Write : p_input CENTERED.

| -> SY-VLINE

EDIT MASK
--------------------
Syntax :
WRITE : SY-TIMLO using EDIT MASK '__:__:__'.

http://help.sap.com/saphelp_470/helpdata/en/9f/db9e3d35c111d1829f0000e829fbfe/conte
nt.htm
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
08/07/2015
------------------
Control Structures:
------------------------------
BRANCHING & LOOPING
---------------------------------------
Branching : a processing block is executed or not based on the result of one or
more logical conditions.ABAP contains two control structures for conditional
branching.
----------------
1) IF-ELSE / ELSEIF-ENDIF
2) CASE-WHEN-ENDCASE
http://help.sap.com/saphelp_470/helpdata/en/fc/eb3571358411d1829f0000e829fbfe/conte
nt.htm

Looping : a statement block is executed several times in succession.There are four


kinds of loops in ABAP:
-------------
1)Un-Conditional(DO - ENDDO)
2)Conditional ( WHILE - ENDWHILE )
3)Loop - endloop.
4)Select
http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3564358411d1829f0000e829fbfe/cont
ent.htm

EXIT, STOP, CONTINUE, REJECT, CHECK.

if a = b.

endif.
case 'Ram'.

when '1'.
write 'Ram'.
when others.
write 'Shyam'.
endcase.

do 5 times.
write 'ram'.
enddo.

ram
ram
ram
ram
ram

str type i.
data : string type string value 'string'.
str = strlen(string).
str = 6.
while str ne space. ' '

str = str - 1.

endwhile.

select * from zace into wa_zace.


write : wa_zace-college_id,
wa_zace-college_name.
endselect.
*&---------------------------------------------------------------------*

REPORT ZLOOP.

data : n TYPE i.

DO 4 times.
check sy-index BETWEEN 2 and 3.
WRITE : sy-INDEX.
n = n + sy-index.
ENDDO.

skip.

DO 4 times.
IF sy-index = 3 .
skip.
ENDIF.
WRITE :/ sy-index.
n = n + sy-index.
ENDDO.

skip 2.

DO 4 times.
IF sy-index = 3 .
CONTINUE.
ENDIF.
WRITE :/ sy-index.
n = n + sy-index.
ENDDO.

DATA : wa_but000 TYPE but000.


SELECT * from but000 into wa_but000.
WRITE : / WA_BUT000-PARTNER.
ENDSELECT.

DO n TIMES.
write : / sy-index.
IF sy-index = ( n + 1 ) .
stop.
ENDIF.
ENDDO.
*&---------------------------------------------------------------------*
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
13/07/2015
------------------
Strings:
------------
It is a variable length data type to hold any no. of characters.
Dynamic memory managaement is used internally. i.e., the memory allocated/adjusted
at runtime according to the current field content.
Data : v_string type string length 40.

Difference between CHAR and STRING.


------------------------------------------------------------
Memory is static,
Memory is dynamic.

String Operations:
-----------------------------
STRLEN,TRANSLATE(for UPPER/LOWER Case), CONCATENATE,SPLIT,REPLACE,SHIFT,SEARCH.

http://help.sap.com/saphelp_470/helpdata/en/fc/eb3364358411d1829f0000e829fbfe/conte
nt.htm

https://help.sap.com/saphelp_46c/helpdata/en/fc/eb33cc358411d1829f0000e829fbfe/cont
ent.htm

Comparing Strings:(Applied to string and Non-Numeric data type).


-------------------------------
CO -> Contains Only
CN -> Contains Not Only
CA -> Contains Any
NA -> Contains Not Any
CS -> Contains String
NS -> Contains No String
CP -> Matches Pattern
NP -> Does not Match Pattern
http://help.sap.com/saphelp_470/helpdata/en/fc/eb3516358411d1829f0000e829fbfe/frame
set.htm
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
15/07/2015
------------------
Internal Table :
-----------------------
Internal Table is an un-limited Array i.e., it is a variable to maintain any no. of
entries(records).
Provides a means of taking data from a fixed structure and storing data in working
memory in ABAP.

Memory Allocation is Dynamic.

1
2
3

The Data is stored line by line in memory, and each line has the same structure.It
stores records temporary.
Use of Internal Table is for storing and formatting data from a database table
within a program and manipulate according to the user requirements.

a b c d e f
1 r 10 12 13 14 = 1 r 49
2 k 11 12 13 14 = 2 k 50
3 s 15 12 13 14 = 3 s 54

Work Area : it Contains Single line of record.

Standard Tables ->


--------------------------
Default Internal Table. The key of a Standard Table is always non-unique so
Duplicates are allowed.
Accessing/Searching time for the record depends on the number of records because
Searching is either Linear or Binary.
DATA <ITAB> TYPE STANDARD TABLE of <TY>.
Records can be accessed through both INDEX and Condition.
READ TABLE <ITAB> INTO <WA> INDEX <N>.
(OR)
READ TABLE <ITAB> INTO <WA> WITH KEY <Condition>.

Sorted Tables :-
-------------------------
Records are always in Sorted order.
This is the most appropiate type if you need a table which is sorted as we fill it.

Entries are inserted according to the sort sequence defined through the table key.
The response time for key access is logarithmically proportional to the number of
table entries, since the system always use a binary search.
Note : Records Can be accessed through Both INDEX and with Key(Condition).
Note : Sorted Internal Tables Cannot be Sorted again.
Sorted Internal Tables are always, either UNIQUE / NON-UNIQUE i.e., Sorted Internal
Tables cannot be Declared without UNIQUE / NON-UNIQUE Keywords.

DATA : <ITAB> TYPE SORTED TABLE OF <TY> WITH UNIQUE/ NON-UNIQUE KEY <Field1>
<Field1>.

Hashed Tables :-
--------------------------
Like Database tables, hashed tables always have a unique key, where main operation
is key access.
The response time doesn't depend on the no of records, instead it is always access
remains constant, regardless of the number of table entries.
DATA <ITAB> TYPE HASHED TABLE of <TY> WITH UNIQUE <Field1> <Field1>.......

Note : cannot access a hashed table using its INDEX.

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
17/07/2015
------------------
Operations on Internal Tables :
------------------------------------------------
Adding Single Records
a) ADD at the end of Internal Table.
APPEND <WA> TO <ITAB>.
b) ADD at the given Location.
INSERT <WA> INTO <ITAB> INDEX <N>.
Adding Multiple Records :
----------------------------------------
a) At the END of Internal Table
APPEND LINES of <ITAB> from <N1> to <N2> to <ITAB1>.
b) At the given Location
INSERT LINES OF <ITAB> FROM <8> to <11> into <ITAB1> index 3.

Accessing Multiple Records :


---------------------------------------------
Loop at <ITAB> into <WA>.
*Process the Data from <WA>
Endloop.

Loop at <ITAB> into <WA> from <N1> To <N2>.


*Process the Data from <WA>
Endloop.

Loop at <ITAB> into <WA> Where <Condition>.


*Process the Data from <WA>
Endloop.

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
22/07/2015
------------------
Finding No of Records:
------------------------------------
Data : <V_LINES> type I.
Describe Table <ITAB> Lines <V_LINES>.

Sorting:
------------
To arrange the records in Ascending/Descending Orders.

Sort <ITAB> Ascending / Descending By <Field1> <Field2>.........

Accessing/ Reading Single Record :


---------------------------------------------------------
Read Table <ITAB> into <WA> Index <N>.
(OR)
Read Table <ITAB> into <WA> with key <Condition> Binary Search.

Deleting Records :
----------------------------
Single Record : Delete <ITAB> Index <N>.
Multiple Records :
a) Delete <ITAB> Where <Condition>.
b) Delete <ITAB> From <N1> To <N2>.

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
30/07/2015
------------------
Deleting Adjacent Duplicates :
-----------------------------------------------
SORT <ITAB> BY <FIELD1>
DELETE ADJACENT DUPLICATES FROM <ITAB> COMPARING <FIELD1>.

Modify :
------------
wa-spras = b
modify <itab> from <wa> transporting <Field1> where <condition>.

N.B. : You attempted to change, delete or create a row in the


internal table "\PROGRAM=ZTRAINING7\DATA=ITAB", but no valid cursor exists
for the table.
Possible reasons:
1. The relevent ABAP language command does not include the addition
"...INDEX...", although the statement is not
inside a "LOOP...ENDLOOP" loop processing this table.
2. In the body of a loop started with "LOOP ... USING KEY ...", an ABAP
statement has been issued with an implicit index specification. This
is only permitted in connection with the "USING KEY loop_key"
addition and applies to the "DELETE itab" and "MODIFY itab"
statements.
3. The relevent ABAP language command statement was called from within a
"LOOP...ENDLOOP" loop after a DELETE "\PROGRAM=ZTRAINING7\DATA=ITAB".

Header Line :
--------------------
Implicit Work Area, Both Internal Table and Work Areas are Defined with the Same
Name.

Syntax for Internal Table Operations(With & WithOut Header Lines)

Operations Without Header Line Operations With Header Line

Insert <WA> into Table <ITAB>. Insert Table <ITAB>.


Collect <WA> INTO <ITAB>. Collect <ITAB>.
Read Table <ITAB> into <WA> �.. Read Table <ITAB> ����
Modify Table from <WA>��. Modify Table <ITAB>��
Modify <ITAB> From <WA> �.. Where ���. Modify <ITAB> �.. Where ���.
Delete Table <ITAB> From <WA>. Delete Table <ITAB>.
Loop AT <ITAB> Into <WA>��� Loop At <ITAB>���
Operations for Index Tables
Append <WA> To <ITAB>. Append <ITAB>.
Insert <WA> into Table <ITAB>��� Insert <ITAB>���
Modify <ITAB> From <WA> �. Modify <ITAB> ���

CLEAR,REFRESH,FREE.

Assignment : Working Function of CLEAR,REFRESH,FREE for INTERNAL TABLE with Header


Line and Internal Table Without Headerline.

Standard Table Name : MARA,VBAK,VBAP,LFA1,EKKo,EKPO,KNA1


1 34.00
2 30.00
3 40.00
3 50.00
3 70.00
4 100.00

loop at itab into wa.


collect wa into itab1.
endloop.

1 34.00
2 30.00
3 160.00
4 100.00
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
04/08/2015
----------------------

SQL : Structured Query Language


-----
language for accessing relational databases.

Two Types of SQL : OPEN SQL and Native SQL

OPEN SQL : Database Independent and integrated with ABAP Workbench.


Native SQL : Database Dependent.

DML : Reading and Changing Data in Database Tables.


( SELECT,INSERT,UPDATE,MODIFY,DELETE)
SELECT :
--------
Access Single Record
--------------------
Select Single <Field1>.....<Fieldn> from <DBT> into <WorkArea> where <Condition>.

Accessing Multiple Records


--------------------------
SELECT <Field1>.....<Fieldn> from <DBT> into Table <ITAB> where <CONDITION>.

INSERT :
--------
Single Record
-------------
INSERT <DBT> from <WORKAREA>.

Multiple Records
----------------
INSERT <DBT> FROM TABLE <ITAB> ACCEPTING DUPLICATE KEYS.
UPDATE :
--------
Single Record
-------------
UPDATE <DBT> from <WORKAREA>.

Multiple Records
----------------
UPDATE <DBT> FROM TABLE <ITAB>.

UPADTE <DBT> SET <FIELD1> = '' WHERE <FIELD2> = ....

MODIFY :
--------
Single Record
-------------
MODIFY <DBT> from <WORKAREA>.

Multiple Records
----------------
MODIFY <DBT> FROM TABLE <ITAB>.

DELETE :
--------
Single Record
-------------
DELETE <DBT> from <WORKAREA>.

Multiple Records
----------------
DELETE <DBT> FROM TABLE <ITAB>.
DELETE FROM <DBT> WHERE <Condition>.

DDL : Creating and Administering Database Tables.


(CREATE,ALTER,DROP,TRUNCATE,COMMENT)
DCL : Authorization and Consistency Checks.(GRANT,REVOKE)
TCL : Used to Manage Changes (COMMIT WORK,ROLLBACK WORK)

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
05/08/2015
----------------------
SAP Memory
--------------------
Memory Area to which all main sessions within a SAPgui have access.
SAP Memory is used either to pass data from one program to another within a
session, or to pass data from one session to another.
USE SPA/GPA in SAP memory

ABAP Memory
----------------------
Memory Area that all abap programs within the same internal session can access
using the EXPORT and IMPORT statements.
Data within this area remains intact during a whole sequence of program calls.

http://help.sap.com/abapdocu_731/en/abenmemory_organization.htm

Modularization :
-------------------------
Is to Sub divide the Main Program into Reusable Modules or Blocks.
Improves the Re-Usability(Reusing ability) and Readability(Reading ability) of the
Source Code.

Modularization Techniques :
--------------------------------------------
a. Those that can be called by ABAP statements in ABAP Programs.
b. Called from outside a program by the ABAP runtime system.

statement1 statement2
statement3 statement4
statement5
statement6
statement7
statement8

Types of Techniques :
----------------------------------
a. Include Program
b. Function Module
c. Subroutines
d. Macros(Obslete)

Include Program :
----------------------------
Include programs are global R/3 Repository objects. They are solely for
modularizing source code, and have no parameter interface.
Syntax : INCLUDE <Program Name>.
https://help.sap.com/saphelp_nw70/helpdata/en/9f/db973535c111d1829f0000e829fbfe/con
tent.htm

Subroutine :
----------------------------
A subroutine is a block of code introduced by FORM and concluded by ENDFORM.
Used for Local Modularization, i.e., generally they are called from a program in
which they are defined.
Used Subroutine to write functions that are used repeatedly within a program.
How to define the Subroutine and How to Call it ?

Subroutine should be called first and Defined next in the program.


No Statements can be executed after Calling the Subroutine.

Perform <NAME> Using <input_parameter1>


<input_parameter2>
Changing <output_parameter1>
<ouptut_parameter2>.

All Arguments Passed in the time of calling the subroutines are called ACTUAL
PARAMETERs.
Form <NAME> Using <P_input_parameter1>
<P_input_parameter2>
Changing <P_output_parameter1>
<P_ouptut_parameter2>.

Endform.
All Arguments passed at the time of defining the Subroutine are called Formal
Parameters.

https://help.sap.com/saphelp_nw70/helpdata/en/9f/db976935c111d1829f0000e829fbfe/con
tent.htm?
frameset=/en/9f/db9a0735c111d1829f0000e829fbfe/frameset.htm&current_toc=/en/d3/2e97
4d35c511d1829f0000e829fbfe/plain.htm&node_id=387&show_children=false

Include programs are not standalone programs and cannot be executed independently.
They can be useful if you have lengthy data declarations that you want to use in
different programs.
Include programs are used to divide very large programs into smaller more
manageable units.
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
10/08/2015
----------------------
Subroutine :
-------------------
Type of Formal Parameters
------------------------------------------
Parameters Passed by Reference(Call By Reference)
---------------------------------------------------------------------------------
FORM <NAME> USING <P1> <P2>.......
CHANGING <C1>.........
Formal Parameter occupies no memory of its own. During a Subroutine Call, only the
address of the actual parameter is transferred to the formal parameter i.e.,
Simply Formal parameter is another name given to actual parameter. So that the
changes to the Formal Parameter reflects to the corresponding Actual parameters.
For calling by reference, USING and CHANGING are equivalent.

Input Parameters That Pass Value(Call By Value)


---------------------------------------------------------------------------------
FORM <NAME> USING Value<P1> <P2>.......
Formal Parameter occupies its own memory space. When you call the subroutine,the
value of the actual parameter is passed to the formal parameter.
If the value of the formal parameter changes, this has no effect on the actual
parameter.

Output Parameters that pass Values(Call By Value and Return)


-----------------------------------------------------------------------------------
--------------
FORM <NAME> CHANGING Value<P1> <P2>.......

Formal Parameter occupies its own memory space. When you call the subroutine, the
value of the actual parameter is passed to the formal parameter.
If the subroutine concludes sucessfully, i.e., when the ENDFORM statement occurs,
or when the subroutine is terminated through a CHECK or EXIT statement,
the current value of the formal parameter
is copied to the actual parameter.

N.B. If the subroutine terminates prematurely due to an error message, no value is


passed.

Parameter : USING,CHANGING,TABLES

http://help.sap.com/saphelp_nw70/helpdata/en/9f/db979035c111d1829f0000e829fbfe/cont
ent.htm
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db979d35c111d1829f0000e829fbfe/cont
ent.htm

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
11/08/2015
----------------------
Specifying the Type of Formal Parameters
-----------------------------------------------------------------
Any Attributes that are not specified are inherited from the corresponding actual
parameter when the subroutine is called.
By Specifying the type, you ensure that a subroutine always works the correct data
types.

Type Specification Check for Actual Parameters


---------------------------- --------------------------------------------
TYPE ANY The subroutine accepts actual parameters of any type.The
formal parameter inherits all of the technical attributes of the actual parameter.
TYPE C,N,P or X The subroutine only accepts actual parameters with the type
C,N,P, or X. The formal parameter inheritsthe field length and length and DECIMALS
specification from the actual parameter.
TYPE TABLE The System checks whether the actual parameter is a standard
internal table.
TYPE ANY TABLE The System checks whether the actual parameter is an
internal table.The formal parameter inherits all the attributes from the actual
parameter.
TYPE INDEX TABLE The system checks whether the actual parameter is an index
table. The formal parameter inherits all of the attributes from the actual
parameter.
TYPE STANDARD TABLE The system checks whether the actual parameter is a
STANDARD Internal Table. The formal parameter inherits all of the attributes from
the actual parameter.
TYPE SORTED TABLE The system checks whether the actual parameter is a SORTED
Internal Table. The formal parameter inherits all of the attributes from the actual
parameter.
TYPE HASHED TABLE The system checks whether the actual parameter is a HASHED
Internal Table. The formal parameter inherits all of the attributes from the actual
parameter.

TYPE D,F,I, or T The formal parameter has the technical attributes of the
predefined elementary type.
TYPE <type> The formal parameter has the type <type>. This is a data type
defined within the program using the TYPES statement, or a type from the ABAP
Dictionary
TYPE REF TO <cif> The Formal Parameter is a reference variable(ABAP OBJECTS)
for the class or interface <cif>.
TYPE LINE OF <itab> The formal parameter has the same type as a line of
the internal table <itab> defined using a TYPES statement or defined in the ABAP
Dictionary.
LIKE <f> The formal parameter has the same type as an internal data
object <f> or structure, or a database table from the ABAP Dictionary.

External Subroutine
------------------------------

PERFORM <subr>(<prog>)[USING <p1>....][CHANGING <P>.........] { IF FOUND }.

Static Local Data Objects.


---------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
12/08/2015
----------------------
Function Modules :
------------------------------
FM are for global modularization, i.e., they are always called from a different
program. Function Module contain Functions that are used by many different
programs.
1)Each FM should be linked to one function groups(special ABAP programs with type
F), Which acts as a MAIN Program For all the Function Modules which are stored in
the same Function Group.
2)Global Reusble Components i.e., they can be called from any Program without
including the definition details.
3)Function Module allow to encapsulate and reuse global functions in the SAP System
.
4)FMs are stored in a Central Library. The R/3 System contains a wide range of
predefined function modules that can be called from any ABAP Program.
5)The Definition Of Function Modules Can be tested as an Individual Component
Before Calling them in any Program.
6)FM Definition Can be Debugged before Calling.
7)FM also support exception handling.This allows you to catch certain errors while
the function module is running.

Function Groups
--------------------------
Function Groups are containers for function Modules.You cannot execute a FG. When
you call a Function Module, the system loads the whole of its FMs into the internal
session of the calling program,
so that it is better to group only related FMs. When the FG is created, the main
program and include program are generated automatically.

The main program SAPL<FG> contains nothing but tha INCLUDE statements for the
following include Programs:

=> L<FG>TOP : This contains the FUNCTION-POOL statement(Equivalent for a Function


Group of the REPORT or PROGRAM Statement) and global data declarations for the
entirre function group.
=> L<FG>UXX : This contains further INCLUDE statements for the include programs
L<FG>U01, L<FG>U02,......These includes contain the actual Function Modules.
=> The Include Programs L<FG>U01, L<FG>U02,......... can contain the coding part.
=> Subroutine that can be called from all Function modules of the group.
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
13/08/2015
----------------------

N.B.: All of the Function Module in a FG can access the global data of the group.
For this reason,you should place all FMs that use the same data in a single FG.
Example, If you have a set of FMs that all use the same internal table, you could
place them in a Function Group containing the table definition in its global data.

How to Create Function Group


-----------------------------------------------

FM Attributes :
----------------------
=> Documentation
=> Interface Parameters and Exceptions
=> Processing Type

Steps to Work with the FMs:


------------------------------------------
1. Check whether a suitable FM already exists. If not, proceed to step 2.
2. Create a Function Group, If no appropriate group exixts yet.
3. Create the FM
4. Define the FM interface by entering its parameters and exceptions.
5. Write the actual ABAP code for the FM, adding any relevant global data to the
TOP Include.
6. Activate the Module.
7. Test the module.
8. Document the module and its parameters for other users.
9. Release the module for general use.

FUNCTION MODULE FRUIT


function Friut..............
Functionalities : Sour,Sweet,Rotten,KG,Dozen,Place

Create Diiferent Program


---------------------------------------
Program Mango
CALL FM FRUIT
Properties : Sour,Sweet,Rotten,KG,Dozen,Place

Program Apple
CALL FM FRUIT
Properties : Sour,Sweet,Rotten,KG,Dozen,Place

Program Pipeapple
CALL FM FRUIT
Properties : Sour,Sweet,Rotten,KG,Dozen,Place
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
17/08/2015
----------------------
1) How to Use Function Module in Program :

N.B.An exception occurred that is explained in detail below.


The exception, which is assigned to class 'CX_SY_DYN_CALL_PARAM_NOT_FOUND', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
Function module "HR_IN_CHG_INR_WRDS" was called
with the parameter "AMT_IN_WORDS".
This parameter is not defined.

N.B. An exception occurred that is explained in detail below.


The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
You attempted to pass the field "V_VAL" to the formal parameter "AMT_IN_WORDS"
but the formal parameter "AMT_IN_WORDS" can accept only fields of
type "C". The field "AMT_IN_WORDS" has the type "g".

N.B. An exception occurred that is explained in detail below.


The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
The call to the function module "HR_IN_CHG_INR_WRDS" is incorrect:

The function module interface allows you to specify only


fields of a particular type under "AMT_IN_NUM".
The field "P_AMT" specified here is a different
field type .

N.B. An exception occurred that is explained in detail below.


The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
The call to the function module "HR_IN_CHG_INR_WRDS" is incorrect:

The function module interface allows you to specify only


fields of a particular type under "AMT_IN_NUM".
The field "P_AMT" specified here is a different
field type .

2) Create a Function Module to read the Line Items for the given Material Number.
EKKO : EBELN,BUKRS,LIFNR,KNUMV
EKPO : EBELP,MATNR,TXZ01,NETPR

TABLE TYPE : EBELN,BUKRS,LIFNR,KNUMV,EBELP,MATNR,TXZ01,NETPR

Input : Purchasing Document Number


Output : An Internal Table with all the Line Item Details(Item No, Material
No,Quantity and Net Price ) for the given Purchase Order.
Function Group Name : ZTRAINING1_FG
Function Module : ZREAD_PURCHASE_ITEM_DOC
Structure Name : ZSTR_PURCHASE
Table Type : ZTT_PURCHASE
Function Group : ZTRAINING_FG
Function Module : ZTRAINING1_PURCHASE_RECS
Structure Name : ZSTR1_PURCHASE
Table Type : ZTT1_PURCHASE

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
18/08/2015
----------------------
Use of Importing,Exporting,Changing,Tables Parameter.
Call FUNCTION <Function Module>
Exporting
f1 = a1
.
.
.
fn = an
Importing
f1 = a1
.
.
.
fn = an
[CHANGING f1 = a1..............fn = an]
[TABLES f1 = a1 ................ fn = an]
[EXCEPTIONS e1 = r1 .......... en = rn]
[ERROR_MESSAGE = rE]
[OTHERS = r0].

The Exporting option passes the actual parameter a1 to the formal input f1. The
formal parameters must be declared as import parameters in the function module.
The Importing option passes the formal output parameter f1 of the function module
to the actual parameter a1. The formal parameters must be declared as export
parameters in the function Module.
The Changing option passes the actual parameter a1 to the formal parameter f1.
After the function module has been processed, the system returns the values of the
formal parameters f1 to the actual parameters a1.
The Tables option passes internal tables between the actual and formal
parameters.The internal tables are always passed by reference.
Exception :
Used to Catch the Unpredicted Exceptions.

Exporting a type ebeln


impoting b type lifnr
Changing c type ebeln
10101
0000010101

Function Module : HR_IN_CHG_INR_WRDS,SPELL_AMOUNT


-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
20/08/2015
----------------------
Reports :
--------------
It is displaying the application data in the required format.
A report is an executable program with three stage function:
Data Input -> Data Processing -> Data Output

DATA INPUT(Selection Screen)


DATA PROCESSING(Select Statements)
DATA OUTPUT(Write, Skip, Uline, Vline etc to Output the Data).

Purpose :
---------------
It helps to analyze the current situation and also for decision making.
coca cola
cold drinks
JK - 10
TN-10000
WB- 1000

N.B.: Reports read and calculate data from database tables, without actually
changing it.

Input :matnr 0001 to 0007

fert 120.00
fins 160.00
Mnf 110.00

0001 fert 20.00


0002 fert 40.00
0003 fert 60.00

0004 fins 70.00


0005 Mnf 80.00
0006 fins 90.00
0007 mnf 30.00

Reports are of two types :


--------------------------------------
a) Classical Reports
Displaying the whole data as One List.
b) Interactive Reports
Display the Summerized Information as the First List and Display the detailed
information as Secondary Lists.

Working With CLASSICAL Reports :


------------------------------------------------------
Providing the INPUT is always through SELECTION SCREEN Only.

There are 3 ABAP Statements for defining Selection Screens:

PARAMETERS For Single Fields


SELECT-OPTIONS For Single and Multiple Range of Fields
SELECTION-SCREEN For Formatting the selection screen and defining user-
specific selection screens.
--------------------------------------------------------------------------------
P_BUKRS : _______________________
S_EBELN : ___________ to __________
---------------------------------------------------------------------------------
Standard Selection Screen of executable programs is predefined and has screen
number 1000.

PARAMETER is used for Simple queries of single values ONLY.

SYNTAX for Parameters:


PARAMETER <NAME>[<Length>] TYPE <Datatype>| LIKE <Variable>[DECIMALS <No>]

Length of PARAMETER name are Limited to 8.


data : p_abcdef type i.

The Data Type valid for parameters include all elementary ABAP types except data
types F.

Default Values for Parameters:


---------------------------------------------
PARAMETERS p_bukrs TYPE bukrs DEFAULT '1000'.
The input field of the parameter on the selection screen is filled with the default
value.

Parameter as Mandatory :
--------------------------------------
PARAMETERS p_bukrs TYPE bukrs OBLIGATORY.

Checking Input Values :


------------------------------------
PARAMETERS <name> TYPE <Data_type> Value Check.

PARAMETERS P_BUKRS LIKE T001-BUKRS OBLIGATORY VALUE CHECK.

Defining Checkboxes :
-----------------------------------
PARAMETER <Name> AS CHECKBOX.

Parameter <Name> is created with type C and Length 1.

Defining Radio Buttons:


------------------------------------
PARAMETER <Name> RADIOBUTTON GROUP <G1>.

Parameter <Name> is created with type C and Length 1, IS ASSIGNED TO GROUP <G1>.
Each Radiobutton Group has atleast Two Radiobuttons and by default First
Radiobutton from the group is Selected.

SELECT-OPTIONS :
-----------------------------
Parameter accepts only Single Input and Select-Options accept Range of Inputs On
the Selection Screen.

Structure of SELECT-OPTIONS(Selection Table)


------------------------------------------------------------------------
An selection Table(Internal Table) with header line is created by the system with
the name of the SELECT-OPTIONS and the row type of a selection table is a
structure
that consists of four components : LOW, HIGH, SIGN, OPTION.
SIGN : Possible values are I and E.

- I stands for INCLUSIVE


- E stands for EXCLUSIVE

OPTION : Possible Operators

- If HIGH is empty, you can use EQ,NE,GT,LE,LT,CP and NP.


- If HIGH is filled, you can use BT and NB.

SELECT-OPTIONS <name> FOR <Variable>.

Formatting Selection Screen


---------------------------
The selection screen that you define when you use the PARAMETERS or SELECT-OPTIONS
statements on their own,has a standard layout in which all parameters appear line
by line.
Blank Lines
-------------------
SELECTION-SCREEN SKIP [<n>].

Underlines
-----------------
SELECTION-SCREEN ULINE [[/]<POS(LEN)>].

Comments
----------------
SELECTION-SCREEN COMMENT [/]<POS(LEN)> <comm> [FOR FIELD <f>].

Blocks of Element :
-----------------------------
selection-screen begin of block <B1> with frame TITLE <text-001>.
parameters <P_NUMBER> type <I> obligatory default <'1'>.
selection-screen end of block <B1>.

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
25/08/2015
-----------------

Classical Report Events :


--------------------------------------
Name of the Event Triggering Purpose
--------------------------- ----------------
-------------
INITIALIZATION This event occurs before the To
initialize the input fields of the standard selection screen
standard selection screen is called.

AT SELECTION-SCREEN This event is processed before leaving the


To validate the input provided through Selection Screen.
selection screen i.e., when the selection screen
has processed.
AT SELECTION-SCREEN ON <Field Name> This event is processed before leaving the
To validate the Individual input provided through Selection Screen.
Selection Screen Element.

START-OF-SELECTION This event occurs after the selection screen

has been processed and before data is read


using the logical database.

TOP-OF-PAGE This is a list processing event executed before


the first data is output on a new page.This is
processed only when generating basic list.

END-OF-PAGE This will triggered when it reaches the end of the


page.

END-OF-SELECTION This is the last of the events by the runtime


environment to occur.It is triggered after all of the
data
has been read from the logical database and before
the list
processor is started.

Matnr = 1 to 12

LPS :::

MATERIAL MATERIAL TYPE


1 FERT
2 FERT
3 RAW

This is material description.


-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
26/08/2015
-----------------
Control Break Statement(AT - ENDAT Event)
--------------------------------------
AT FIRST - Execute at the starting of the report
AT LAST - Execute at the end of the report
AT NEW <f> - Execute on change of field value
AT END OF <f> - Execute just before the change of field value(means at
end of certain field value)
SUM - Summation

http://help.sap.com/abapdocu_731/en/abapat_itab.htm
http://wiki.scn.sap.com/wiki/display/ABAP/Control+Level+Statements+in+ABAP

You must sort the internal table before using in AT Event.


and Used in Loop-EndLoop.

AT FIRST.
AT NEW HAGUPADU.
1 10.00
1 20.00
AT END OF HAGUPADU.
1 30.00
SUM. 60.00

AT NEW HAGUPADU
2 40.00
2 30.00
AT END OF HAGUPADU
2 40.00
SUM 110.00

AT NEW HAGUPADU
3 70.00
AT END OF HAGUPADU
3 50.00
SUM 120.00
AT LAST.

BUKRS = 1000 and 3000


EKGRP = 002,001,987,007,013,010,011,012

EKKO-EBELN,LIFNR,BUKRS,EKGRP
EKPO-EBELP,MATNR,MENGE,NETPR
---------------------------------------
EKKO-BUKRS
EKKO-EKORG
EKKO-BSTYP(F)
EKKO-BUKRS,EKORG,EBELN,LIFNR,ANGNR,VERKF,LLIEF,INCO1,INCO2,
EKPO-EBELP,MATNR,WERKS,LGORT,MATKL,NETWR
-----------------------------------------------------------------------------------
-----------------------------------------------------
WRONG
-----------------------------------------------------------------------------------
-----------------------------------------------------
data: v_bukrs type bukrs.
select-options : s_bukrs for v_bukrs.
Parameters : p_ekorg type ekorg.
select BUKRS
,EKORG
,EBELN
,LIFNR,
ANGNR
,VERKF
,LLIEF,
INCO1
,INCO2, from ekko into table i_tab where ekko-ekorg in p_ekorg and ekko-bkrs in
s_bukrs.
-----------------------------------------------------------------------------------
--------------------------------------------------------------
RIGHT
-----------------------------------------------------------------------------------
--------------------------------------------------------------
data: v_bukrs type bukrs.
select-options : s_bukrs for v_bukrs.
Parameters : p_ekorg type ekorg.
select BUKRS
EKORG
EBELN
LIFNR
ANGNR
VERKF
LLIEF
INCO1
INCO2 from ekko into table i_tab where ekorg = p_ekorg and bukrs in s_bukrs.
-----------------------------------------------------------------------------------
-------------------------------------------------------------
UP TO <N> ROWS
-----------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
27/08/2015
-----------------

For All Entries :


-------------------------
Interactive Report
----------------------------
Display the Summarized Information as the First List and letting the USER Interact
for the Detailed Info.
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
28/08/2015
-----------------
N.B. : We can go upto 20 Secondary Lists.The List Index SY-LSIND will be
incremented by 1 for each user interaction.

0 - 1 - 2 -.......................................- 20

Different Ways of User Interaction and the corresponding Events Triggered for Each
type of User Interaction
-----------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Line Selection User Commands
(Double Click) (Click on Function Key)
AT LINE-SELECTION AT USER-COMMAND

N.B.: The TOP-OF-PAGE and END-OF-PAGE events can occur while the basic list is
being created.

Working With AT LINE-SELECTION


----------------------------------------------------
It triggers when the User Interacts with the Output Line (Line Selection/Double
Click)

Useful System Fields for Details Lists


SY-LSIND Index of the list created during the current event(baisc list =
0).
SY-LISTI Index of the list level from which the event was triggered.
SY-LILLI Absolute number of the line from which the event was triggered.
SY-LISEL Contents of the line from which the event triggered.
SY-CUROW Position of the line in the window from which the event was
triggered(counting starts with 1) .
SY-CUCOL Position of the column in the window from which the event was
triggered(Counting starts with 2).
SY-CPAGE Page number of the first displayed page of the list from which the
event was triggered.
SY-STARO Number of the first line of the first page displayed of the list from
which the event was triggered (counting starts with 1). This line may contain the
page header.
SY-STACO Number of the first column displayed in the list from which the event
was triggered(counting starts with 1).
SY-UCOMM Function code that triggered the event.
SY-PFKEY Status of the list currently being displayed.

N.B.:
Each Secondary list is a normal output list Only.But the Next Level Data depends on
the Selected Line and Contents from the Previous List.
So it is enough to know the way to find out the Selected Line Details of the
Previous List.

SY-LISEL : It is the system variable to maintain, the Entire Selected Line Contents
and we need to split it for the required Field Contents.
HIDE : The HIDE statement is one of the fundamental statements for interactive
reporting. You use the HIDE Technique when creating a basic list. It defines the
information that can be passed to subsequent detail lists.
GET CURSOR : Use the statements GET CURSOR FIELD and GET CURSOR LINE to pass the
output field or output line on which the cursor was positioned during the
interactive event to the ABAP Program.

HIDE : Creating a List Level to store line-specific information for later use.

http://help.sap.com/saphelp_sm71_sp05/helpdata/en/dd/b8a50125be44c1a7a23a6cc32659a4
/content.htm
http://www.saponlinetutorials.com/interactive-reports-sap-abap/
http://wiki.scn.sap.com/wiki/display/ABAP/Interactive+Reporting+-+FAQs
http://wiki.scn.sap.com/wiki/display/Snippets/ABAP+-+3+Levels+Interactive+Report
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
01/09/2015
-----------------

HIDE : It is one of the fundamental statements for interactive reporting. You use
the HIDE technique when creating a basic list. It defines the information that can
be passed to subsequent detail lists.
GET CURSOR : Use the statements GET CURSOR FIELD and GET CURSOR LINE to pass the
output field or output line on which the cursor was positioned during the
interactive event to the ABAP program.