0% found this document useful (0 votes)
83 views

1st Class ABAP

1. The document discusses ABAP/4, which is an advanced business application programming language that supports both structured and object-oriented programming styles. 2. It describes how to move custom developments between different environments like development, quality assurance, and production systems using packages and transports. 3. The types of SAP projects and related documents like BRD, FSD, and TSD are listed, as well as how to develop custom ABAP objects like database tables and views.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

1st Class ABAP

1. The document discusses ABAP/4, which is an advanced business application programming language that supports both structured and object-oriented programming styles. 2. It describes how to move custom developments between different environments like development, quality assurance, and production systems using packages and transports. 3. The types of SAP projects and related documents like BRD, FSD, and TSD are listed, as well as how to develop custom ABAP objects like database tables and views.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

1st Class

ABAP/4

ABAP – Advanced Business Application Programming

4 – 4th level generation.

Its supporting Both Structure type and Object-Oriented structure type(JAVA)

ABAP – is not a case sensitive

DEV QAS PRD

A -> X letters are reserved for SAP

For any custom developments – Y or Z

Real Time Concept

BRD – Business Requirement Document

FSD – Functional Specification Document

TSD – Technical Specification Document

Transport: Through Transport will move the changes from DEV to QAS and PRD

Package Local Class

YSD/ZSD $TMP

YFI/ZFI - System its won’t generate Transport

YABAP/ZABAP - we can’t possible to move changes from D to Q and P

When will use package, system will generate Transport

Through transport will move the changes from DEV to Q and P

Types of Projects

1. Implementation
2. Upgrade (4.6, 4.7, 5.0 and 6.0)
3. Support
4. Roll Out

BRD

FSD

TSD
Coding

Review

Testing

Go – Live and support

How will move our custom developments from DEV to Q and P.

Through Transport.

Through Package

How to create a package?

Transaction Codes

SE21 and SE80

Package – ZZMM

TR - EP7K900581

EP7K900583

First 3 letters are system name

4th letter is common for any system

Last 6 digits start with 9 – 900000 - 999999


Data Dictionary

It’s a centralized source of SAP

Transaction Codes

SE11 (SE13 and SE14)

SE12

SE16

SE16N – Njoy Transaction Codes

SM30

SD – Flow

Enquiry – VA11/VA12/VA13 – VBAK/VBAP

Quotation – VA21/VA22/VA23 – VBAK/VBAP

Order – VA01/VA02/VA03 – VBAK/VBAP

O/Delivery – VL01N/VL02N/VL03N – LIKP/LIPS

Invoice – VF01/VF02/VF03 – VBRK/VBRP

ECC 6.0

EHP1

EHP2

EHP8
1. Database Table

Student Details – ZZSTU_DET

S.D – Student Details Package - ZZMM

Field Key Data Element Data Type Length Short Description


MANDT Yes MANDT CLNT 3 Client
ZZSTUNO Yes ZZSTUNO CHAR 10 Student Number
ZZSTUNAME ZZSTUNAME CHAR 35 Student Name
ZZSTUADD ZZSTUADD CHAR 40 Student Address
ZZSTUCONT ZZSTUCONT CHAR 10 Contact Number
ZZCLGID ZZCLGID CHAR 10 College Id

Data Element – Its schematic attributes of a field, its maintain Short Description and Domain

Domain – its technical attributes of a filed, its maintain data type and length.

Conversion Routine – will convert from non-sap format to sap format.

College Details – ZZCLG_DET

Field Key Data Element Data Type Length Short Description


MANDT Yes MANDT CLNT 3 Client
ZZCLGID Yes ZZCLGID CHAR 10 College Id
ZZCLGNAME ZZCLGNAME CHAR 35 College Name
ZZCLGADD ZZCLGADD CHAR 40 College Address
ZZCLGCONT ZZCLGCONT CHAR 10 Contact Number

Foreign Key Field – this is used to join 2 tables using key field.

Check table – check the data at field level.

ZZSTU_DET ZZCLG_DET

MANDT MANDT

ZZCLG_ID ZZCLG_ID

Foreign Key Table Check Table

How to provide multiple entries in custom table?


Through Table Maintenance Generator (TMG). Will provide multiple entries and edit or delete the table
records.

How to avoid SM30 transaction initial screen.

Need to create transaction code for Custom table through SE93.

ZZSTUDET

Field Key Data Element Data Type Length Short Description


