Saturday, June 1, 2013

ABAP - Advance Business Application Programming

Sharing nota akak on ABAP lah ye..  kih3 :D

=======================
1.8.1. Introduction to ABAP
=======================

use FIFO (first in first out) method.

work processes:

  • task handler
  • ABAP/4 interpreter
  • screen interpreter
  • database interpreter
ABAP WorkBench SE80
  • object browser SE80
  • ABAP Editor - create program SE38
  • Function builder
  • screen painter - GUI program SE51
  • menu painter - text in menu SE41
SQL Trace 
- performance of program
- tcode ST05
- options:
  • SQL trace
  • Enqueue trace
  • RFC trace
  • Table buffer trace
Run Time Analysis
- measures the run time program.
- time take for each stmt
- 3 section of result:
  • ABAP
  • Database
  • System
Program Testing
  • unit test
  • functional test
  • integration test
  • regression test
ABAP debugger
  • use to execute programs
  • execute one by one or as a whole to check the flow.
  • breakpoint.
Program type:
  • 1-Report - executable programs.
  • M-Module Pools - screen logic, must have tcode.
  • F-Function Modules
  • K-Class Definitions
  • J-Interface definitions
  • S-Subroutine pools
  • I-Include

=======================
1.8.2. Data Types in ABAP
=======================
- 3 Data Types:
  • Elementary (fixed - C, N, D, T, variable length - STRING, XTRING)
  • Reference (Data, Object References)
  • Complex (Structure, table type)
F-From
R-Report
I-Interface
C-Conversion
E-Enchancement
W-Work flow.

PBO - Process Before Output
PAI - Process After Input

Defining:
  • predefined (system variables)
  • Data Dictionary
  • Local Data types - in ABAP programs
TYPE statement
  • to define data types
  • can use existing data type or created new.
LIKE statement
  • to define data types
  • copies technical attributes

============================
1.8.3. Controlling Program Flow
============================

- conditional branching:
  • if
  • case
-unconditional branching:

LOOPS

  1. unconditional = DO
  2. conditional = WHILE
  3. internal table = LOOP
  4. dataset = SELECT
Terminating loops:
  • continue - unconditional
  • chek
  • exit
ABAP Program starts:
  • REPORT
  • PROGRAM
Program Structure
  • Declaration Part
  • Processing Block

==================
1.8.4. Internal Tables
==================

Type:

  1. Standard - referenced to a DB table.
  2. Sorted - data sorted when this calles, using INSERT.  use table key.
  3. Hashed - hash alghorithm to identify rescord at runtime.
IT (Internal Table) - used for data storage at runtime.
WA (work Area) - store one record at a time.

Populating IT:

  • APPEND - by lines
  • INSERT .. INTO TABLE, inert WA into IT.

Data Exchange

  • Copy/move = MOVE source TO Dest
  • Append line = APPEND LINES OF it1 TO it2
  • Insert line = INSERT LINES OF ..
  • Copy = MOVE ... TO ...
Changing Lines
  • copy/move = MOVE ... TO ..
  • MODIFY
  • WRITE ... TO ...
Summing:
- Calculate totals :  COLLECT ... INTO ...

Initializing:

  • Initialize: clear the current data
  • Refresh: applies to the body of the table.
  • Clear: can clear the content of variables.
  • FREE: to release the memory space.


==================

1.8.5. Data Dictionary
==================

Data elements usage: 

  • reusability
  • semantic attributes
DOMAINS
define technical attributes
- data type
- length
and value ranges
- fixed
- interval

Tables
- data containers in a relational DB
- components:
  • fields
  • foreign keys
  • technical settings
  • indexes
Structures
- sequence of any other data type from ABAP dictionary
- central definition used more than once, can be change centrally.
- 2 ways:
  • include structure: into different table.
  • append structure: into same table.
Table types:
- SE11
- generate table type.
- range table type.

Views

- logical view on one or more then one table.
- Type:
  • Database view: same view as in DB
  • Projection view: hide fields of table, one table only.
  • Help view: selecttion method in search help.
  • Maintenance view.
LOCK Objects
- SAP synchronizes simultaneous access of several users to the same data with lock mechanism.
- lock object: define the lock mechanism for the table.
- structure of lock objects.
- lock arguments : key fields
- lock mode:
  • exclusive lock - single user.
  • shared lock - more the one user, display only
  • exclusive but not cummulative.
=======================
1.8.6. Event and Messages
=======================

Events
  • initialization
  • at selection-screen output
  • at selection-screen on field
  • at selection-screenon block
  • at selection-screen 
  • start-of-selection
  • end-of-selection
 interactive events:
  • at line-selection
  • at user-command
  • at pfnn
  • top-of-page during line selection
list events:
  • top-of-page
  • end-of-page
control break events
  • at first
  • at last
  • at new
  • at end of
  • at change of
messages:
  • flow logic stmt
  • MESSAGE stmt in ABAP
  • error dialog performed by system
  • dialog mode
  • selection  screens
  • messages in a list.

===================
1.8.7.  Open SQL Stmt

===================

LUW - Logical Unit of Work.
- commit work
- rollback work

SQL - Structured Query Language.


Open SQL

- subset of standard SQL fully intergrated in ABAP.
DML - Data Manipulation Language
SELECT, INSERT, UPDATE, & DELETE.

Aggregate Function

  • max
  • min
  • avg
  • sum
  • count
  • count(*)
  • group by - group by line statically
  • order by - sort by column.

===================
1.8.8. List Processing
===================

Type:

  • simple lists
  • interactive lists
  • ranked list
complex list - user interact up to 20 secondary lists

command: write, uline, skip, new-page.


formatting

  • numeric - no-sign, decimals, round, currency
  • date - DD/MM/YY, DDMMYY
  • all - centered, no zero, no-gap

====================
1.8.9. List Processing 2
====================

checkbox

1 or X = checked
0 or (space) = unchecked.

- vertical line = | or sy-vline

- horizontal line = uline
- blank line = skip
- scroll = scroll list to ...
- outputting fields on hotspot.

===================

1.8.10. Interactive Lists
===================

- basic list

- secondary list
- pop up screen = window
- describe list

sy-subrc 
  • 0 OK
  • 4 line not exist
  • 8 list not exist
- assigning custom GUI statue:

Set pf-status '(status name)'
status name: 20 char & caps letter only

=====================
1.8.11.  Dialog Programs.
=====================

Dialog programs = provide interface to users to enter, change, display or process data.
- starts with SAP tcode.
- components:
  • SAP tcode (1- executable, M module)
  • Screens (Screen painter, PAI, PBO)
  • GUI Status (menu bar, application bar)
  • ABAP program
- screens can be called by:
  • tcode
  • CALL SCREEN stmt
- user action - funtion code is assigned, trigger PAI event.
- screen consists of:
  • flow logic
  • elements
  • attributes
  • layout

=========================
1.8.12.  BDC & SAP Scripts
=========================

BDC - Batch Data Communication

Steps:
  • analysing transaction
  • assign data
  • format conversion
  • transfer legacy data to SAP

Methods:

  • Batch Input (BI)
  • Call Transaction (CT)
  • Direct Input (DI)
SAP Script
- used to print the form

ABAP Debugger
  • static breakpoint
  • dynamic breakpoint
  • watch point


No comments:

Post a Comment