Abap Material Final
Abap Material Final
Abap Material Final
SAP R/3
SYSTEM APPLICATIONS PRODUCTS
INDATA PROCESSING
ABAP/4
Contents
1
SAP R/3
System Applications and Products
Indata Processing
Introduction to SAP
SAP was founded in 1972 in walldorf, Germany.
It stands for System ApplicationProduct In Data Processing over
the year it grows and evolved to becomes the world premier
provider for client/server business solutions for which it is so well
today.
It is an Erp Product.
All the Modules of sap can be classified into
1) Technical : a) Basis
b) Abap
2) Functional : a) SD (Sales and Distribution)
b) MM (Material Management)
c) HR (Human Resources)
d) Fi/co (Finance and Controlling) . Etc.
ABAP/4.
Advance Business Application
Programming.
ABAP is a programming language developed by SAP for the
interactive development of application programming.
DESCRIPTION
TCOD
E
Data Dictionary
Xd01
Abap editor
Xk01
Function Builder
Va01
Menu painter
Mm0
1
Screen painter
Me21
n
Form Builder
Co01
Table Maintenance Vl01
generator
upload logo
Vf01
Package builder
Me51
n
Class builder
Message class
Tcode creation
DESCRIPTION
Create
Create
Create
Create
customer
vendor
sales order
material
Purchase order
Production order
Delivery
Billing
Purchase
requisition
Lsmw
Smartforms
Badi definition
Badi
implementation
Exit definition
Exit
implementation
Object navigator
Recording
Tables
Kna1
Knb1
Knc1
Lfa1
Lfb1
Lfc1
Mara
Marc
Mard
Makt
Ekko
Ekpo
Eban
Ebkn
Tables
Vbak
Vbap
Likp
Lips
Vbrk
Vbrp
T001
T001w
Data Dictionary
Tcode: SE11
Definition:
10
Classification:
1. BASIS (table can be client dependent & client independent)
2. Technical (tables can be transparent tables, cluster tables &
pooled tables)
3. Functional (table can be master tables, transaction tables,
configuration tables & system tables)
1. BASIS Classification:
Client dependent
Also called as Client specific
Client independent
Also called as cross client
11
DATA CLASSES:
a. Master Data: are used to maintain master data. Master
data is the data which is almost constant and rarely
changed. E.g. Customer master data, vendor master data,
material master data, and HR master data.
b. Transactional Data: are used to maintain transactional
data. Transactional data is the data which changes
frequently and rarely constant. E.g. sales document item
data, purchase document item data, billing document item
data, delivery document item data.
c. Customizing Data (or) configuration data: maintains
organization data. Organization data is the data which is
entered initially while setting up a new organization. E.g.
clients T000, company codes T001, country T005.
12
Save
Technical Settings
DATA CLASS:
- Specifies the logical storage area (table space) occupied by
current table in the underlying database. The table space
depends on type of data.
Ex: (types of data)
APPL0: master data transactional tables
APPL1: transactional data transparent tables
APPl2: organization data customizing tables
13
14
Se11
Select the radio button domain
Short description
15
16
Se11
Select the data type radio button
Select data element
Provide short description
Provide the domain and enter automatically data type and
length are copied since domain is already created and activated.
Come to fields tab
Provide field labels (i.e. short descriptions).
Save, check and activate.
Other way of creating the data base table fields.
Create table
Provide field name
Provide data element
Double click on data element
Save
Yes
Provide short description for data element
Provide domain
Double click on domain
Save
Yes
Provide short description for domain
Provide data type and length
17
18
22
25
26
27
28
ZESHELP2
ZHELPVIEW1
ZHELPVIEW2
ZEMP
ZDEPT
EMPNO
EMPNAME
DEPT NAME
EMPADD
ADDR
DEPT NO
DEPT NAME
ZEMP1
ZDEPT1
EMP NO
DEPT NO
EMP NAME
DEPT ADD
DEPT
ZZSHELP
ZESHELP1
ZESHELP2
ZHELPVIEW1
ZHELPVIEW2
MAKT
MARA
MARA
MARC
29
30
Then go to Data base table for which you want to assign the
collective search help.
31
32
STRUCTURES:
- Structure is a data type defined in ABAP Dictionary.
- Structure is a collection of components with different data
types.
- Structure is an independent repository object.
- Structure is included into data base table.
- One structure can be included into multiple database tables
(reusability).
- Structure does not contain data.
- When structure components are included in table, it becomes
table fields (data maintenance is possible).
- We can attach check table or search help to structure
component.
- It is a combination of fields.
- Structure can hold only one record at a time.
33
35
38
39
40
PROJECTION VIEW:
- It is used to hide some data of single table and in turn display
other data.
- It is always created on single table only.
- Selection conditions are not possible.
- Maintenance status read only. (it is possible but we dont do
it)
- It is used in the programs whenever we require single table
particular fields data.
PROCEDURE TO CREATE PROJECTION VIEW:
- Go to SE11 > select view > zb3_pview > create >
projection view > copy.
- Provide short description and basis table (mara).
- Click on tables field select key fields and required fields
copy.
- You will see all the selected tables under view fields.
- Save check activate.
- Utilities table content all the fields will be displayed.
41
42
MAINTAINENCE VIEW:
- It is used to fetch the data from more than one logically related
table.
- It also used to maintain data (insert, change, delete) into
several tables.
- It implements left outer join.
43
SINGLE SCREEN
READ
CHANGE
DELETE
INSERT
MAKT
MARA
- In the above picture, in first page which is overview page, the
user can fetch data from more than one table and he also has
access to read, change and delete data from database
permanently.
- And in the second page which is single screen page, he can
insert new entries.
- Table maintenance generator is used to create table
maintenance program to add, modify or delete records in the
database table. This can be accessed using transaction SM30,
SE54 or in SE11 -> menu utilities -> table maintenance
generator.
CUSTOM MAINTENANCE VIEW CREATION:
- Go to SE11,
- Provide view name starting with z.
- Create
- Maintenance view copy
- Short description
- Provide table name as MAKT under table/join.
- Click on relationship.
- Click on view fields, notice that left side system key fields
automatically because of left outerjoin.
- Select key fields from right side table.
44
47
After the above settings click on the create button in the Table
maintenance generator.
49
50
HELP VIEW:
- Also used to fetch data from more than one table and display
output.
- It implements left outer join.
- Selection conditions are possible.
- Maintenance status is read only.
- It is used as selection method while creating elementary
search help.
51
52
53
LOCK OBJECT:
- Lock object is used to restrict the simultaneous access of
database table entry by multiple users at a time.
54
57
58
60
-------------------------------------------------------------------------------------------------------------------------------------------PROGRAMMING
-------------------------------------------------------------------------------------------------------------------------------------------ABAP ADVANCED BUSINESS APPLICATION
PROGRAMMING:
It
It
It
It
It
It
It
It
It
is
is
is
is
is
is
is
is
is
PROGRAM TYPE:
1. TYPE 1 - EXECUTABLE PROGRAM (self-executable program)
2. TYPE I include program
3. Type M - module pool program
4. Type S subroutine pool
5. Type F function pool
6. Type K class pool
7. Type J interface pool
8. Type T type pool
9. Type X XSLT program (used to convert ABAP program to
XML and vice versa).
ABAP EDITOR STANDARDS:
- User defined program name must begin with Y or Z.
64
COMMENTS:
- These are used to describe some tables or variables as
documentation.
- It increases the readability of source code.
- Single line comment
o Place * in the first column position (*write /jai.)
- Multiple write comment
o Select multiple lines press ctrl + < for comment and
press ctrl + > to uncomment.
o Or select the line and right click and comment or
uncomment.
- In line comment:
o Within the line partial string can be commented using
Double quotes.
KEYWORDs:
DATA is used to declare variables, work areas, internal tables.
TYPES is used to define USER DEFINED (custom) elementary
data types, structure types, internal
Table types.
VARIABLE: e.g. Kunnr is a variable, but its value changes. It is not
constant.
CONSTANTS is used to define constant variable.
FIELD-SYMBOLS is used to declare field symbols.
WRITE is used to display output.
66
68
70
234
Way 2:
*&---------------------------------------------------------------------*
*& Report ZEBRA7
*&---------------------------------------------------------------------*
71
REDDY
20
ram
Way 3:
*&---------------------------------------------------------------------*
*& Report ZEBRA7
*&---------------------------------------------------------------------*
REPORT ZEBRA7 NO STANDARD PAGE HEADING.
*// declare structure
data : begin of emp ,
empno type i,
empname type char12,
begin of stru1,
stuno type i,
stuname type char10,
72
REDDY
20
ram
..,
Field N Type <data type>,
End of <Types name>.
Syntax for declare the structure by referencing the TYPES:
DATA : <Structure Name> Type <Types Name> .
Syntax for declare the internal table by referencing the TYPES:
DATA : <Itab name> Type table of <Types Name>.
73
75
78
80
Endloop.
Syntax:
2.Modify the data in the internal table by using the modify
keyword
Syntax: Modify <itab> from <work area> transporting <field
name> where <condition>.
Ex:
MODIFY lt_item FROM wa_item TRANSPORTING itemprice WHERE i
temno = wa_item-itemno.
3.Delete the data by using the delete keyword
i. deleting the duplicate records:
Syntax: delete adjacent duplicate from <Itab>.
81
Open sql:
1.open sql is used to working with the database tables not with
the internal tables
2.Inser, Update, Modify a single record always through the work
area and multiple records through the internal table
3.whenever we are working with the database table then the
structure of the work area and the internal table must be similar
through the database table
The open sql statements are
1.select
84
*&---------------------------------------------------------------------*
*& Report ZVISHNU_DATA_RETRIEVE
*&---------------------------------------------------------------------*
REPORT zvishnu_data_retrieve NO STANDARD PAGE HEADING.
*// Work area declaration
DATA : wa_cust TYPE zcaddress.
*// Design selection screen for Customer
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE tex
t-001.
PARAMETERS : p_custno TYPE zcaddress-customerno.
SELECTION-SCREEN END OF BLOCK blk1.
*// Retrieve data from zcaddress
SELECT * FROM zcaddress
INTO wa_cust
WHERE customerno = p_custno.
ENDSELECT.
85
86
Note: if we use the select single then it will display the output
immediately after satisfying the condition
If we are not use the where condition then it displayed first record
as the output
Way4.
Select single <field1><field2>.<field n> from <DB table>
where <condition>.
88
Way5.
Select * from <DB table> into <work area> up to N rows where
<condition>.
Endselect.
Way6
Select <field1><field2>.<field n> from <DB table> up to
N rows where <condition>.
Endselect.
REPORT zvishnu_data_retrieve NO STANDARD PAGE HEADING.
********UPTO 1 ROW SELECTED FIELDS*******************
*// types declaration for marc
types : begin of ty_mara,
matnr type matnr,
ersda type ersda,
ernam type ernam,
end of ty_mara.
*// work area declaration
data : wa_mara type ty_mara.
*// retrieve data from marc
select matnr ersda ernam
from mara
into wa_mara
up to 1 rows.
ENDSELECT.
*// display output
write : / wa_mara-matnr, wa_mara-ersda, wa_mara-ernam.
Output:
90
94
95
Delete:
delete the data from the database based on the condition
syntax:
Delete from <db table> where <condition>.
Deleing the single record
REPORT zvishnu_data_retrieve NO STANDARD PAGE HEADING.
*//deleting data from zcustomer
delete from zcustomer1 where custno = 100.
if sy-subrc eq 0.
write : / 'succesfully deleted'.
else.
97
103
107
Inner joins
Inner joins are used to retrieve the data from multiple tables.
Whenever we are working with the inner joins then not need to
declare the types for each and every table only declare the final
types
Inner join fetch the data based on ON condition first next is based
on WHERE condition.
Retrieve the data from Mara, marc
REPORT zinnerjoin_mara NO STANDARD PAGE HEADING.
TABLES:mara.
TYPES :BEGIN OF ty_final,
matnr TYPE matnr,
108
Modularization techniques:
Modularization techniques are used to divided the business
processing logic into reusable block of statements
This is two step processing
1. Define the reusable block
2. Calling the reusable block
In Abap we have 4 modularization techniques
1. Includes
2. Subroutines
3. Function modules
4. Macros
Includes:
Include programs are cant executed directly (non executable
programs). One include program can be used in any number of
programs
Steps to create the include program:
Go to SE38 transaction code
Enter the program name
110
111
Subroutines:
Subroutines are program modules which can be called from
ABAP/4 programs. Frequently used parts of program can be put
into subroutines and these subroutines can be called explicitly
from the program.
Defining Subroutines
112
113
REPORT ZMACRO.
data : begin of wa,
bukrs like t001-bukrs,
butxt like t001-butxt,
ort01 like t001-ort01,
end of wa,
it like table of wa.
define zfill.
wa-bukrs = &1.
wa-butxt = &2.
wa-ort01 = &3.
append wa to it.
end-of-definition.
zfill '1000' 'tcs' 'hyd'.
zfill '2000' 'cts' 'bag'.
115
subroutines
116
117
118
119
After writing source code save and activate the code then we use
this function module any program. if we want to use this program
in the SE38
Go to SE38
Enter the program name click on create and save Ur program in
ur package
And enter the source code
To call the function module in to Ur program. place the courser
where we want and click on pattern tab on top of the window, and
select the CALL FUNCTION radio button enter the function module
name click on enter then it will exported in to ur program.
123
SE38 code
REPORT zmaterial_data NO STANDARD PAGE HEADING MESSAGEID zmymessage.
*//internal table creation
DATA : lt_zmmaterial TYPE TABLE OF zmmaterial.
*//work area declaration
DATA :wa_zmmaterial TYPE zmmaterial.
*//selection screen design
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
124
Function modules
130
Initialization
at selection screen start -of-selection
|
End-of-selection
--------------- > --------------------------------------------------- ->
Selection
screen
At selection
screen on
End-of-page
132
134
endloop.
endif.
TOP-OF-PAGE DURING LINE-SELECTION.
137
GET CURSOR:
Hide technique generates the next list based on
the line selection. If we want to generate the next list based on
the field selection then we go for get cursor technique. Get
Cursor technique returns the field name as well as field value
which is selected by the user.
Sy: get cursor field <variable1> value <variable2>.
*&---------------------------------------------------------------------*
*& Report ZGETCURSOR
*&---------------------------------------------------------------------*
REPORT ZGETCURSOR.
types : begin of ty_ekko,
ebeln type ekko-ebeln,
bsart type ekko-bsart,
lifnr type ekko-lifnr,
end of ty_ekko,
begin of ty_ekpo,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
matnr type ekpo-matnr,
end of ty_ekpo,
BEGIN OF TY_LFA1,
LIFNR TYPE LFA1-LIFNR,
NAME1 TYPE LFA1-NAME1,
ORT01 TYPE LFA1-ORT01,
END OF TY_LFA1.
138
vbeln
posnr
kwmeng
meins
from vbap into
table it_vbap
where vbeln in s_vbeln.
Loop at
Call
142
= it.
143
= IT_FIELDCAT
= IT.
Events :
In alv all the events are handled through
subroutines only.
Whenever we are working with events then we
must declare
an internal table which contains 2 fields like
1) Name : Name of the event
2) Form: Form which handle the event.
In slis we have one type i.e. slis_t_event which
contains these 2 fields so we simply declare our
event internal table by referring this type.
Events in alv:
1) Top_of_list :
It is an event which triggers at the top of the
displayed
output.
2) Top_of_page :
It is an event which triggers at the top of
each page.
3) End_of_page :
147
*&---------------------------------------------------------------------*
*& Report ZALV3
*&
*&---------------------------------------------------------------------*
REPORT ZALV3.
TYPE-POOLS : SLIS.
DATA: WA TYPE ZALV_STR,
IT TYPE TABLE OF ZALV_STR,
V1 LIKE KNA1-KUNNR.
SELECT-OPTIONS : S_KUNNR FOR V1.
DATA : IT_FIELDCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
WA_FIELDCAT LIKE LINE OF IT_FIELDCAT.
DATA : IT_EVENT TYPE SLIS_T_EVENT,
WA_EVENT LIKE LINE OF IT_EVENT.
148
= 'ZALV_STR'
= SY-CPROG
= IT_FIELDCAT
= SY-CPROG
149
= WA_LAYOUT
= IT_FIELDCAT
= IT_EVENT
TABLES
T_OUTTAB
= IT.
FORM ZTOP.
DATA: IT_LIST TYPE SLIS_T_LISTHEADER,
WA_LIST LIKE LINE OF IT_LIST.
WA_LIST-INFO = 'CUSTOMER BASED SALES ORDER DETAILS'.
WA_LIST-TYP = 'A'.
APPEND WA_LIST TO IT_LIST.
CLEAR WA_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY
= IT_LIST
I_LOGO
= 'LOGO'
.
ENDFORM.
BLOCKED ALV:
It is used to display the output in a block wise.
Steps to work with blocked alv:
1) Initialize the blocked alv by using the function module
Reuse_alv_block_list_init.
Input for the above function module is current program
i.e. sy-cprog.
2) Append the data internal table information to blocked alv by
using Reuse_alv_block_list_append.
Input for the above function module is
1) Data Internal Table
2) Fieldcatalog Internal Table
3) Event Internal Table
150
= IT_EVENT1
= IT1.
If the user interact with the output list then it call the ME23N
transaction code
160
Like that we will get the output for both list and grid.
Transaction code creation for Reports
Go to SE93 Tcode
Enter the transaction code
Click on create
Enter the short text
161
162
163
164
3) Click on display
165
10)
Click on continue.
Click on continue.
167
ABAP DEBUGGER
It is useful to check the program execution flow behind the
screen.
- We can check select statement result, population of internal
tables.
- In detail checking is possible.
- It is useful to resolve runtime error.
Menu path:
From any screen:
- System menu -> utilities -> debug abap/screen/system
From ABAP Editor initial screen:
- SE38 -> debugger tab
- Program menu -> execute -> debugger
From ABAP Editor Program Screen:
- Program menu -> test -> debugger
- BREAK-POINT this system also takes us to debug mode.
- /h - this system is also used to debug the program.
Debugger is of two types:
- Classic debugger
- New debugger
Menu path to set default debugger:
171
173
Screen 200
Progra
m
175
Executable Program
176
Layout
Database
Driver
program
Address
Logo
Main
Footer
180
181
182
And here give the next page as page2 and click on save and go to
page1 and change the next page as page2.
After creating the pages then we will create the all the windows.
Creating windows:
Click on window tab.
But we used only main and variable window in the real time
If we click on the window tab then the system will generate one
main window automatically .
If u click on the window button on the top of window then it will
give like this
183
Give the window name and meaning like that we can create any
number of windows.
184
After placing the window then it will ask left margin , window
width , upper margin , window height
Fill all the requirements .
186
Then enter the paragraph name(2 char) like p1 enter the meaning
and click on font button. Then we will select the font family , size,
and other options and click on save
188
If u click on the text element one window will be occurred like this
If u click on
this button in that window then one popup
window will be open like this
Where we can see our paragraph formats and character formats
some other options select any one option based on your
requirement.
189
And click on
(back button) and click on save and activate
then if u want to see the output
Steps to transfer the data from driver program to layout:
1) Create an executable program and implement the retrieving
logic.
2) Access the layout from the driver program by using
open_form function module.
3) Transfer the data from driver program to particular page
window by using write_form function module.
Repeat the same step for each which contains program
symbols.
4) Close the form by using close_form function module.
190
191
Then on popup window will be opened then give the file name
(where we will give the file path in you system), name(name of
image), description and select the image type and click on
continue.
192
194
195
197
200
Then enter the same name that are used in the element
parameter in write_form
Here we used /E( Text Element)
201
Enter the fields in the customer table (KNA1) in between the &
203
Then enter the same name that are used in the element
parameter in write_form
204
Variable window
1.based on the window size we
can print the text
2.we cant split the variable
window
205
Control commands:
Control commands are used to control the displayed output
Control commands always start with /:
Total we have different control commands in scripts
1. Include
This command is used to include the standard text which is
defined in SO10 Tcode.
Creating standard text: - The standard text is client
dependent.
Go to SO10 TX code enter the text name and click on create
207
208
Then on window will be open in that window enter the text name
and click on continue (enter)
.
/:endaddress.
4.protect.endprotect
This command is used to print the continuous with out any page
breaks
Ex: /:Protect
*Sun Shine Technologies
* Lingampally
* Hyd
/:endprotect.
5.Topendtop
This command is used print the header information only on main
window
Ex: /:Top
* Pur.doc item quantity
210
213
SMARTFORMS
Go to smartforms tx code
214
Under the smartforms the system will generate two main tasks
1.global settings
2.page and windows
Form attributes:
Form attributes contains the two tabs like
1.General attributes
2.Output options
215
General attributes:
Nothing but properties of that particular form, here we have
Output options:
Under the output option tab we select the page formats and style
Form interface:
It is the interface between the form and driver program where we
can see the tabs like
216
Global data:
Where we can declare the work area, internal tables and
variables.
Types: here we declare the user defined types
Field symbols : under the field symbols tab we can declare the
field symbols
Field symbol means is a data type where we can store ant type of
data
Initialization : where we can implements the subroutines
Form routines: where we can declare the subroutines
Currency / Quant. Fields : where we declare the currency and
quality fields
2.pages and windows:
Under the pages and windows system will generate one page and
one window by default
Page: page we can contain 3 tabs
1.General attributes: here we give the next page
217
218
219
System will generate one page and one main down by default and
we will create another page like this. After creating the second
page we will give the next page in page in page1 as page2.
220
After creating the page we will create the windows under the
page
We have 4 types of windows
1.Main window
2.Secondary window
3.Copied window
4.Final window .
But in real time we used only main and secondary windows
Like the u will create any number of windows under one page.
221
For each and every window we will give the position and size
under output options tab.
After entering the all the windows position by using form painter
option we can see the page layout and we can adjust the
windows.
After creating the windows in the page1 no need to create the
windows for page2 we simply copy the windows from page1 and
past in page2. select which window we want and copy from page1
and copy that window and past in page2.intially page2 we dont
have any windows.
222
After entering the all the windows position by using form painter
option we can see the page layout and we can adjust the
windows.
After creating the windows and we need to create the text in
each and every page.
Creating style:
Go to smartforms tx code select the style radio button and enter
the style name.
223
Click on create
Then one window will be trigger like this.
224
click on continue.
One window will trigger where we can enter the description. And
give the font family size style under the font tab
One window will trigger where we can enter the character formats
name.
225
and we go to
the font and select the font style, size and family.
At last we specify the standard paragraph at header data
226
Click on save . and click on text tab where we can enter our
standard data.
227
228
Then on popup window will be opened then give the file name
(where we will give the file path in you system), name(name of
image), description and select the image type and click on
continue.
229
230
231
232
Then on window will be open like this then enter the data
233
click on yes
Then one window will trigger like this
click on F4.
Then one window will open like this
234
Select the text type as text module and click on enter the
system will ask
235
click on yes.
Then one window will be open like this
Under the general attributes give the name and click on enter
then the window like this
236
Then we will see like this under the system fields we have all the
system fields just select the field and drag and drop.
237
239
Global data:
Where we can declare the variables and work area internal tables
Under the global data we can declare the work area
240
In the form interface we declare the lifnr and click on save and
activate. And click on text under that window where we can
display the values dynamically.
244
245
246
247
Next we call the function module that are created by the system
while executing the smart forms
Go your smart form environment -> function module name
System will give the function module of that particular smart form
Click on general attributes tab and go to utilities -> field list on/off
249
Click on details
251
252
Then select the frame by pressing shift + mouse left click and
select the outer frame to give the frame to outer frame
Like that we create the frames after right click on header create
-> line type
One window will open where we need to enter the line type and
style
253
Like that we select the line type for main area and footer
254
Click on save
Under main window we can see like this
Click on save
After creating all the windows then double click on the table
then we get like this
Go to Data tab
Under the data tab we loop the internal table
256
257
258
Like that we display the data dynamically in each and every text
in the main area.
Displaying the purchase order number:
Right click on window create -> flow logic -> program lines
260
261
Select the text under the barcode window (window9) and enter
the style name
Go to general attributes
262
Under the global data we have lv_ebeln fields drag and drop and
select the character type as
C2 14pt bar code
263
Click on execute
Then it display list of images that are available
Select one picture and double click on it and select the resolution
and output mode and position click on save and activate then in
the output mode we can see the background picture
264
SE38 code:
REPORT zsprint_program1 NO STANDARD PAGE HEADING.
*// Tables declaration
TABLES ekpo.
*// Constants declaration
CONSTANTS con_sform TYPE tdsfname VALUE 'ZVISHNU_SMARTFO
RMS1'.
*// Types declaration for EKPO
TYPES : BEGIN OF ty_ekpo,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
statu TYPE astat,
aedat TYPE paedt,
txz01 TYPE txz01,
matnr TYPE matnr,
265
267
268
269
Click on change
270
Click on save
While saving it ask the transport request number
Here we create the customizing request instead of workbench
request
Difference between the script and smart from:
Script
1.Script is client dependent
2.in script we cant design the
page without main window
3.In the script minimum one
main window and maximum 99
main windows we can place one
page
4.In script we can creating
Smart form
1.Smart form is the client
independent
2.where as smart form we can
design the page without main
window
3.whereas in smart form
minimum 0 main windows
maximum 1 main window we
271
272
The data input data file will come in the form of a flat file which
the user save as file type txt file or prn file from the Microsoft
Excel program. An Abaper will create a program to read the text
file and upload into the SAP system.
BDC TYPES:
There are 3 types
1.Call Transaction Method
2.Session Method
3.Direct Input Method
NOTE: Both the session and call transaction method we call
BATCH INPUT method
Where the direct inputs are the standard programs to posted the
data in to SAP.
Itab
Tcode
SAP DB
If you are uploading data from the non-sap to sap then the flat file
structure and the Itab structure should be same data elements
also same and sequence also same but field names may be
different
273
276
Click on enter
Then another screen will trigger then enter the fields we want
then click on enter like that we give the field for each and every
screen
Then we will get screen like this
277
Then one window will trigger where we will give the program
name
278
click on enter
And another window will trigger where we will give the short
description and click on source code then system will create the
program
279
*&---------------------------------------------------------------------*
*& Report ZVSIHNU_BDC_VENDOR_CREAT
*&---------------------------------------------------------------------*
REPORT ZVSIHNU_BDC_VENDOR_CREATE NO STANDARD PAGE HE
ADING.
INITIALIZATION.
*//Internal Table Dclaration
DATA:lt_final TYPE TABLE OF zfinal_structure2.
*//Work Area Delaration
DATA:wa_final TYPE zfinal_structure2.
*
wa_final-ekorg.
bdc_field
USING 'RF02K-KTOKK'
wa_final-ktokk.
bdc_dynpro
USING 'SAPMF02K' '0110'.
bdc_field
USING 'BDC_CURSOR'
'LFA1-LAND1'.
bdc_field
USING 'BDC_OKCODE'
'/00'.
bdc_field
USING 'LFA1-ANRED'
wa_final-anred.
bdc_field
USING 'LFA1-NAME1'
wa_final-name1.
bdc_field
USING 'LFA1-SORTL'
wa_final-sortl.
bdc_field
USING 'LFA1-NAME2'
wa_final-name2.
bdc_field
USING 'LFA1-STRAS'
wa_final-stras.
bdc_field
USING 'LFA1-ORT01'
wa_final-ort01.
bdc_field
USING 'LFA1-PSTLZ'
wa_final-pstlz.
bdc_field
USING 'LFA1-LAND1'
wa_final-land1.
bdc_dynpro
USING 'SAPMF02K' '0120'.
bdc_field
USING 'BDC_CURSOR'
'LFA1-KUNNR'.
bdc_field
USING 'BDC_OKCODE'
'/00'.
bdc_dynpro
USING 'SAPMF02K' '0130'.
bdc_field
USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
bdc_field
USING 'BDC_OKCODE'
'=ENTR'.
bdc_dynpro
USING 'SAPMF02K' '0210'.
bdc_field
USING 'BDC_CURSOR'
'LFB1-FDGRV'.
bdc_field
USING 'BDC_OKCODE'
'/00'.
282
wa_final-inco2.
bdc_field
USING 'LFM1-KZAUT'
'X'.
bdc_dynpro
USING 'SAPMF02K' '0320'.
bdc_field
USING 'BDC_CURSOR'
'RF02K-LIFNR'.
bdc_field
USING 'BDC_OKCODE'
'=ENTR'.
Session method:
Flat File
SAP DB
Itab
Session
Tcode
290
BDC_OPEN_GROUP:
Here we gave 4 parameters
1.client client name (sy-mandt)
2.group session name
3.user System user (sy-uname)
4.Keep we pass X (keep the session if finished )
If we pass space (Delete the session if finished )
BDC_INSERT:
Here we pass 2 parameters
TCODE transaction code
291
= p_path.
START-OF-SELECTION.
con_path = p_path.
*//Uploading Data from Prsenetation Server
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = con_path
filetype = 'ASC'
TABLES
data_tab = lt_final.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'FIRST'
keep = 'X'
user = sy-uname.
LOOP AT lt_final INTO wa_final.
PERFORM bdc_dynpro
USING 'SAPMF02K' '0100'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'RF02K-BUKRS'
wa_final-bukrs.
PERFORM bdc_field
USING 'RF02K-EKORG'
wa_final-ekorg.
PERFORM bdc_field
USING 'RF02K-KTOKK'
wa_final-ktokk.
PERFORM bdc_dynpro
USING 'SAPMF02K' '0110'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'LFA1-LAND1'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'LFA1-ANRED'
293
wa_final-anred.
bdc_field
USING 'LFA1-NAME1'
wa_final-name1.
bdc_field
USING 'LFA1-SORTL'
wa_final-sortl.
bdc_field
USING 'LFA1-NAME2'
wa_final-name2.
bdc_field
USING 'LFA1-STRAS'
wa_final-stras.
bdc_field
USING 'LFA1-ORT01'
wa_final-ort01.
bdc_field
USING 'LFA1-PSTLZ'
wa_final-pstlz.
bdc_field
USING 'LFA1-LAND1'
wa_final-land1.
bdc_dynpro
USING 'SAPMF02K' '0120'.
bdc_field
USING 'BDC_CURSOR'
'LFA1-KUNNR'.
bdc_field
USING 'BDC_OKCODE'
'/00'.
bdc_dynpro
USING 'SAPMF02K' '0130'.
bdc_field
USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
bdc_field
USING 'BDC_OKCODE'
'=ENTR'.
bdc_dynpro
USING 'SAPMF02K' '0210'.
bdc_field
USING 'BDC_CURSOR'
'LFB1-FDGRV'.
bdc_field
USING 'BDC_OKCODE'
'/00'.
bdc_field
USING 'LFB1-AKONT'
wa_final-akont.
bdc_field
USING 'LFB1-FDGRV'
wa_final-fdgrv.
bdc_dynpro
USING 'SAPMF02K' '0215'.
bdc_field
USING 'BDC_CURSOR'
'LFB1-ZTERM'.
bdc_field
USING 'BDC_OKCODE'
'/00'.
294
Click on execute
296
Then system will ask which mode we execute the session select
any mode and click on enter
After completion of execution then it will show how many record
are updated successfully if there is any error records then it will
displayed all error records in a log
If we want to see the error records then select the session and
click on ANALYSIS button.
297
'X'.
bdc_field
USING 'RF02K-D0120'
'X'.
bdc_field
USING 'RF02K-D0130'
'X'.
bdc_field
USING 'RF02K-D0210'
'X'.
bdc_field
USING 'RF02K-D0310'
'X'.
bdc_field
USING 'WRF02K-D0320'
'X'.
bdc_dynpro
USING 'SAPMF02K' '0110'.
bdc_field
USING 'BDC_CURSOR'
'LFA1-ANRED'.
bdc_field
USING 'BDC_OKCODE'
'/00'.
bdc_field
USING 'LFA1-ANRED'
wa_final-anred.
bdc_field
USING 'LFA1-NAME1'
wa_final-name1.
bdc_field
USING 'LFA1-SORTL'
wa_final-sortl.
bdc_field
USING 'LFA1-STRAS'
wa_final-stras.
bdc_field
USING 'LFA1-PFACH'
wa_final-pfach.
bdc_field
USING 'LFA1-ORT01'
wa_final-ort01.
bdc_field
USING 'LFA1-PSTLZ'
wa_final-pstlz.
bdc_field
USING 'LFA1-PSTL2'
wa_final-pstl2.
bdc_field
USING 'LFA1-LAND1'
wa_final-land1.
bdc_field
USING 'LFA1-SPRAS'
wa_final-spras.
bdc_dynpro
USING 'SAPMF02K' '0120'.
bdc_field
USING 'BDC_CURSOR'
'LFA1-KUNNR'.
300
Session method
1.It can process any number of
transactions at a time
2.It generates lock that can
handle the errors
LSMW
Legacy System Migration Workbench
Tcode: Lsmw
Step-by-Step Guide for using LSMW to Update Customer Master
Records
LSMW to Update Customer Master Records with
Transaction Recording
Call Legacy System Migration Workbench by entering transaction
code LSMW. Every conversion task is grouped together as Project /
Subproject / Object structure. Create a Project called
LSMW_DEMO and a Subproject as CUSTOMERS and Object as
CUST_REC as shown in Figure 1.
304
305
306
Field Names
Default Values
307
308
309
310
311
312
313
314
316
317
318
319
320
321
1. Personalisation :
Transaction variants are created to personalize any standard SAP
transaction. A transaction variant simplifies the usage of a
transaction by tailoring some of the features as per the business
need. It can be used to hide fields, menu functions, screens, to
322
323
324
325
326
327
328
329
2. In the next pop-up screen enter the short text, select the radio
button variant transaction and click enter.
330
331
332
2.Enhancement,Modification
Enhancements are the means by which we add our own/ modify
existing functionality to SAP's standard business applications.
If you try to modify any SAP standard program, it will ask you for
access key which you can get from SAP market place by
requesting SAP.
But enhancements normally dont require any special access key
and can be implemented directly
EXITS:
Adding the new functionality to the existing object
They are two types of exits are there
333
334
335
Go to menu bar
Go to -> attributes
336
Then one window will be trigger where we can see the package
name
What are the ways we can find out the user exit:
337
338
click on Ctrl+F
Then one window will be trigger where we can enter the package
name
Click on execute
Where we can see the Exit name
339
3. Go to SE84
Select the enhancement and enter the package name
Click on execute
Where we can see the Exit name
340
341
Click on Ctrl + F
Enter the package name
Click on create
Then it will display the list of user exits
Find your exit based on the description
Copy the exit name
And go to SMOD Tcode initial screen
342
343
344
Double click and click on enter on the include name at the same
time
Note: While double click on the include program if the include
program is not implemented then we are getting some warring
message where we need to pass the enter button
Then system will ask do you want to create
Click on yes
Then it will ask the package name
Enter the package name and click on save
Then one window will open like this
345
Where we can develop your code and click on save and activate
And click on back button activate the function module
Click on back button twice then we come to SMOD initial screen
Assigning enhancement to the project:
Go to CMOD Tcode
Enter the project name
Click on create
Enter the short text
346
Note:
When we deactivate the project?
347
TEXT ENHANCEMENT:
FIELD ENHANCMENT:
CHANGING THE FIELD LABEL:
- Change F1 help documentation of any field.
Go to mm01.
Place the cursor on material and press F1.
click on technical information (4th option)
Notice the data element (matnr).
- Goto cmod
- Go to MENU text enhancmenent keywords change
- Provide data element as matnr continue change field
label and save.
- Create request.
- Provide description.
- Continue
- Note-here again data element will come just close
the dialog box and check after 2-3 minutes.
Note:
Dialogue screen uses long text (field label).
TEXT ENHANCMENET
Go to mm01.
Place the cursor on material and press F1.
Click on technical information (4th option)
348
Enhancement Framework
Adding new functionality to the exiting object without editing
exiting code
Steps to implement the enhancement sport
Go to Tcode
EX: go to VA01
Go to menu bar
System -> status
349
350
Enhancement:
BAdis are defined using BAdi builder.
BAdi builder is closely integrated with ABAP Workbench.
BAdis are used to add custom business functionality to
standard SAP (without changing SAP).
- BAdi supports:
o Program enhancement, menu enhancement, screen
enhancement but it does not support text
enhancement. (text means field enhancement)
o For program, menu and screen enhancement SAP
permission is required.
- T.code: SE18 SAP defined BAdi list (to define BAdi)
353
354
C2
Interface: IF
Method if~M1
-----<st>------Endmethod
Method if~m2
------<st>----Endmethod
Method if~M1
-----<st>------Endmethod
Method if~m2
------<st>----Endmethod
356
KERNAL-BASED BAdi
It is new BAdi valid from ecc5.0
onward.
It is a part of enhancement framewo
but enhancement spot is
required/mandatory.
it does not create add-in class
362
US SERVER
NOTES:
- Internal system within one desktop/laptop.
- External system two different systems.
- Gateway servers provide connection between two external
servers.
R.F.C:
- In general RFC can be configured by BASIS consultant.
- RFC destination name can be alpha numeric and upper case.
- connection type:
2- connecting to r/2 system
3- connecting to r/3 system
- We have to specify IP address (or) host name, system
number
- Gateway server and host details required if we are
connecting to external server.
o Gateway server is responsible to connect external
server).
- We have to specify partner system client.
o Username, password, language, detailsetc.
- Save RFC connection:
o Connection test tab is used to check the connection.
o While checking connection system may lead to two
types of errors.
Communication failure: if IP address, system
number is wrong.
System failure: if client number, username details
are
- SAP system uses R.F.C, TCP/IP, CPI-C protocols, while
exchanging data.
364
Now go to 800.
Se38
Provide title
Executable save as local object.
Data: it_kna1 type table of kna1.
Wa_kna1 type kna1.
*---calling remote enabled function
module--Call function zrefmodule destination
RFCALL810. (destination will disp
810 clients information)
*----display output
Loop at it_kna1 into wa_kna1.
Write:/ wa_kna1-kunnr,
Endloop.
Note:
In RFC if you dont mention destination, then output will be of
800s client and if you mention destination with 810 clients name
then 810 clients information will be displayed.
Non-SAP to SAP data migration BDC or LSMW or BAPI (cut and
paste)
SAP to SAP data transfer copy and paste ALE, EDI, BAPI,
workflow, RFC (connection) IDOC.
RFC is maintained by Basis people.
SCC4 to check all the servers in our own system.
Call function <> destination <rfc destination name>
Bapi_companycode_getlist it gives list of company codes 165
company codes are available
367
01 TO 05 are version.
IDoc = message type +
version
370
T.Codes:
IDoc List
IDoc List
IDoc Port Creation
IDoc partner Profile Creation
IDoc Segment creation & segment release
IDoc Creation
Logical message type creation
Assign Logical message to IDoc
IDoc Status Codes
IDoc Documentation
IDoc Types:
o Basic IDoc: it is built from the scratch. (it does not exist)
o Extended IDoc: It is extension to Basic IDoc. (adding
addional segments/fields to exising IDoc)
NOTE:
All the segments must be released before releasing the IDoc.
Once the IDoc is released then modifications are not allowed.
IDoc type is message type.
Sending system
Outbound system
Same Syntax and
semantics
Receiving system
Inbound system
Same syntax and semantics
378
EDI
It is used to exchange data betwee
two business partners.
383
vers
ion cha >
gne
filte
r
con
vers
ion
Post
ng
mod
ule
prog
am
810
2 - Go to t.code SALE
-Define logical system (LS810)
-Assign logical system to client (LS8
>810)
-Create RFC destination (LS800)
4 - WE21 define port
6 - WE20 partner profile creation
8 - BD64 distribution model
- Model view creation
- Add message type to M.view
- Generate partner profile
12 - BD11 get material master dat
BD13 get customer master d
BD15 get vendor master dat
BD17 get cost center master
data
13-WE05 check IDoc status and
collect IDoc
number
14-WE19 enter IDoc number and
execute posting module program
15-Check the target system data t.c
level and table level.
387
393
STRUCTURES:
SAP defined Bapi structures are available in ABAP dictionary.
All BAPI structure names begin with BAPI.
BAPI structures are used while creating BAPI FM.
BAPI structures are used while Data migration (non-SAP to
SAP).
- Go to SE11 data type bapi* - F4 search for structures
delete number of hits.
- There are two special BAPI structures:
o BAPIRETURN it provides return status of any
operation.
o BAPIRET2 it provides in detail status of any BAPI
operation.
- Go to SE11 - bapireturn
397