MANDT Yes MANDT CLNT 3 Client
ZZSTUNO Yes ZZSTUNO CHAR 10 Student Number
ZZSTUNAME ZZSTUNAME CHAR 35 Student Name
ZZSTUADD ZZSTUADD CHAR 40 Student Address
ZZSTUCONT ZZSTUCONT CHAR 10 Contact Number
ZZCREATE_DATE ZZCREATE_DATE DATUM 8 Created On
ZZCREATE_TIME ZZCREATE_TIME TIMES 6 Created Time
ZZCREATE_USER ZZCREATE_USER CHAR 12 Crated By
ZZCHANGE_DATE ZZCHANGE_DATE DATUM 8 Changed On
ZZCHANGE_TIME ZZCHANGE_TIME TIMES 6 Changed Time
ZZCHANGE_USER ZZCHANGE_USER CHAR 12 Changed By

How to maintain table history (Creation and Change) data.

Through Table Maintenance Generator Events.


2. View - view is nothing but a logical view, we can see the data from one or more than one
table.

View only read access, maintenance is not possible.

There are 4 types of views.

Database View: this is used to see the data from one more than one table using join condition
(with common fields).

Projection View: this is used to see the data particular fields of a single table.

Maintenance view: this is used to maintain data among the systems at a time.

Help view: this is used to provide F4 Help.

Note:

In ABAP – we are using only Database view and projection view.

In ABAP-HR – we are using Maintenance view and Help view.

Database View

ZZSTU_DET ZZCLG_ID

ZZCLG_ID

3. Data Type

3 types

a). Data Element. – reusable component.


b). Structure

Create a structure for required fields.


Table: MARA
Fields
MATNR
ERSDA
ERNAM
MTART
MATKL
MEINS

YYMARA – structure
DATA: WA_MARA TYPE YYMARA, - Work Area – Single Record
IT_MARA TYPE SANDARD TABLE OF YYMARA. – Table – Multiple Records.
c). Table Type – this is used at the time of forms development.
DATA: WA_MARA TYPE YYMARA, - Work Area – Single Record
IT_MARA TYPE YYMARA_IT. – Internal Table – Multiple Records.

4. Type Group.

Around 4000+ standard type groups are there in SAP

Mainly we are going to use 4 type groups

SLIS – this is used at the time of ALV reports.

Before ECC 6.0 and EHP5

TYPE-POOLS: SLIS.
After ECC 6.0 from EHP6 on wards no need to declare type-pools.

ABAP – this is used for True or False.

A = ‘X’, A = ABAP_TRUE.
B = ‘ ‘. B = ABAP_FALSE.

ICON – this is used for Traffic light signals.

Success – Green
Warning – Yellow
Failure – Red

TRUXS – this is used upload excel sheet data from non-SAP to SAP.

5. Domain. Reusable component.

6. Search help

Search helps are used to F4 help purpose

There are 3 types of search helps

a) Elementary search help – this is used for providing F4 help for particular fields of a table.
b) Collective search help – groups of elementary search helps are nothing but a collective search
help.
c) Append search help – this is used for adding custom elementary search help to standard
collective search help.
Elementary Search helps

YSTU_ESH

YSTU_ESH1

Collective Search help

YSTU_CSH

Append Search help

Ex: ME32K

Standard Collective search help – MEKK

Vendor Price List

EKKO

EKPO

EKKN

MAKT

T002

Step 1. need to create database view for above tables.

Step 2. Need to create elementary search help for database view.

Step 3. Add custom elementary search help to standard collective search help (MEKK).

Custom Elementary search help for PO Document with Vendor

Table EKKO

Fields - EBELN – Purchase Document

LIFNR – Vendor
BUKRS – Company Code

Step 1. Create elementary search help for new fields ZEKKO_ESH

Step 2. Add custom elementary search help to standard collective search help MEKK.
Indexes – VVIMP

There are 2 types indexes.

1. Primary Index – when will create a table with key field, by default system will generate primary
index.

Select ZZSTUNO

ZZSTUNAME

ZZSTUADD

ZZSTUCONT

ZZCLGID

From ZZSTU_DET

Into table IT

Where ZZSTUNO in selection screen parameter (Input Parameter).

When we are getting data from database table into internal table with non-key fields, will have
some performance issue. At that time will create secondary indexes for those non-key fields.

Select ZZSTUNO

ZZSTUNAME

ZZSTUADD

ZZSTUCONT

ZZCLGID

From ZZSTU_DET

Into table IT

Where ZZSTUCONT IN selection screen parameter (Input Value).

Append Structure – this is used to add new fields to standard data base table using append structure.

Append Structure Include Structure


Append structure add the fields only at end of Include structure insert the fields in middle of the
the table fields table fields
Not possible in custom tables. Not possible in Standard tables
Only possible in standard tables Only possible in custom tables
Need to add custom fields to standard data base table LIPS

Field Data Element Data Type Length Short Description


ZZLEGACYNO ZZLEGACYNO CHAR 10 Legacy Number
ZZLEGACYSYSTEM ZZLEGACYSYSTEM CHAR 35 Legacy System

DATA: A TYPE D, “Date

B TYPE T. “Time

A = SY-DATUM.

WRITE: / A.

DATA: C(20) TYPE C,

B(20) TYPE C,

A(20) TYPE C.

A = ‘SOWMYA’.

*B = ‘UDAY KUMAR’.

C = ‘SREE RANGA’.

WRITE: / A,

/ B,

/ C.

SOWMYA

UDAYKUMAR

SREE RANGA
Internal Tables.

Internal Tables are used to get the data from database table into internal tables at runtime.

There are 3 types of internal tables

Standard Internal Table.

a) Here all fields must be non-unique fields.


b) Its allow the duplicate entries.
c) Here push the data from Work Area to Internal Table through ‘APPEND’ key word.
d) Search the data by Linear search.

Syntax.

DATA: <Work Area> TYPE <Structure Name>,

<Internal Table> TYPE STANDARD TABLE OF <Structure Name>.

Sorted Internal Table.

a) Here all fields must be Unique/non-unique fields.


b) Its won’t allow the duplicate entries.
c) Here push the data from Work Area to Internal Table through ‘INSERT’ key word.
d) Search the data by Binary search.

Syntax.

DATA: <Work Area> TYPE <Structure Name>,

<Internal Table> TYPE SORTED TABLE OF <Structure Name> with unique/non-unique fields.

Hashed Internal Table.

a) Here all fields must be unique fields.


b) Its won’t allow the duplicate entries.
c) Here push the data from Work Area to Internal Table through ‘INSERT’ or ‘COLLECT’ key
word.
d) Search the data by Hash Algorithm.

Syntax.

DATA: <Work Area> TYPE <Structure Name>,

<Internal Table> TYPE HASHED TABLE OF <Structure Name> with unique fields.
Operational Keywords

1. Append – this is used to append the data at end of the table.


2. Insert – this is used to insert the data in between the table fields.
3. Delete – this is used to delete the table records (Duplicate entries).
4. Sort – this is used to sort the table data either Ascending or Descending order.
5. Read – this is used to read the data line by line from table
6. Modify – this is used to modify the table data at run time.
7. Clear – this is used to clear the work area data
8. Refresh – this is used to clear the internal table data.
9. Free - this is used to clear the internal table data.
10. Collect – this is used to avoid the duplicate entries based on integer fields.
11. Editor-call – this is used to edit the data at output list
12. Describe – this is used to count the lines from table.

Occurs
itab 3

1
Space
2
Memory
3
4
Page Memory
DO 5 5

Refresh – its clear only page memory.

Free – its clear both page memory as well as space memory.

MATNR (18) – Material Number

Non-SAP – 12345

SAP - 000000000000012345
Modularization Techniques

These techniques are used to

1. Improve the performance of programs


2. Readability of Programs

a. Macros – Obsolete
b. Includes – these includes using in main programs (Not executable programs).

ZSALES_ORDER – Main Program


INCLUDE ZSALES_ORDER_TOP. “Top Include – we can define structure, Work Area, Internal
Tables, Variables and Constants
INCLUDE ZSALES_ORDER_SCR. “Selection Screen Include – we can use input parameters, check
boxes, radio buttons and file path.
INCLUDE ZSALES_ORDER_FORMS. “Forms Include – all subroutines are used in forms include.

c. Sub Routines – these are used to using parameters and changing parameters at the time of
program developments
d. Function Module – Transaction Code – SE37

When we are going to create any function module must be create function group.

Under one function Group – we can create 99 function modules

Need to develop one function for Sales Order Item Data Fields.

VBAP – Create a Structure for below fields through SE11

VBELN – Sales Document

POSNR – Line Item

MATNR – Material number

MEINS – Unit of measure

KWMENG – Order Quantity

NETPR – Net Price

NETWR – Net Value

Structure – YYVBAP
Reports

Reports are used to fetch the data from database tables into internal tables based on input fields and
display the output.

General Reports ALV Report (ABAP List Viewer)


Simple Report Simple ALV
Classical Report Hierarchical ALV
Interactive Report (Drill down Report) Interactive ALV
Block ALV

Selection screen – this is used for input values

Ranges – Select-Options

Single Values – Parameters

Check Boxes – Parameters

Radio Buttons – Parameters

File Path – Parameters – this is used for upload/download data into Application Server or Presentation
server

Standard Naming Conventions

Select-Options – SO_ or S_ (length is up to 8 char)

Parameters- PA_ or P_ (length is up to 8 char)

Check Boxes – Parameters – P_C1 or P_C2

Radio Buttons – Parameters – P_R1 or P_R2 (radio buttons must be used under group)

File Path – Parameters – P_

Structure Work Area Internal Table

TY_ WA_ IT_

GY_ GS_ GT_

LY_ LS_ LT_

For Any Title or text elements

Text-000 to Text-999

10000 Records

1001 – 2000

4001 – 5000
7001 - 8000

Simple Report

Steps

1. Define Structure for required fields.


2. Define Work Area and Internal table for structure
3. Design Selection Screen
4. Validate Selection Screen fields
5. Get the data from database table into internal table
6. Display the data
7. Provide Header information at output list
8. Provide Footer information at output list.

Validate Selection Screen Fields

Validate field with Value Table

Need to Maintain Message Class

T.code – SE91

Types of Messages.

E – Error

S – Success

I – Information

W – Warning

A – Aband

Message E/S/I/W/A000(message class).

Need to use always standard SAP Messages for using validation – T100

AT SELECTION-SCREEN – this is used to validate single fields of selection screen

AT SELECTION-SCREEN ON Field – this is used to validate more than one field at selection screen.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR File – this is used for provide F4 help for file path
Simple Report – Requirement

Display Sales Order Item Data – VBAP

Input field – VBELN – Sales Document (Selection Screen Field)

Output Fields

VBELN – Sales Document

POSNR – Line Item

MATNR – Material Number

MEINS – Unit of Measure

KWMENG – Order Quantity

NETPR – Net Price

NETWR – Net Value

Standard Naming Conventions.

Structure - TY_ LY_ GY_

Work Area – WA_ LS_ GS_

Internal Tables - IT_ LT_ GT_

Select-Options – S_ or SO_

Parameters – P_ or PA_

Variables – L_ or G_

Constants – C_

Colors – 1- 7

Classical Report – this is used to display the data from one or more than one table

VBAK- Sales Document Header VBAP – Sales Document Item KNA1 – Customer Master Data

VBELN VBELN KUNNR

ERDAT POSNR NAME1

ERNAM MATNR STRAS

AUART KWMENG ORT01

KUNNR NETPR LAND1

NETWR PSTLZ
Classical report will develop 2 ways

Inner Join – when will develop a report with 2 or 3 tables. Will recommend Inner Join

At the time of fetching data need to use alias names for tables

VBAK – V

VBAP – B

For All Entries – more than 2 or 3 tables, will recommended for all entries.

Purchase Order Data

EKKO – Purchase Order Header

EKPO – Purchase Order Item

Events in Classical Report

Initialization – this is used to provide default values to selection screen

Sign – ‘I’ – Include

‘E’ – Exclude

Option – ‘BT’ – Between

‘NE’ – Not Equal to

‘LT’ – Less Than

‘LE’ - Less than or equal to

‘GT’ – Greater Than

‘GE’ - Greater than or equal to

Low – Lower Value

High – Higher Value

At Selection-Screen – this is used to validate Selection screen fields

At Selection-Screen on field – this is used to validate selection screen fields individually.

Start-of-Selection – this is used to fetch the data from data base table into internal table

End-of-Selection – this is used to display the output data.

Top-of-Page – this is used to provide header information.

End-of-Page – this is used to provide footer information.

Note: Some-times with any events will display the report. But when will use any event before select
statement must me use start of selection event.
Initialization. 1

At Selection-Screen. 2

Start-of-Selection. 3

End-of-Selection. 5

Top-of-Page. 4

End-of-Page. 6

Control Break Events.

At First – this is used for title purpose.

At New – this is used for redundancy purpose.

At End of – this is used for Sub Totals

At Last – this is used for Grand Totals.

The above four events working only with in loop and endloop.

On Change off – this is also used for redundancy purpose.

Its will work any-where in the program.

Interactive Report (Drill Down Report).

There are 21 lists in interactive report

1 is Basic List

Remaining 20 are Secondary List.

For interaction purpose – SY-LSIND

Events in Interactive report

1. At Line-selection – this is used for double click purpose


2. Top-of-page during line-selection – this is used for providing header information at secondary
list.
3. Set pf-status – this is used for providing function keys at application tool bar.
4. At user-command – this is used for providing functionality for function keys.

2 techniques are available in interactive report

1. Hide – this is used for extracting the exact data from previous list to next list.
2. Get Cursor – this is used for where user place the cursor then only its interact to next list.

KNA1- General Data in Customer Master

VBAK – Sales Document Header Data


VBAP – Sales Document Item Data

Sales Flow

Sales Order Delivery Invoice

One Sales Order 1. Delivery 1. Invoice

Delivery Invoice

One Sales Order Delivery Invoice

Delivery

Invoices

Deliveries

Sales Order

Selection Screen

Billing Document – VBRK-VBELN - Ranges

Output Fields

Invoice Table Fields Delivery Table Fields Sales Order Fields

VBRK VBRP LIPS LIKP VBAP VBAK

VBELN VBELN VBELN VBELN VBELN VBELN

FKART POSNR POSNR LFART POSNR ERDAT

FKDAT MATNR MATNR LFDAT MATNR ERNAM

VKORG FKIMG LFIMG ROUTE KWMENG AUART

NETWR NTEWR NETPR

VGBEL VGBEL

VGPOS VGPOS
SD Consultant

Sales Order – VA01

VBAK – 7 Series for Order – 7000000000 - 7999999999

7000007078

ALV (ABAP List Viewer)

Simple ALV

Interactive ALV

Hierarchical ALV

Block ALV

Here – we can’t use any write statement to display output.

Always we are using Function Modules

FM: REUSE_ALV_*

Type group – SLIS

Define Field catalog

DATA: WA_FCAT TYPE SLIS_FIELDCAT_ALV,

IT_FCAT TYPE SLIS_T_FIELDCAT_ALV.

COL_POS

FIELDNAME

SELTEXT_M, SELTEXT_L, SELTEXT_S

TABNAME

NO_ZERO = ‘X’

NO_OUT = ‘X’

DO_SUM – Grand Total = ‘X’

Top of Page at output for any header Information

Events

DATA: WA_EVENT TYPE SLIS_ALV_EVENT,

IT_EVENT TYPE SLIS_T_EVENT.


Name

Form

Some Text under top of page

List Header

DATA: WA_LIST TYPE SLIS_LISTHEADER,

IT_LIST TYPE SLIS_T_LISTHEADER.

PARAMETERS

Typ = ‘H’, ‘S’ and ‘A’

Key

Info

Sub Totals

DATA: WA_SORT TYPE SLIS_SORTINFO_ALV,

IT_SORT TYPE SLIS_T_SORTINFO_ALV.

Lay out for Block ALV

DATA: WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

Hierarchical ALV (Key Field)

DATA: WA_KEY TYPE SLIS_KEYINFO_ALV.

How to Display Logos in ALV Reports?

Using Transaction Code: OAER

Its display only JPEG format

EKKO EKPO LFA1

Hierarchical ALV

EKKO – Purchase Document Header

EKPO – Purchase Document Item

Key info for header and item common field.

COL_POS, FIELDNAME, SELTEXT_M AND TABNAME


REUSE_ALV_HIERSEQ_LIST_DISPLAY

Hierarchical ALV with 4 tables

Input Fields

Customer – KNA1-KUNNR

KNA1 VBAK VBAP VBEP

KUNNR VBELN VBELN VBELN

NAME1 ERDAT POSNR POSNR

ORT01 ERNAM MATNR ETENR

LAND1 AUART KWMENG EDATU

KUNNR NETWR

IT_KNA1 IT_VBAK IT_VBAP IT_VBEP

HEADER ITEM

KUNNR VBELN

NAME1 POSNR

ORT01 MATNR

LAND1 KWMENG

VBELN NETWR

ERDAT ETENR

ERNAM EDATU

AUART

IT_HEADER IT_ITEM

For Header

LOOP AT IT_VBAK INTO WA_VBAK.

WA_HEADER = WA_VBAK.

READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_VBAK-KUNNR

BINARY SEARCH.

IF SY-SUBRC EQ 0.
WA_HEADER = WA_KNA1.

ENDIF.

APPEND WA_HEADER TO IT-HEADER.

CLEAR: WA.

ENDLOOP.

FOR ITEM

LOOP AT IT_VBEP INTO WA_VBEP.

WA_ITEM = WA_VBEP.

READ TABLE IT_VBAP INTO WA_VBAP WITH KEY VBELN = WA_VBEP-VBELN

POSNR = WA_VBEP-POSNR

BINARY SEARCH.

IF SY-SUBRC EQ 0.

WA_ITEM = WA_VBAP.

ENDIF.

APPEND WA_ITEM TO IT_ITEM.

CLEAR: WA.

ENDLOOP.

You might also like