Professional Documents
Culture Documents
SAP-Adv ABAP-2
SAP-Adv ABAP-2
Ashok
SAP-ADV ABAP 3
INDEX
1 BDC 5
2 Data Transfer Techniques (Inbound & Outbound) 5
3 Steps in BDC Data Transfer Technique 6
4 Methods in BDC (Session, Call Transaction, LSMW & Direct Input methods) 7
5 1. Session Method 8
6 Upload bank data from Notepad using session method 10
7 Uploading data from XL Sheet using Session Method 15
8 2. Call Transaction Method 21
9 Upload pricing data using Call Transaction Method 23
10 3. LSMW 29
11 SKIP Functionality 35
12 . Upload material master data with MM01 using flat file with headings & logo 35
13 BDC with Table Control 36
14 Upload vendor master data using XK01 using Table Control 37
15 File Handling 38
16 Opening a File in Application Server in Output Mode (Write Mode) 38
17 Opening a File in Input Mode (Read Mode) 40
18 Upload asset master data with AS02 using Call Transaction Method 43
(Assignment)
19 Upload employee payroll for info type 14 with PA30 using Call Transaction 44
Method (Assignment)
20 SAP Scripts 45
21 Flow of Creating Form (Steps) 47
22 Goods receipt form using Scripts 48
23 Function Modules for Print Program 56
24 PO Form using Scripts(Assignment) 57
25 Standard Forms 58
26 Smart Forms 61
27 Steps in Working of Smart Forms 63
28 PO Form using Smart Forms 64
29 SAP Enhancements (User exits, Customer exits, BADI, Enhancement Frame 81
Work & BTE)
30 1. User exits 81
31 Validate sales order application using User exits 81
32 2. Customer exits (Function Exits, Menu Exits, Screen Exits & Field Exits) 83
33 a) Function Exits 83
34 Validate vendor master application for postal code 83
35 b) Menu Exits 86
36 c) Screen Exits 88
37 d) Fieldexits 92
Ashok
SAP-ADV ABAP 4
Ashok
SAP-ADV ABAP 6
BDC:
Batch Data Communication
BDC is a data transfer technique from one system to another system
In all above examples manually clients have to process application data & there is no
guaranty that data is 100% consistent
SAP is providing a technique called BDC for data transfer
Outbound:
SAP
SAP
(source system) Non-SAP
Inbound:
SAP
SAP (target system)
Non-SAP
Note:
BDC is an Inbound data transfer technique
Ashok
SAP-ADV ABAP 7
Step-2:
Functional Consultant will analyses Flat File & there only he will converts Non-SAP data
into SAP format
Functional Consultant will prepare Functional Document & provide it to Technical
Consultant
Step-3:
Technical Consultant will write an interface program (BDC program) in SAP system & he will
upload the data from Flat File to Internal table (created based on Flat File)
Step-4:
In real time some data might be in SAP format (or) Non-SAP format
All Non-SAP format data is converted into SAP format using validations in application
Step-5:
Before validation we have to perform mapping logic
**For that we have to create mapping logic internal table based on BDC Data Structure
Step-6:
From mapping logic internal table (it_bdcdata) data will goes to respective application
where LUW is performed
With LUW data is finally transferred to database tables
Note:
BDC is a part of conversion technique
Flat File:
In real time Flat File (mainly XL Sheet) is provided by end user
Ashok
SAP-ADV ABAP 8
Mapping Logic:
BDC Data (structure)
Methods in BDC:
1. ** Session method
2. ** Call Transaction method
3. LSMW (this job is done by Functional Consultant)
4. Direct Input method (it is out dated)
Ashok
SAP-ADV ABAP 9
Session Method:
Features:
1. Use session method for uploading large amount of data (more than 10000 records)
2. Data can be processed in Foreground as well as Background
3. *** In BDC in session method error records are captured using Log File
4. In session method respective Log File is already given by SAP
5. *** Multiple applications can be processed at one time
6. Asynchronous processing
7. Synchronous updating
8. It is a slower method but consistent
BDC_OPEN_GROUP:
It will open a session in SM35
BDC_INSERT:
It transfers mapped data from mapping logic internal table to session
BDC_CLOSE_GROUP:
It closes a session which is already opened.
Flow of Data in Session Method:
Flat File
(using function module)
It_data
(using LOOP………ENDLOOP)
Wa_data
(using APPEND keyword)
It_bdcdata
(using BDC_INSERT function module)
Session
Screens
LUW
Database Tables
Processing:
Ashok
SAP-ADV ABAP 10
Transferring the data from Flat File (Presentation Server) ultimately to Session
(Application Server) is called processing
In session method processing is asynchronous (all records from Flat File are ultimately
broad to session)
Updating:
Transferring the data from Application Server to Database Server is called updating
In session method updating is synchronous
In session method if a record is correctly committed to database then only next record is
updated (next transaction can be processed only when the previous record is correctly
written to the database)
** Recording:
Using recording you can map Program name, Screen number, Field names………….etc
You can map Screen Sequences
You can map FCT values for different function codes (BACK, SAVE, ENTER………etc)
Note:
T Code for recording is SHDB
Ashok
SAP-ADV ABAP 11
Requirement:
Upload bank data from Notepad using session method
Solution:
Step-1:
Go to SHDB
New Recording
Recording: ZBANK_RECO
Transaction Code: FI01
Start Recording
Bank Country: IN
Bank Key: SR Nagar
Enter
Bank Name: state bank on Hyderabad
Street: SR nagar
City: Hyderabad
Bank Branch: SR nagar branch
Save
Save
Back
Note:
In real time, Functional Consultants perform recording. As a Technical Consultant based on
recording we have to create a program
Step-2:
Go to SHDB
Select your recording name (ZBANK_RECO)
Program
Program Name: ZFI_BANK_UPLOAD
Transaction For Recording
Enter
Title: BDC for FI01
Type: Executable Program
Source Code
Local Object
You will find a program
Remove starting 3 lines
i.e. INCLUDE BDCRECXL
START-OF-SELECTION
……………………….
Ashok
SAP-ADV ABAP 12
Step-3:
Write your program from begging of given program
* mapping objects
DATA: wa_bdcdata TYPE BDCDATA,
it_bdcdata TYPE TABLE OF BDCDATA.
* F4 functionality
AT SELECTION-SCREEN ON VALUE_REQUEST FOR p_file.
PERFORM open_file.
START-OF-SELECTION.
PERFORM upload.
PERFORM open_session.
PERFORM process_data.
PERFORM close_session.
Ashok
SAP-ADV ABAP 13
FORM open_file.
ENDFORM.
FORM upload.
fnam = p_file.
ENDFORM.
FORM open_session.
FORM process_data.
LOOP AT it_fi01 INTO wa_fi01.
REFRESH it_bdcdata.
wa_fi01-banka.
wa_fi01-stras.
wa_fi01-ort01.
wa_fi01-brnch.
ENDLOOP.
ENDFORM.
FORM close_session.
CALL FUNCTION ‘BDC_CLOSE_GROUP’.
ENDFORM.
* screen mapping
FORM BDC_DYNPRO USING PROG SCREEN.
CLEAR wa_bdcdata.
wa_bdcdata-program = prog.
wa_bdcdata-dynpro = screen.
wa_bdcdata-dynbegin = ‘X’.
ENDFORM.
* field mapping
FORM BDC_FIELD USING FIELD VALUE.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = field.
wa_bdcdata-fval = value.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.
Ashok
SAP-ADV ABAP 15
Step-4:
Create a Flat File with Note pad
IN SBI009 STATEBANKOFINDIA LBNAGAR HYDERABAD
IN SBH008 STATEBANKOFHYD AMEERPET HYDERABAD
Step-5:
Go to SE38
Execute
Apply F4
Select your Flat File
Open
Execute
Go to SM35
Select your Session name
Process
Background
Process
07-11-2014
Question-1:
Assume my Session has been processed & after processing, I want my Session to be displayed
in SM35 for status check. How you can achieve this task?
Answer:
By providing exporting parameter KEEP = ‘X’ you can get your processed session back in
SM35
Question-2:
How you can maintain Logs (or) Error records in Session method?
Answer:
In Session method SAP is providing a Log file by default
No need to create a Log file for handling error records
You can find Log file by using SM35
Go to SM35
Select your session
Select Log option (F7)
Select your session
Select Display button
Ashok
SAP-ADV ABAP 16
Requirement:
Upload bank data from XL Sheet using session method
Solution:
Step-1:
Go to SHDB
New Recording
Recording: ZBANK_RECO
Transaction Code: FI01
Start Recording
Bank Country: IN
Bank Key: SR Nagar
Enter
Bank Name: state bank on Hyderabad
Street: SR nagar
City: Hyderabad
Bank Branch: SR nagar branch
Save
Save
Back
Note:
In real time, Functional Consultants perform recording. As a Technical Consultant based on
recording we have to create a program
Step-2:
Go to SHDB
Select your recording name (ZBANK_RECO)
Program
Program Name: ZFI_BANK_UPLOAD
Transaction For Recording
Enter
Title: BDC for FI01
Type: Executable Program
Source Code
Local Object
You will find a program
Remove starting 3 lines
Ashok
SAP-ADV ABAP 17
Step-3:
Write your program from begging of given program
** TYPE-POOLS TRUXS.
* mapping objects
DATA: wa_bdcdata TYPE BDCDATA,
it_bdcdata TYPE BDCDATA.
* F4 functionality
AT SELECTION-SCREEN ON VALUE_REQUEST FOR p_file.
PERFORM open_file.
START-OF-SELECTION.
PERFORM upload.
Ashok
SAP-ADV ABAP 18
PERFORM open_session.
PERFORM process_data.
PERFORM close_session.
FORM open_file.
ENDFORM.
FORM upload.
ENDFORM.
FORM open_session.
ENDFORM.
** FORM process_data.
LOOP AT it_fi01 INTO wa_fi01.
REFRESH it_bdcdata.
Ashok
SAP-ADV ABAP 19
ENDLOOP.
ENDFORM.
FORM close_session.
CALL FUNCTION ‘BDC_CLOSE_GROUP’.
ENDFORM.
* screen mapping
FORM BDC_DYNPRO USING PROG SCREEN.
CLEAR wa_bdcdata.
wa_bdcdata-program = prog.
wa_bdcdata-dynpro = screen.
wa_bdcdata-dynbegin = ‘X’.
ENDFORM.
* field mapping
FORM BDC_FIELD USING FIELD VALUE.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = field.
Ashok
SAP-ADV ABAP 20
wa_bdcdata-fval = value.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.
Step-4:
Create a Flat File MS-XL
IN SBI009 STATEBANKOFINDIA LBNAGAR HYDERABAD
IN SBH008 STATEBANKOFHYD AMEERPET HYDERABAD
Step-5:
Go to SE38
Execute
Apply F4
Select your Flat File
Open
Execute
Go to SM35
Select your Session name
Process
Background
Process
Question-1:
How you can perform background processing in Session method?
Answer:
Using program RSBDCSUB you can execute session in background
Example:
In above program modify subroutine PERFORM close_session.
FORM close_session.
ENDFORM.
Execute
F4
Select your Flat File
Ashok
SAP-ADV ABAP 21
Execute
You will find a selection screen
Session: RGS
Execute
Question-2:
Suppose I’m having a Flat File with 50000 records. It happened that the system crashed while
uploading data. How I know the number of records exactly uploaded?
Answer:
I will go to respective database table & copy the key values to the table & execute it
Question-3:
Assume there are 1000 records out of which I uploaded 500 records & remaining I want to
upload next day. How you will, you perform this job.
Answer:
I will check the status of the records uploaded & I will delete the records from Flat File which
are correctly uploaded & remaining I will execute once again on next day
Question-4:
I’m having 2 Flat Files with 500 records & 50000 records. Which method will you prefer for
both Flat Files?
Answer:
For 500 records Call Transaction Method
For 50000 records Session Method
Ashok
SAP-ADV ABAP 22
Note:
In Call Transaction Method session function modules are not required
Ashok
SAP-ADV ABAP 23
Update Parameter:
Using this parameter, you can switch the control from asynchronous to synchronous
Message Parameter:
It is for error handling in Call Transaction Method
LUW
Database Tables
Ashok
SAP-ADV ABAP 24
Requirement:
Upload pricing data using Call Transaction Method
Every company will increases the prices of their finished products using VK11 application
Solution:
Step-1:
Go to SHDB
New Recording
Recording: ZVK11_RECO
Transaction Code: VK11
Start Recording
Condition Type: ZZ01
Enter
Sales Organization: 1000
Distribution Channel: 10
Material: 100-100
Amount: 500
Unit: INR
Valid From: 01.07.2014
Valid To: 31.12.2014
Save
Save
Back
Step-2:
Go to SHDB
Select your recording name (ZVK11_RECO)
Program
Program Name: ZMM_VK11_UPLOAD
Transaction For Recording
Enter
Title: BDC for VK11
Type: Executable Program
Source Code
Local Object
You will find a program
Remove starting 3 lines
i.e. INCLUDE BDCRECXL
START-OF-SELECTION
……………………….
Ashok
SAP-ADV ABAP 25
Step-3:
Write your program from begging of given program
** TYPE-POOLS TRUXS.
* mapping objects
DATA: wa_bdcdata TYPE BDCDATA,
it_bdcdata TYPE BDCDATA.
* F4 functionality
AT SELECTION-SCREEN ON VALUE_REQUEST FOR p_file.
PERFORM open_file.
START-OF-SELECTION.
PERFORM upload.
PERFORM process_data.
PERFORM fill_cat.
PERFORM display_data.
Ashok
SAP-ADV ABAP 26
FORM open_file.
ENDFORM.
FORM upload.
ENDFORM.
** FORM process_data.
LOOP AT it_fi01 INTO wa_fi01.
REFRESH it_bdcdata.
Ashok
SAP-ADV ABAP 27
ENDLOOP.
ENDFORM.
* screen mapping
FORM BDC_DYNPRO USING PROG SCREEN.
CLEAR wa_bdcdata.
wa_bdcdata-program = prog.
wa_bdcdata-dynpro = screen.
wa_bdcdata-dynbegin = ‘X’.
ENDFORM.
* field mapping
FORM BDC_FIELD USING FIELD VALUE.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = field.
wa_bdcdata-fval = value.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.
Step-4:
Create a Flat File MS-XL
IN SBI009 STATEBANKOFINDIA LBNAGAR HYDERABAD
IN SBH008 STATEBANKOFHYD AMEERPET HYDERABAD
Step-5:
Go to SE38
Execute
Apply F4
Select your Flat File
Open
Execute
Go to SM35
Select your Session name
Ashok
SAP-ADV ABAP 28
Process
Background
Process
Ashok
SAP-ADV ABAP 29
08-11-2014
Question:
What is the difference between Session Method & Call Transaction Method?
Answer:
Session Method Call Transaciton Method
1. It for uploading large amount of data 1. It for uploading small amount of data
2. Multiple applications can be processed 2. Only single application can be processed
at one time with one BDC program at one time with one BDC program
3. In this method respective Log File is 3. In this method we have to create Log file
already given by SAP explicitly using structure BDCMSGCOLL
4. Asynchronous processing 4. Synchronous processing
5. Synchronous updating 5. Asynchronous updating
6. It is a slower method but consistent 6. Faster than Session method
Question:
How will you handle error records BDC?
Answer:
In real time client will ask error records during BDC upload
For that we have to provide him Logs in the form of error file
In Session Method Log file you can find directly in SM35
In Call Transaction Method as processing synchronous we have to create a Log file
internal table based on structure BDCMSGCOLL which holds log details during
processing of application
The error records are looped to respective work area which further exported to Funtion
Module FORMAT_MESSAGE
It returns a Message ID which I will capture by using a dummy internal table
Ashok
SAP-ADV ABAP 30
LSMW:
Legacy System Migration Work bench
It is convenient tool for migrating Non-SAP (or) Legacy data from one system to another
system
Method in LSMW:
1. Batch Input Recording (Session Method)
2. IDOC Method
3. BAPI Method
4. Direct Input Method
Note:
The T code for working with LSMW is LSMW
In real time LSMW is mostly performed by Functional Consultant
Example:
Go to LSMW
Project: ZFI_LSMW
Sub Project: ZFI_SUBPRO
Project: ZFI_SESSION
Create Entry
Description: LWMW Project
Enter
Description: Sub Project
Enter
Name: Session name
F8
If Numbering Off is selected get it into Numbering On
If Double Click = Display get it into Double Click = Change
Ashok
SAP-ADV ABAP 31
****
Step-1: Maintain object attributes
With this step you can maintain attributes for your method
i.e. Method name, Recording details……………etc
Select F8
Option
Recording Overview
Create Recording (Ctrl + F1)
Recording: FILSMW
Description: Recording
Enter
Transaction Code: FI01
Enter
Bank Country: IN
Bank Key: B0001
Enter
Bank Name: SBH
Street: LBNagar
City: Hyderabad
Bank Branch: LBNagarBranch
Save
Double click on BNKA-BANKS
Name: BANKS
Name: Bank Country
Default Value: ____________
Enter
Double click on BNKA-BANKL
Name: BANKL
Name: Bank Key
Default Value: ____________
Enter
Repeat the same procedure with BNKA-STRAS, BNKA-ORT01, BNKA-BRNCH
Save
Back
Back
Batch Input Recording
Recording: FILSMW
Enter
Save
Back
Ashok
SAP-ADV ABAP 32
Save
Back
Save
Back
Note:
This step is not required ignore it
Select Step-7
F8
Double click Legacy Data On The PC (Frontend)
Apply F4 on File
Select your flat file from required path
Name: Flat file
Delimitor
Tablator
Note:
If headings are maintained in Flat file it is mandatory to select check Fields Names At Start Of
File
Enter
Save
Note:
Sometimes you may find an error ‘Field names at start of File………….up to 45
charectors…..remaing data saved’. If you get this error
Doublce click on Convert Data
File: your flat file path
Save
Back
Ashok
SAP-ADV ABAP 34
Process
Enter
Enter
Enter
Ashok
SAP-ADV ABAP 36
09-11-2014
SKIP Functionality:
Requirement:
Upload material master data with MM01 using flat file with headings & logo
Flat File:
A-922 M ROH Sodaash Kg R1111 1000 Kg 800
A-923 M ROH Sodaash Kg R1111 1000 Kg 800
Solution:
ZMM_MM01_BDC1
Ashok
SAP-ADV ABAP 37
Flat File:
9444 1000 1000 0001 MR Satya Google
LBNagar Hyderabad IN, IN, IN, IN, IN, IN SBI001,SBH001, ICICI001,
HDFC001, CANARA001, AXIS001 30941209294, 30941209295, 30941209296,
30941209297, 30941209298, 30941209299 31000 A1 INR
Solution:
Go to SHDB
New Recording
Transaction Code: XK01
Start Recording
Vendor: 8733
Company Code: 1000
Purchase Org: 1000
Account Group: 0001
Title: MR
Name: Satya
Search Term: Google
Postal Code: 500074
City: Hyderabad
Country: IN
Enter
No data in this screen
Enter
Country: IN
Bank Key: SBH001
Bank Account: 30941209294
Enter
Enter
Recoun. Amount: 31000
Cash Mng Group: A1
Enter
No data in this screen
Enter
No data in this screen
Enter
Order Currency: INR
Enter
Ashok
SAP-ADV ABAP 38
Save
Save
Back
Select your recording
Program
Program Name: ZVENDOR_UPLOAD
Transfer For Recording
Enter
Title: BDC for recording
Type: Executable Program
Source Code
Remove starting 3 lines
Remove last 3 lines
Write your program
ZXK01_UPLOAD
Ashok
SAP-ADV ABAP 39
File Handling:
If flat file is maintaining in presentation server then any-body can manipulated it
Even flat files can be maintained in application server also where data is more secure as it
is managed by administrator
If the flat file is maintained in presentation server then it is a part of Physical File
Handling
If the flat file is maintained in application server then it is a part of Logical File Handling
Example:
Go to SE38
Program: ZSD_OPEN_DATASET
Create
Title: Opening dataset
Type: Executable Program
Enter
Local Object
INCLUDE ZCUSTOM.
Ashok
SAP-ADV ABAP 40
Local Object
Activate
Back
Activate
Execute
P_file: D:\opendataset.txt
Execute
Ashok
SAP-ADV ABAP 41
Example:
Go to SE38
Program: ZSD_CUSTOMER
Create
Title: BDC for customer master data
Type: Module Pool
Save
Local Object
Go to SE51
Program: ZSD_CUSTOMER
Screen: 100
Create
F6
Table: KNA1
Enter
Select required fields (kunnr, land1, name1, ort01, pstlz, stras)
Enter
Place the fields on the screen
Place two buttons (INSERT, EXIT) on the screen
Provide Text & FCT code of buttons
Flow Logic
Remove comment for MODULE USER_COMMAND_100
Double click on USER_COMMAND_100
Yes
Main Program
Enter
TABLES KNA1.
CASE SY-UCOMM.
WHEN ‘INSERT’.
INSERT KNA1.
Ashok
SAP-ADV ABAP 42
IF SY-SUBRC EQ 0.
MESSAGE ‘Record inserted’ TYPE ‘I’.
ELSE.
MESSAGE ‘Inserting failed’ TYPE ‘E’.
ENDIF.
WHEN ‘EXIT’.
LEAVE TO SCREEN 0.
ENDCASE.
Activate
Back
Activate
Go to SE93
Transaction Code: ZCUST
Screen: 100
Save
Go to SE38
Program: ZSD_CUSTOMER_BDC
Create
Title: BDC for customer data
Type: Executable Program
Enter
Enter
INCLUDE ZCUSTOM.
ENDIF.
ENDDO.
Execute
P_file: D:\opendataset.txt
Ashok
SAP-ADV ABAP 44
Assignment-1:
Upload asset master data with AS02 using Call Transaction Method
Flat File:
Asset number Sub asset number Company code Qunatity
3000006 0 0005 300
Recording:
Go to SHDB
New Recording
Recording: ZREC_AS02
Transaction Code: AS02
Start Recording
Asset: 3000003
Sub Number: 0
Company Code: 0005
Enter
Quantity: 200
Save
Back
Save
Solution:
Go to SHDB
Select your recording
Program
Title: BDC for AS02
Type: Executable Program
Source Code
Remove first 3 lines
Remove last 2 lines & write your program
Ashok
SAP-ADV ABAP 45
Assignment-2:
Upload employee payroll for infotype 14 with PA30 using Call Transaction Method
Flat File:
Employee number Amount
1000 3000
1001 5000
1002 7000
Recording:
Go to SHDB
New Recording
Recording: ZREC_PA30
Transaction Code: Pa30
Start Recording
Employee number: 1000
Infotype: 14
Sty: M110
F6
Start: 01.04.2013
To: 31.03.2014
Wage Type: M110
Amount: 3000
Save
Back
Save
Solution:
Go to SHDB
Select your recording
Program
Title: BDC for PA30
Type: Executable Program
Source Code
Remove first 3 lines
Remove last 2 lines & write your program
Ashok
SAP-ADV ABAP 46
SAP Scripts:
Using Scripts you can design Forms & send the data for print outs
Components of Scripts:
1. Form
2. Page
3. Window
4. Page Window
5. Layout
6. Paragraph Formats
7. Character Formats
8. Header
Form:
It is a collection of pages
Page:
It is a collection of windows
Window:
It is the smallest element of a form, which holds actual data
Page Window:
Using this option windows are maintained in a page in SAP Scripts
Layout:
All windows are adjusted in a page using layout
Paragraph Formats:
With this option you can maintain Font size, Style, Color, Underline……….etc for text on a
form
Character Formats:
Using this option you can maintain Font size, Style, Color…….etc for text (for special
characters in a form)
Header:
Using header administrative data (client number, date of creation, date of change, user
id……..etch) is maintained
Ashok
SAP-ADV ABAP 47
Main Window:
It is a default window in forms
Use this window for maintaining dynamic length data (transactional data)
In one page you can maintain 99 Main Windows (Main 00 to Main 98)
Note:
Without Main Window you cannot work with Scripts
Constant Window:
It is reflected to all the pages of a form
Note:
Maintain Logos, Headers, Footers……….etc using this window
Variable Window:
It is restricted to a specific page
SAPLD SE38
Ashok
SAP-ADV ABAP 48
Note:
SAPLD provides interface between Form Painter & External Devices
Note:
T code for working with Scripts is SE71
Ashok
SAP-ADV ABAP 49
Requirement:
Goods receipt form
Solution:
Step-1: Form
Go to SE71
Form: ZFORM_GRN
Create
Ashok
SAP-ADV ABAP 50
Step-2:
Select Pages
Page: PAGE1
Next Page: PAGE1
Enter
Meaning: page1
Step-3:
Select Paragraph Formats
Paragraph: P1
Enter
Meaning: p1
Font
Family: COURIER
Font Size: 12
BOLD ON
Step-4:
Select Character Formats
Char. Format: C1
Enter
Meaning: c1
Family: HELVE
Size: 10
BOLD ON
Step-5:
Select Header (F5)
Basic Settings
First Page: PAGE1
Default Paragraph: P1
Step-6:
Select Windows
Edit ------ Create Element
Window: LOGO
Meaning: window
Enter
Window Type: CONST
Ashok
SAP-ADV ABAP 51
Step-7:
Select Page Windows
Edit ----- Create Element
You will find a pop-up, Double click on HEADER
Window Width: 5
Window Height: 5
Edit ----- Create Element
Double click on HEADER1
Window Width: 5
Window Height: 5
Edit ----- Create Element
Repeat the same procedure for USER, PAGE, MAIN, CONST, LOGO windows
Note:
When you maintain MAIN window using Page Windows you will get MAIN window again in
the pop-up (as we can maintain 99 MAIN windows in a Page). So next time you don’t select it
Step-8:
Double click on MAIN window
Edit ----- Text Elements
Goto ----- Change Editor
/E GRAND_TOTAL
* &uline(60)&
* ,,,,,,,,,,<C1>Grand total: &wa_sum&</>
Back
Step-9:
Double click HEADER window
Edit ----- Text Elements
Goto ----- Change Editor
Step-10:
Double click on HEADER1 window
Edit ----- Text Elements
Goto ----- Change Editor
* &uline(60)&
*
* Sno,,,,Material,,,,Material Type,,,,Quantity,,,,Amount
* &uline(60)&
Back
Step-11:
Double click on LOGO window
Edit ----- Text Elements
Goto ----- Change Editor
Step-12:
Double click on PAGE window
Edit ----- Text Elements
Goto ----- Change Editor
/: BOX WIDTH 5 CM HEIGHT 1 LN FRAME 4 TW
Ashok
SAP-ADV ABAP 53
Step-13:
Double click on USER window
Edit ----- Text Elements
Goto ----- Change Editor
Step-14:
Select Settings
Form Painter
By default graphical pc editor selected, Deselect it
Select Graphical Form Painter
Enter
Adjust all the windows according to the size of data
Select Minimize
Settings ------ Form Painter
Deselect Graphical Form Painter check box
Select Graphical PC Editor check box
Select Utilities -------- Printing Text
You will find a pop-up
Output Device: LP01
Print Preview
Form
Activate
Local Object
Step-15:
Go to SE38
Program: ZGRN_FORM
Create
Title: Forms for GRN details
Type: Executable Program
Enter
Local Object
Write driver program
ZGRN_COL_FORM
Ashok
SAP-ADV ABAP 54
PERFORM get_mseg.
PERFORM open_form.
PERFORM start_form.
PERFORM process_form.
PERFORM end_form.
PERFORM close_form.
FORM get_mseg.
SELECT mseg~matnr mseg~bwart mseg~menge mseg~dmbtr INTO TABLE it_mseg
FROM MKPF INNER JOIN MSEG
ON mkpf~mblnr = mseg~mblnr
WHERE mkpf~mblnr IN s_mblnr
AND mseg~werks IN s_werks
AND mseg~bukrs IN s_bukrs
AND mseg~budat IN s_budat.
ENDFORM.
FORM open_form.
CALL FUNCTION ‘OPEN_FORM’.
Ashok
SAP-ADV ABAP 55
EXPORTING
LANGUAGE = SY-LANGU
FORM = ‘ZFORM_GRN’.
ENDFORM.
FORM start_form.
CALL FUNCTION ‘START_FORM’
EXPORTING
STARTPAGE = ‘PAGE1’
LANGUAGE = SY-LANGU
FORM = ‘ZFORM_GRN’.
ENDFORM.
FORM process_form.
LOOP AT it_mseg INTO wa_mseg.
sno = sno + 1.
CALL FUNCTION ‘WRITE_FORM’
EXPORTING
ELEMENT = ‘ELE1’
WINDOW = ‘MAIN’.
IF sno = 8.
CALL FUNCTION ‘WRITE_FORM’
EXPORTING
ELEMENT = ‘PAGE_TOTAL’
WINDOW = ‘MAIN’.
sno = 0.
ENDIF.
AT LAST.
CALL FUNCTION ‘WRITE_FORM’
EXPORTING
ELEMENT = ‘GRAND_TOTAL’
WINDOW = ‘MAIN’.
ENDAT.
ENDLOOP.
Ashok
SAP-ADV ABAP 56
ENDFORM.
FORM end_form.
CALL FUNCTION ‘END_FORM’.
ENDFORM.
FORM close_form.
CALL FUNCTION ‘CLOSE_FORM’.
ENDFORM.
Ashok
SAP-ADV ABAP 57
2. STRAT_FORM:
It opens a form from a specific page (pass Form name & Page name)
3. WRITE_FORM:
It is for calling text elements in SAP Scripts (pass Text element name & Window name)
4. END_FORM:
It is for closing START_FORM
5. CLOSE_FORM:
It is for closing OPEN_FORM
Script Symbols:
1. * ----- default paragraph
2. ----- continous text
3. = ------- extended line
4. / ------- line field (one line gap)
5. /= ------ line field & extended line
6. /: ------ command line (it is for script commands i.e. BOX, BITMAP)
7. /* ------ comment line
8. /E ------ text element
9. TW ---- twip
1 TW = 1/20 PT (points)
1 PT = 1/72 inches
Go to SE38
Program: ZGRN_COL_FORM
Debugging
Ashok
SAP-ADV ABAP 58
Assignment:
PO Form
Logic:
* Item number &space(5)&Item description &space(30)& Unit of measurement &space(5)&
PO Quantity &space(5)& Unit price &space(5)& Total price &space(5)&
/ BOX FORM 4 TW
/ BOX HIEGHT 2 LN FRAME 4 TW INTENSIVILY 8
/ BOX WIDTH ‘15’ CH HIEGHT ‘15’ LN FRAME 4 TW
/ BOX WIDTH ‘30’ CH HIEGHT ‘15’ LN FRAME 4 TW
Solution:
ZGRN_FORM
Ashok
SAP-ADV ABAP 59
10-11-2014
Standard Forms:
SAP is providing standard forms which are stored in a table TNAPR
In these standard forms we have to make our own modifications based on requirement &
customize the same in NACE T-code
Example:
Step-1: coping a standard form into user defined form
Go to SE71
Utilities ----- Copy From Client
Form Name: MEDRUCK
Source Client: 800
Target Form: ZPO_MEDO
Execute
Package: YABAP
Enter
Create Request
Go to SE78
Expand Graphics-General Graphics
Double click on BMAP-Bit Map Images
Graphics ---- Input
Apply F4 on File Name
Select your logo
Name: SCRIPTLOGO
Description: script logo
Color Bit Map Image
Enter
Graphic
Transport
Enter
Go to SE71
Form: ZPO_MEDD
Change
Page Windows
Try to find HEADER window by selecting Next Page option
Ashok
SAP-ADV ABAP 60
Back
Form ----- Activate
Go to NACE
Application EF
Output Types
Position
Output Type: NEU
Enter
Select NEU
On left side double click on processing Routines
Ashok
SAP-ADV ABAP 61
Display / Change
Form: ZPO_MEDD
Save
Enter
Go to SE10
Display
Expand Main request number
Select sub request number
Select Truck symbol Relase
Select main request number
Select Truck symbol Relase
Go to SE38
Program: RSTXR3TR
Execute
Transport Request: LID0001
Export
File Name: ‘ZPO_MEDD’
Execute
**Smart Forms:
It is a smartest way of working with forms
Form:
It is a collection of Pages
Style:
It is for Paragraph Formats & Character Formats
Text Module:
Maintains conditional data
Types of Windows:
1. Main Window
2. Secondary Window
3. Final Window
4. Copies Window
Main Window:
Ashok
SAP-ADV ABAP 63
Secondary Window:
Use this for holding fixed length data (master data)
Final Window:
Use this for holding final data (totals, grand totals)
Copies Window:
Use this for copy (or) original format data
**Components of Window:
1. Text (maintains logic)
2. Template (static tables can be created)
3. Folder (holds different components together)
4. Address (maintains address)
5. ** Program Lines (create program)
6. Command (maintains page breaks)
7. Alternate (flip flop logic (if condition))
8. Loop (maintains loops)
9. Table Line (different cells logic)
10.Table (holds data dynamically)
11.Graphic (maintains logo)
Ashok
SAP-ADV ABAP 64
Note:
T code for working with Smart Forms is SMARTFORMS
Ashok
SAP-ADV ABAP 65
Requirement:
PO Form
Solution:
Step-0: creating structure
Go to SE11
Data Type: ZPO_STRUC
Create
Structure
Enter
Short Description: structure for PO details
Component Compenent type
EBELP EBELP
MAKTX MAKTX
MENGE MENGE
NETPR NETPR
NETWR NETWR
Currency / Quantity
Ashok
SAP-ADV ABAP 66
P1 -Paragraph Format:
Right click on Paragraph Formats
Create Node
Paragraph Formats: P1
Enter
Description: p1
Font
Font Family: COURIER
Font Size: 12
Font Style: BOLD
P2 -Paragraph Format:
Right click on Paragraph Formats
Create Node
Paragraph Formats: P2
Enter
Description: p2
Indents and Spacing
Alignment: CENTER
Font
Font Family: HELVE
Font Size: 15
Font Style: BOLD
Alignment: CENTER
Font
Font Family: HELVE
Font Size: 12
Font Style: BOLD
Import parameters:
Double click on Form Interface
By default Import tab is selected, provide
Parameter name Type assignment Associated type
EBELN TYPE EBELN
BEDAT TYPE BEDAT
LIFNR TYPE LIFNR
Table parameters:
Tables
Parameter name Type assignment Associated type
IT_EKPO LIKE ZPO_STRUC
Ashok
SAP-ADV ABAP 68
Types
Global Data
Variable name Type assignment Associated type
WA_LFA1 TYPE TY_LFA1
WA_ADRC TYPE TY_ADRC
Form Routines
Currency / Quantity Fields
Field name Reference table Data type
Wa_ekpo-menge wa_ekpo-menge quan
Wa_ekpo-netpr wa_ekpo-netpr curr
Wa_ekpo-netwr wa_ekpo-netwr curr
Ashok
SAP-ADV ABAP 69
You will find a pop-up Color Bit Map Image check box & Deselect Block and White
Image check box
Execute
Select any one Logo based on your requirement
Note:
1. In real time logo is provided by client
2. While creating logo you can adjust the size of the logo using Resolution option
3. Double click on PAGE1 on maintaince screen you will find Background Picture option
with this you can maintain background pictures in Smart Forms
4. Select Output Options tab under that you will find Print Mode. If Print Mode is D you
can provide double side printing
5. By default Page Format is Potrate Format which is for form with less fields. If form
contains more fields (say 15, 20,…….etc) use Landscape Format
PO window:
Right click on LOGO window
Create ------- Window
Window: PO
Meaning: template for po
Enter
Right click on PO window
Create ------ Template
To increase the Width & Height of a template, double click on PO window
On maintaince screen select Output Options tab
Width: 10
Height: 10
Note:
Only upto 25 only we can provide for Height & Width
Enter
Double click on Template 1
Select Template tab
Increase the width of a template based on your requirement
Right click on C1
Split ------ Line
Right click on C1
Split ------ Cell
Right click on C2
Split ------ Cell
Under Template tab, select Pattern option (1st button)
Ashok
SAP-ADV ABAP 70
By default all the patterns are deselected, select Display Framed Patterns option
Double click on 2nd pattern
Right click on Template 1
Create ----- Folder 1
Right click on Folder 1
Create ------ Text
Right click on Text 1
Create ------ Text
Similarly create 3 more texts (Text2, Text3, Text4)
Double click on Text1
On maintaince screen, select Output Options tab
Scroll down to bottom
Line: 1
Coloumn: 1
Double click on Text2
On maintaince screen, select Output Options tab
Scroll down to bottom
Line: 1
Coloumn: 2
Double click on Text3
On maintaince screen, select Output Options tab
Scroll down to bottom
Line: 2
Coloumn: 1
Double click on Text4
On maintaince screen, select Output Options tab
Scroll down to bottom
Line: 2
Coloumn: 2
Double click on Text1
Select Conditions
Output Options
Web Properties
General Attributes
Select Edit option
PO Number
(or)
Goto ----- Change Editor
* PO Number
Back
PAGE window:
Right click on PO window
Create ------ Window
Window: PAGE
Meaning: page number
Enter
Right click on PAGE window
Create ---- Text
At bottom expand System Fields
Drag & drop PAGE on Editor (&SFSYT-PAGE&)
Note:
SFSY-is a standard structure for Smart Forms sytem fields
HEADER window:
Right click on PAGE window
Create ----- Window
Window: HEADER
Meaning: widow for header text
Enter
Right click on HEADER window
Create ----- Text
Double click on Text5
Select Editor option
Goto ------ Change Editor
Ashok
SAP-ADV ABAP 72
P2 REDDY LABS
P2 <C1>,,,,,,An Anji Reddy group </>
P2 <C1>,,,,,, Ameerpet-10 </>
Back
VENDOR window:
Right click on HEADER window
Create ------ Window
Window: VENDOR
Meaning: window for vendor details
Enter
Right click on VENDOR window
Create ----Flow Logic -----Program Lines
Input parameters Output parameters
LIFNR WA_LFA1
WA_ADRC
SELECT SINGLE name1 FROM LFA1 INTO wa_lfa1 WHERE lifnr = lifnr.
IF NOT wa_lfa1 IS INITIAL.
SELECT SINGLE city1 street FROM ADRC INTO wa_adrc
WHERE addrnumber = wa_lfa1-kunnr.
Execute
Right click on CODE1
Create ----- Text
Expand Global Data option
Expand WA_LFA1
Editor option
Goto ---- Change Editor
* Vendor Number: &WA_LFA1-LIFNR&
* Vendor Name: &WA_LFA1-NAME1&
* City: &WA_LFA1-CITY1&
* Street: &WA_LFA1-STREET&
MAIN window:
Right click on MAIN window
Create ----- Table
On maintaince screen you will find %LTYPE1
Split %LTYPE1 into 5 equal parts
Right click on %LTYPE1
Insert ------ Empty Line Underneath
Split %LTYPE2 into 2 parts
Ashok
SAP-ADV ABAP 74
Back
Right click on CELL12
Create ----- Text
Editor
Goto ---- Change Editor
P3 &TOTAL&
Back
Ashok
SAP-ADV ABAP 76
12-11-2014
Note:
SSF_FUNCTION_MODULE_NAME:
This function module returns a smart form function module generated on activation of smart
form
Ques-1:
Why we should call SSF_FUNCTION_MODULE_NAME instead of hard coding the function
module name itself?
Answer:
We know that in real time we have to transport the objects from one client to another
client
If the form is in Quality Server the system may assign a different version of function
module name to respective form & the same happen in Production Server also
So therefore it always advisable to call SSF_FUNCTION_MODULE_NAME which
returns the function module currently which system you are working
Ques-2:
What are the common errors you are facing while working with smart forms?
Answer:
1. Incorrect parameter with call function
This exception you will get if you not pass all the parameters which you maintained in smart
form
Ashok
SAP-ADV ABAP 77
Ques-3:
How do you work with Alternate option in smart form?
Answer:
Righ click on any one Window (say LOGO)
Create ----- Window Alternate
Right click on Alternate Window
Create ----- Flow Logic ------- Alternate
Conditions option
Field name Relational Operator
LIFNR double click
Form Painter
Adjust Alternate window
Activate form
Ques-4:
How you can work with more than one Page in smart form?
Answer:
Right click on PAGE1
Create ------ Page
Ashok
SAP-ADV ABAP 78
Back
Double click on MAIN window
Window Type: Secondary Window
Double click on PAGE1
Next Page: PAGE2
Double click on PAGE2
Next Page:______
Activate form
*** Ques-5:
How you can convert a smart form into PDF format?
Answer:
Run your print program
Provide input
Execute
Select Print option (Ctrl + P)
At bottom you will find a print request number note down it (say 11,5716)
Go to SE38
Program: RSTXPDFT4
Execute
Spool Request: 11,5716
Execute
Save
Ques-6:
How you can debug a smart form?
Answer:
Go to SMARTFORMS
Form: ZPO_FORM
Ashok
SAP-ADV ABAP 79
Change
Expand VENDOR window
Double click on CODE1
Provide BREAK-POINT
Activate form
Go to SE38
Program: ZMM_CALL_SMART_FORM (print program)
Execute
Note:
In smart forms you can set only Static Break Point. You cannot set Dynamic Break Point
Ques-7:
How you can work with Excel Sheet in smart forms?
Answer:
DATA fnam TYPE STRING.
Ques-8:
How you can print multiple records in smart forms?
Answer:
ZMM_CALL_SMART_FORMN
Ashok
SAP-ADV ABAP 80
START-OF-SELECTION.
LOOP AT S_EBELN.
PERFORM get_data USING s_ebeln-low.
ENDLOOP.
Ques-9:
How you can migrate SAP Script to smart form?
Answer:
Go to SMARTFORMS
Utilities ---- Migration ----- Import SAP Script Form
Form: ZPO_MEDD
Name: ZPO_MEDD
Enter
Ques-10:
How you can generate smart form into PDF format during runtime of print program?
Answer:
Ques-11:
How you can send of a form in the form of mail?
Answer:
Ques-12:
How you can write code in smart forms?
Answer:
Ques-13:
How you can maintain Page Breaks in smart forms?
Answer:
Ashok
SAP-ADV ABAP 82
13-11-2014
SAP Enhancements:
SAP is highly customizable
Using SAP Enhancements you can add additional functionalitites in existing once without
disturbing the same
Userexits:
Userexits are empty code blocks within subroutines
Object:
Validate sales order application using Userexits
Business Requirements:
In real time using VA01 application sales order is created which is again modified by
using VA02
Write an enhancement to validate VA02 such that one user created sales order is allowed
to modify is by same user only
Solution:
Go to SE38
Program: MV45AFZB
Display
Select Enhance option
Edit ---- Enhancement Operations ----- Show Implicit Enhancement Options
Try to search for USEREXIT_CHECK_VBAK subroutine
Right click on spot under form USEREXIT_CHECK_VBAK
Enhancement Implementation ----Create Implementation
You will find a message, select Code option
You will find a pop-up, select Create option
Again you will find a pop-up, provide
Enhancement Implementation: ZENC_VA02
Short Text: enhancement for VA02 implementation
Enter
Enter
Ashok
SAP-ADV ABAP 83
Enter
Again you will find that pop-up, select your Enhancement name i.e. ZENC_VA02
Enter
IF SY-TCODE EQ ‘VA02’.
IF VBAK-ERNAM NE SY-UNAME.
MESSAGE ‘Access denied’ TYPE ‘E’.
ENDIF.
ENDIF.
Activate
Note:
MV45AFZB & MV45AFZZ are the very important Userexits for VA01, VA02
application which we are working in real time
Currently Userexits are outdated except above
Ashok
SAP-ADV ABAP 84
Customerexits:
Customerexits are advanced to Userexits
Instead of adding customization in existing code it is always better to provide your own
customization using a T code which is done by Customerexits
Note:
Customerexits is based on Fucntional Consultant
Types of Customerexits:
1. Function Exits
2. Menu Exits
3. Screen Exits
4. Field Exits
Function Exits:
Object:
Validate vendor master application for postal code
Business Requirement:
Some times users will not enter Postal code, City, Tax code……..etc in an application
which are optional but important for clients
Provide validation such that without entering Postal code the transaction should not be
created
Note:
** The T code for working Customerexits is CMOD
** The T code for identifying Customerexits for an application is SMOD
Solution:
Step-1: identifying Package name of an application
Go to XK01
System -----Status
Double click on Program Name
Goto ---- Attributes
Note down package name (FBK)
Ashok
SAP-ADV ABAP 85
Enter
Note down Customerexits (SAPMF02K)
Note:
In real time Customerexits for an application is provided by Functional Consultant
Note:
** In Customerexits you cannot reuse the same exit in more than one project
Back
Back
Activate project
Ashok
SAP-ADV ABAP 87
Menu Exits:
Add a menu in MC94 application
Solution:
Step-1: identifying Package name of an application
Go to MC94
System -----Status
Double click on Program Name
Goto ---- Attributes
Note down package name (MCP2)
Activate
Back
Back
Back
Activate project
Ashok
SAP-ADV ABAP 89
Screen Exits:
Object:
Add a screen with following fields in CS01, CS02, CS03 applications
ZZORDER PO number
ZZDATE PO date
ZZVENDOR vendor number
Solution:
Step-1: adding fields to table
Go to SE11
Database Table: STKO
Display
Append Structure
You will find a message, Enter
Append Name: ZSTKO_APP
Enter
Short Description: Additional fields for stko table
Component Component Type
ZZORDER EBELN
ZZDATE BEDAT
ZZVENDOR LIFNR
Activate
Create
Short Text: customerexits for cs01
Save
Enhancement Assignments button
Select your enhancement PCSP0003
Enter
Select Components option
Yes
Double click on 0114
You find a message, select Maintain in Original Language option
You should find a message ‘for program SAPLXCSA is been created’, Enter
If you are not getting such message you have to delete the old enhancement
Activate
Back
Back
Scroll down to bottom
Double click on INCLUDE ZXCSAU04
Display / Change option
TABLES STKO.
STKO-ZZEBELN = USERDATA-ZZORDER.
STKO-ZZDATE = USERDATA-ZZDATE.
STKO-LIFNR = USERDATA-ZZLIFNR.
Activate
Back
Back
Double click EXIT_SAPLSOI_005
Double click on INCLUDE
Display / Change option
USERDATA-ZZORDER = STKO-ZZEBELN.
USERDATA-ZZDATE = STKO-ZZBEDAT.
USERDATA-ZZLIFNR = STKO-ZZLIFNR.
Activate
Back
Back
Back
Activate project
Ashok
SAP-ADV ABAP 92
14-11-2014
Assignment:
Add following fields in ME21N, ME22N, ME23N
ZZDEL Delivery priority
Customerexit: MM06C005
Solution:
Ashok
SAP-ADV ABAP 93
Fieldexits:
Using fieldexits you can modify field labels of data elements in data dictionary
Example:
Go to CMOD
Goto ----- Text Enhancements ------Keywords ----Change
Data Element: REGIO
Enter
Shot Field Lable: State
Medium Field Lable: State
Long Field Lable: State
Heading: State
Short Description: State
Save
Note:
SAP is not recommending Fieldexits in real time
Ashok
SAP-ADV ABAP 94
BADI:
Bussines Addins
It is based on object oriented programming
In Userexits (Customerexits) the same exit cannot be reuse in other projects
In BADIs the same BADI definition can be implemented in N number of
implementations
BADI concept is purly designed based on object oriented programming
For implementing BADI, SAP will provide you an interactive & respective
implementation class
Here interface is a collection of methods where you have to implement the additional
code
Note:
T codes for working with BADIs are
1. SE18 -------- for BADI definition
2. SE19 -------- for BADI implementation
Types of BADI:
1. Standard BADI
2. Custom BADI
3. Filter BADI
Ashok
SAP-ADV ABAP 95
***Standard BADI:
In Standard BADI, BADI definitions are predefined (given by SAP)
In Standard BADI we have to provide only implementation section
Object-1:
Validate customer master application for postal code
Solution:
Go to SE19
Classic BADI
BADI Name: CUSTOMER_ADD_DATA
Create Impl
Enter
Implementation Name: ZXD01_IMPL
Enter
Short Text: implementation for xd01 application
Interface tab
Double click on CHECK_ALL_DATA
Yes
Enter
You may find a message ‘implementation ZXD01_IMPL migrated’, Enter
You will find a pop-up, Select Create option
Again you will find a pop-up, provide
Enhancement Implementation: ZCUSTOMER_IMPL
Short Text: implementation for xd01 application
Enter
Select your implementation (ZXD01_IMPL)
Enter
You may find a wrong method
Back
Again double click on CHECK_ALL_DATA
Place cursor between METHOD………..ENDMETHOD
IF S_KNA1-PSTLZ IS INITIAL.
MESSAGE ‘Enter postal code’ TYPE ‘E’.
ENDIF.
Activate
Back
Activate
Ashok
SAP-ADV ABAP 96
Ashok
SAP-ADV ABAP 97
Watch Point:
Watch point is a cleaver break point
Use watch point for watching the errors in standard applications
The another purpose of watch point is to watch a specific record in an internal table
during debugging
Note:
You can keep maximum 5 wach points in ABAP for a specific report
Example:
Go to XD01
Provide required input
Save
Apply /H in Command prompt (/H is a T code for debugging)
Enter
Enter
Watch point button
You will find a pop-up, provide
***Variable: SY-MSGTY (system field for capturing messages)
Enter
You will find a message ‘watch point created’
F7
Ashok
SAP-ADV ABAP 98
2nd Method:
Go to SE80
Select Package
Provide CS
Enter
Expand Enhancements
Expand Classic BADIs Def
Go to CS01
Variable: EXIT_NAME
F7………….
Material: 100-101
Plant: 1000
Bom: 1
Enter
Ashok
SAP-ADV ABAP 99
Object-2:
Validate BOM application (CS01) for alternate Bom
Business Requirement:
In real time every material is having an alternate Bom
But some materials alternate Bom not possible
Provide to control on such materials such that user try to create alternate Bom system
through an error
Solution:
Go to SE19
Classic BADI
BADI Name: BOM_UPDATE
Create Impl
Enter
Implementation Name: ZBOM_IMPL
Enter
Short Text: implementation for BOM application
Interface tab
Double click on CHANGE_AT_SAVE
Yes
Enter
You may find a wrong method
Back
Again double click on CHANCE_AT_SAVE
Place cursor between METHOD………..ENDMETHOD
Activate
Ashok
SAP-ADV ABAP 100
***Assignment:
In MIRO (or) MIGO you will find posting date & document date
Posting date never be less than document date
Provide control such that if user provides document date greather than posting date gives
error
Solution:
Ashok
SAP-ADV ABAP 101
Object-3:
Add a menu in FBL5N application
Solution:
Go to SE90
Expand Enhancements
Expand Bussiness Addins
Double click on Definitions
Package: FREP
Execute
Note down BADI name
Go to SE19
Classic BADI
BADI Name: F5_ITEMS_MENUE01
Create Impl
Enter
Implementation Name: ZFI_ITEM
Enter
Short Text: implementation for FBL5N application
Interface tab
Double click on LIST_ITEMS01
You may find a wrong method
Back
Again double click on LIST_ITEMS01
Place cursor between METHOD………..ENDMETHOD
Activate
Back
Double click on LIST_ITEMS02
Place cursor between METHOD………..ENDMETHOD
Activate
Back
Activate
Ashok
SAP-ADV ABAP 102
Ashok
SAP-ADV ABAP 103
Object-4:
Add a screen in XD01, XD02 with following field
Sales Manager
Solution:
Go to SE11
Database Table: KNA1
Display
Append Structure
Create Append
Append Name: ZKNA1_APP
Enter
Short Text: Additional fields
Component Component Type
ZZSM ZSM
Activate
Go to SPRO
Select SAP Reference Img option
Expand Logistic General
Expand Bussiness Partner
Expand Customers
Expand Control
Expand Adaption of Customers Own Master Data Fields
Select Prepare Modification- Free Enhancement of Customer Master Record
You will find a message, Enter
New Entries
Screen Grp Description
Z5 Sales manager
Save
On left side double click on Label Tab Pages by selecting Screen Grp Z5
You will find another screen
Select New Entries button
Number Function Code Description
5000 TAB1 Sales manager
Save
Back
Back
Back
Back
Ashok
SAP-ADV ABAP 104
IF I_SCREEN_GROUP EQ Z5.
E_ADD_ON_ACTIVE = ‘X’.
ENDIF.
Activate
Back
Activate
Back
Select 3rd option Bussiness Addin Customer Sub screen
You will find a pop-up, at bottom select Create option
You will find a pop-up, provide
Implementation Name: ZCUST_CS_DATA
Enter
Implementation Short Text: Badi implementation
Attributes tab
Scroll down to bottom
Select ‘+’ Insert Row
Screen Grp
Z5
Save
You may find a message, Enter
You will find pop-up, at bottom select Create option
Enhancement Implementation: ZSM_IMPL_SM
Short Text: Badi implementation
Enter
Ashok
SAP-ADV ABAP 105
CASE I_TAXI_FCODE.
WHEN ‘TAB1’.
E_SCREEN = ‘5000’.
E_PROGRAM = ‘ZBADI_SM’.
ENDCASE.
Activate
Back
Activate
Go to SE38
Program: ZBADI_SM
Create
Title: Sales manager
Type: Module Pool
Enter
Go to SE51
Program: ZBADI_SM
Screen Number: 5000
Create
Short Description: Sub Screen 5000
Sub Screen
Layout
F6
Table Name: KNA1
Enter
Scroll down to bottom, select your field name ZZSM
Enter
Place the field on the screen
Flow Logic
Remove comment for MODULE STATUS_5000
Double click on STATUS_5000
Yes
Main Program
Ashok
SAP-ADV ABAP 106
Enter
Yes
TABLES KNA1.
IF SY-TCODE EQ ‘XD03’.
LOOP AT SCREEN.
IF SCREEN-NAME EQ ‘KNA1-ZZSM’.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
Activate
Back
Activate
Ashok
SAP-ADV ABAP 107
***Assignment:
Add following fields in VL01N, VL02N
Order number
Order date
Delivery challana number
Delivery challana date
Driver
Hint:
Add fields in LIKP table
BADI name is LE_SHP_TAB_CUST_HEAD
Solution:
Ashok
SAP-ADV ABAP 108
Custom BADI:
In Custom BADI, BADI definition is custom defined
Filter BADI:
It is a part of Custom BADI
In Filter BADI, the same definition can be called in different implementations
Object:
Determine tax code for sales organization
Solution:
Go to SE18
Utilities --- Create Classic BADI
Definition Name: ZBADI_CUST_FILTER
Enter
Scroll down to bottom, select Filter Depend check box
Filter Type: VKORG
Save
Interface tab
Note:
Based on your definition name system will create an interface ZIF_EX_BADI_CUST_FILTER
Activate
During activation you will find a message, Enter
Once your interface is activated system will add additional parameter FLT_VAL based on
your filter type VKORG
Go to SE19
Classic BADI
BADI Name: ZBADI_CUST_FILTER
Ashok
SAP-ADV ABAP 109
Create Impl
Enter
Implementation Name: ZBADI_FIL
Enter
Short Text: implementation for filter badi
Scroll down to bottom
Select ‘+’ Insert Row
Sales org
1000
Save
Interface tab
Double click on GET_TAX
Place cursor between METHOD………..ENDMETHOD
IF FLT_VAL = ‘1000’.
P_TAX = 10.
ENDIF.
Activate
Back
Activate
Back
Classic BADI
BADI Name: ZBADI_CUST_FILTER
Create Impl
Enter
Implementation Name: ZBADI_FIL
Enter
Short Text: implementation for filter badi
Attributes
Scroll down to bottom
Select ‘+’ Insert Row
Sales org
1020
Save
Interface tab
Double click on GET_TAX
Ashok
SAP-ADV ABAP 110
IF FLT_VAL = ‘1020’.
P_TAX = 12.
ENDIF.
Activate
Back
Activate
Back
Classic BADI
BADI Name: ZBADI_CUST_FILTER
Create Impl
Enter
Implementation Name: ZBADI_FIL
Enter
Short Text: implementation for filter badi
Scroll down to bottom
Select ‘+’ Insert Row
Sales org
1030
Save
Interface tab
Double click on GET_TAX
Place cursor between METHOD………..ENDMETHOD
IF FLT_VAL = ‘1030’.
P_TAX = 8.
ENDIF.
Activate
Back
Activate
Go to SE38
Program: ZCAL_CUSTOM_FILTER_BADI
Create
Title: Method of filter badi
Type: Executable Program
Ashok
SAP-ADV ABAP 111
Save
IF SY-SUBRC NE 0.
MESSAGE ‘Error in calling BADI’ TYPE ‘E’.
ELSE.
CALL METHOD obj->get_tax
EXPORTING
FLT_VAL = V_VKORG
CHANGING
P_TAX = V_TAX.
ENDIF.
ENDIF.
Ashok
SAP-ADV ABAP 112
Enhancement Framework:
BADIs are based on object oriented programming
But SAP is not providing BADIs for all requirements
Restricted to specific applications & only for specific requirements
Using Framework you can enhance all types of SAP objects
Object-1:
In VA01 you will find a field called Sales office, which is meant for sales office data
Generally clients are instructed not to enter Sales office data as it pickup automatically
from master data (KNVV table)
Some times clients will enter wrong data into Sales office, which is wrongly updated to
transactional tables
Provide an enhancement to deselect Sales office field
Solution:
Go to VA01
Apply F1 on Sales office
You will find a pop-up, select 4th option Technical Information
Double click on Screen 101
Double click on FELDAUSWAHL-101
Double click on subroutine FELDAUSWAHL-101
Enhance
Edit ---- Enhancement Operations ----Show Implicit Enhancement Options
Right click under spot under FORM FELDAUSWAHL-101
Enhancement Implementation ----Create Implementation
Code
Create
Enhancement Implementation: ZVA01_IMPL
Enter
Select your implementation name ZVA01_IMPL
Enter
IF SY-TCODE EQ ‘VA01’.
LOOP AT SCREEN.
IF SCREEN-NAME EQ ‘VBAK-VKBUR’.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
Ashok
SAP-ADV ABAP 113
ENDLOOP.
ENDIF.
Activate
Ashok
SAP-ADV ABAP 114
Object-2:
Provide Profit center as obligatory in F-28 application
Solution:
Go to F-28
Apply F1 on Profit Center
Technical Information
Double click on Screen 103
Double click on DYNPRO_KOPF_MODIF
Double click on subroutine DYNPRO_KOPF_MODIF
Enhance
Edit ---- Enhancement Operations ----Show Implicit Enhancement Options
Right click under spot under FORM DYNPRO_KOPF_MODIF
Enhancement Implementation ----Create Implementation
Code
LOOP AT SCREEN.
IF SCREEN-NAME EQ ‘BSEG-PRCTR’.
SCREEN-REQUIRED = 1.
MODIFY SCREEN.
ENDIF.
Activate
Ashok
SAP-ADV ABAP 115
Object-3:
In MB31 you will find Document date & Posting date as current date
Provide an enhancement such that I want both the dates by default as previous dates
Solution;
Go to MB31
Apply F1 on Document date
Technical Information
Double click on Screen 300
Double click on MODULE BELEGKOPF_VORGSCHLOG
You will find a subroutine, Double click on it
Enhance
Edit ---- Enhancement Operations ----Show Implicit Enhancement Options
Right click on spot above ENDFORM
Enhancement Implementation ----Create Implementation
Code
Create
Enhancement Implementation: ZMB_MB31
Short Text: Implementation for MB51 application
Enter
Select your implementation ZMB_MB31
Enter
MKPF-BUDAT = SY-DATLO - 1.
MKPF-BLDAT = SY-DATLO - 1.
Activate
Ashok
SAP-ADV ABAP 116
*** Object-4:
Add following fields in FB03 application
Dmbtr, Hlcont
Solution:
Go to SE11
Data Type: BKPF_ALV
Display
Append Structure
Enter
Append Name: ZBKPF_APP
Enter
Short Description: Additional fields
Component Component Type
HKONT HKONT
DMBTR DMBTR
Activate
Go to FB03
Document List
Apply F1 on Document number
Technical Information
Double click on Program name
Go to REUSE_ALV_GRID_DISPLAY
Find internal table
Enhance
Edit ---- Enhancement Operations ----Show Implicit Enhancement Options
Right click on spot under FORM GRID_DISPLAY
Enhancement Implementation ----Create Implementation
Code
Create
Enhancement Implementation: ZENC_FB03
Short Text: Implementation for FB03 application
Enter
Select your implementation ZENC_FB03
Enter
Ashok
SAP-ADV ABAP 117
REFRESH GT_YBKPF_ALV.
Ashok
SAP-ADV ABAP 118
Object-5:
Add screen in VF01, VF02, VF03 with ZZBOXNO, ZZSIZE, ZZTEXT
Solution;
Go to SE11
Database Table: VBRK
Display
Append Structure
Create Append
Append Name: ZVBRK_APP
Enter
Short Description: Additional fields
Component Component Type
ZZBOXNO ZBOXNO
ZZSIZE ZSIZE
ZZTEXT ZTEXT
Activate
Go to SE80
Program: SAPMV60A
At bottom, expand Screens option
Find 6001 screen & double click on it
Double click on MODULE CUST_HEAD_ACTIVATE
You will find a subroutine, double click on it
Enhance
Right click under FORM CUST_HEAD_ACTIVATE
LOOP AT SCREEN.
IF SCREEN-NAME EQ ‘TABSTRIP_TAB06’.
GS_CUST_TAB_HEAD_OPTION = ‘invocice’.
GS_CUST_TAB_HEAD_PROGRAM = ‘ZSD_INVV’.
GS_CUST_TAB_HEAD_DYNPRO = ‘100’.
IF SCREEN-ACTIVE = 1.
SCREEN-INVISIBLE = 0.
MODIFY SCREEN.
ENDIF.
TABSTRIP_TAB06 = GS_CUST_TAB_HEAD_CAPTION.
ENDIF.
Ashok
SAP-ADV ABAP 119
ENDLOOP.
Activate
Go to SE38
Program: ZSD_INVV
Create
Title: Invoice details
Type: Modulpe Pool
Save
Go to SE51
Program: ZSD_INVV
Screen: 100
Create
Short Description: Sub screen 100
Sub Screen
Layout
F6
Table Name: VBRK
Enter
Scroll down to bottom, select your fields
Enter
Place the fields on screen
Flow Logic
Remove comment for MODULE STATUS_100
Double click on STATUS_100
Yes
Main Program
Enter
Yes
IF SY-TCODE EQ ‘VF03’.
LOOP AT SCREEN.
IF SCREEN-NAME EQ ‘VBRK-ZZBOXNO’
OR SCREEN-NAME EQ ‘VBRK-ZZSIZE’
OR SCREEN-NAME EQ ‘VBRK-ZZTEXT’.
SCREEN-INPUT = 0.
ENDIF.
ENDLOOP.
ENDIF.
Ashok
SAP-ADV ABAP 120
Activate
Back
Activate
Assignment-1:
Add fields Purchase requisition number & Requisitioner name in MB51 application
EBAN-BOMFN,
EBAN-AFNAM
Solution:
Assignment-2:
Add fields storage bin (MARD-LGPBE) in MB5B
Solution:
***Assignment-3:
Validate Sales order quantity (VBAP-KWMENG) with PO quantity (EKPO-MENGE)
If Sales order quantity is > PO quantity provide a control on VA01 application
Solution:
Ashok
SAP-ADV ABAP 121
BTE:
Business Framework
Business Transaction Events
For standard applications SAP is providing BTE
For BTE a specific function module is attached
When BTE triggers respective function module is called
Note:
BTE is mostly for finance transactions
T code for BTE is FIBF
Ashok
SAP-ADV ABAP 122
Object:
Add indicator field in FBL5N application
Solution:
Go to SE11
Database Table: RFPOS
Display
Append Structure
Create Append
Append Name: ZFI_FBL5N
Enter
Short Text: indicator field
Component Component Type
ZZIND ZIND
Go to SE11
Database Table: RFPOSX
Display
Append Structure
Create Append
Append Name: ZFI_FBL5N1
Enter
Short Text: indicator field
Component Component Type
ZZIND ZIND
Go to BERE
Execute
Select Event 1650
Sample Function Module option
Ashok
SAP-ADV ABAP 123
Copy button
To: ZSAMPLE_INTERFACE_0001650
Function Group: F4
Enter
Enter
Function Module: ZSAMPLE_INTERFACE_0001650
Change
Remove comment for E_POSTAB = I_POSTAB
IF I_POSTAB-SHKZG = ‘H’.
I_POSTAB-ZZIND = ‘Credit’.
ELSE.
E_POSTAB-ZZIND = ‘Debit’.
ENDIF.
Activate
Go to FIBF
Settings ----- Products ---- Of a Customer
New Entries
Products A
ZFBL5N _/
Save
Back
Back
Settings ---- PS Modules ---- Of a Customer
New Entries
Event Product Function Module
1650 ZFBL5N ZSAMPLE_INTERFACE_0001650
Save
Go to SE38
Program: RFPOSXEXTEND
Activate
Yes
Enter
Testing Application:
Go to FBL5N
Customer Account: 1000
Ashok
SAP-ADV ABAP 124
Ashok
SAP-ADV ABAP 125
Example:
Go to SE93
Transaction Code: VA01
Display
Double click on Program Name
You will find a spot given by SAP
Enhance
Right click ES_SAPMV45A
Enhancement Implementation ----Create Implementation
Ques-3: What is the difference between Enhancement spot (point) & Enhancement section?
Answer:
In enhancement spot both customized & standard code will be executed
In enhancement section only customized code will be executed
Ashok
SAP-ADV ABAP 126
ALE:
Application Linking Enabling
ALE is SAP’s distributed technology for distributing (or) exchanging business process
between two systems (SAP (or) Non-SAP)
In real time if two companies are having same SAP systems (Servers) & if they want to
exchange their business data
Similarly, if two (or) more than two systems are working with different systems (other
than SAP) & they want to interact with SAP system we have to work with tool called
ALE
IDOC:
Intermediate Document
IDOC is a container with which business data can be exchanged between two systems
Components of IDOC:
1. IDOC Type
2. Segment Type
3. Records
IDOC Type:
It specifies the structure & format of an IDOC
It is simply collection of Segments
Standard IDOC Types have a suffix with 01, 02, 03…………. Which is known as Version
Number
Segment Type:
It is a collection of fields
Standard starts with prefix ‘E1’
Example:
E1KNA1M
E1MARA1M
Ashok
SAP-ADV ABAP 127
Records:
Records are classified into
1. Control Record
2. Data Record
3. Status Record
Control Record:
It holds control level information (IP address of both Sender & Receiver, Message Type
information, Segment Type information…………..etc)
Only one Control Record exists in an IDOC
The structure & format of Control Record is same for all IDOCs
Control Record information is finally updated to a table EDIDC
Data Record:
It holds actual data
Data Record information is finally updated to a table EDIDU (the structure related to it is
EDIDD)
Status Record:
IDOC have to travel through different layers (Application layer, ALE Service layer,
Communication layer)
At each layer the status information of an IDOC can be gathered from Status Record
Status Record information is updated to EDIDS
Note:
1. There exists only one Control Record in an IDOC
2. Status Records & Data Records can be many
3. In real time as an ALE Consultant we have to work with only IDOCs
Ashok
SAP-ADV ABAP 128
Ashok
SAP-ADV ABAP 129
ALE Architecture:
Application Layer
CDM (Receivers)
Database
Database Layer
Communication Layer
Outbound System
Integration Layer
Ashok
SAP-ADV ABAP 130
Inbound System
Ashok
SAP-ADV ABAP 131
Message Type:
These are unique application identities
SAP is providing an unique identity for all application data to identify the same
Note:
T code for Message Type is WE81 & WE82
Model View
Sender
Receiver
Message Type
Partner Profile:
Using Partner Profiles Ports can be created
T codes are WE21 & BD64
Process Flow:
Master Data Material MATMAS MATMAS05 Master IDOC Process codes Communication IDOC
(WE81) (WE30) (WE41)
(WE021 & WE03)
Transactional data PO orders ORDERS ORDERS05 Master IDOC Process codes Communication IDOC
Ashok
SAP-ADV ABAP 132
Types of IDOCs:
1. Standard IDOC
2. Custom IDOC
3. Extended IDOC
Standard IDOC:
In this all IDOC options (Message Type, IDOC Type, Segment Type…………etc) are already
provided by SAP
Object:
Distributing material master data
Message Type: MATMAS
IDOC Type: MATMAS05
Logical Systems:
These are unique client identities
In real time for each client Logical Systems needs to be created
Solution:
Steps:
Client 800 Client 810
1. Work with SALE
Create Logical Systems
Assign Logical Systems to Clients
Note:
Logical systems are client independent
New Entries
Logical System Name
MATT800 SENDER
MATT810 RECEIVER
Save
Back
Back
Step-2:
Creating RFC destinations in 800 client:
Go to SM59
Select ABAP Connections
Ashok
SAP-ADV ABAP 134
Create
RFC Destination: MATT810
Description: RFC for Client 810
Target Host: SAPLID
Logon & Security tab
Scroll down to bottom
Language: EN
Client: 810
User: user1
PW Status: rgsabap
Enter
Enter
Save
Enter
Remote Logon button
Working under client 810
Note:
In real time the above 2 steps are done by Basis Consultant
Note:
Sometimes you may find an error message in red color. In such case
Go back
Again, execute
Back
Step-5:
Distributing Model View:
Edit --- Model View ---- Distribute
Enter
You should find a message ‘model view has been created’
Creating Ports:
Select client 810 session
Go to BD64
Select your model view name
Environment ---- Generate Partner Profiles
Ashok
SAP-ADV ABAP 136
Step-6:
Creating process codes in 810 client:
Go to WE20
Expand Partner Type LS
Select Sender logical system name (MATT800)
Right side scroll down to bottom
Under Inbound Parameters
Double click on MATMAS
By default you will find Process Code: AFSA which is wrong one, provide
Process Code: MATN
Save
Note:
The above material is created by end user
Step-7:
Running Outbound program:
Go to BD10
Material: u-883
Message Type: MATMAS
Ashok
SAP-ADV ABAP 137
Step-8:
Displaying IDOC List:
Go to WE05
Execute
Note:
In real time we should work with only outbound system. In outbound system you should always
get status as Green (or) Yellow
Step-9:
Working with MM03:
Go to MM03
Material: u-883
Enter
Enter
Ashok
SAP-ADV ABAP 138
Step-1:
Go to BD50
In real time sometimes all the Message Types may be selected, first you Deselect them &
then
Select your Message Type MATMAS
Save
Step-2:
Go to BD52
Message Type: MATMAS
Enter
Here we have to add additional tables & fields related to material
Step-3:
Go to BD61
Select Change Pointer Activated Generally check box
Save
Step-4:
Go to SE38
Program: RBDMIDOC
Execute
Message Type: MATMAS
Execute
You will find a message, Enter
Enter
Go to MM02
Material: u-883
Enter
Select Basic Data1, Basic Data2
Enter
Make some changes i.e. material: soda bottle, Gross wt: 800………etc
Ashok
SAP-ADV ABAP 139
Save
Go to SE38
Program: RBDMIDOC
Execute
Message Type: MATMAS
Execute
You will find a message ‘1 master IDOC generated’, Enter
Again, you will find a message ‘1 communication IDOC generated’, Enter
Step-5:
Go to WE05
Execute
Scroll down to bottom, Double click on your IDOC Number
Ashok
SAP-ADV ABAP 140
IDOC Filtering:
1. Segment Filtering
2. IDOC Filtering
3. Reduced IDOC Filtering
Segment Filtering:
Unnecessary Segments can be filtered using Segment Filtering
Steps:
1. Work with BD56
2. Work with BD10
3. Work with BE05
Step-1:
Go to BD56
Message Type: MATMAS
Enter
New Entries
Ty Sender Ty Receiver Segment Type
LS MATT810 LS MATT800 E1MARMM
Save
Step-2:
Go to BD10
Material: u-883
Message Type: MATMAS
Logical System: MATT800
Execute
Step-3:
Go to WE05
Execute
Note:
Mandatory Segments cannot be deleted
Ashok
SAP-ADV ABAP 141
IDOC Filtering:
Assume a company is having N number of Company Codes operating in different
countries
Assume a customer is approaching to Company Code 1000 for business
His customer master data will be available not only to 1000 Company Code but also to
other Company Code which is not required from 1000 Company Code perspective
Whenever a customer is created for 1000 Company Code, it should be allowed by the
system
It the same is done for other Company Codes it should be filtered out
In customer distribution model you should create a Filter Set based on Company
Code…….etc
Whenever Master IDOC is created then system will check whether the Company Code is
matching with Filter Set (or) not
If not matching respective Segment is filtered out
Steps:
Client 800 Client 810
1. Work with SALE
Create Logical Systems
Assign Logical Systems to Clients
Step-1:
Creating logical systems:
Go to SALE
Expand Basic Settings
Expand Logical Systems
Select Define Logical System option
Enter
Note:
Logical systems are client independent
New Entries
Logical System Name
CUST800 SENDER
CUST810 RECEIVER
Save
Back
Back
Step-2:
Creating RFC destinations in 800 client:
Go to SM59
Select ABAP Connections
Create
RFC Destination: CUST810
Description: RFC for Client 810
Target Host: SAPLID
Logon & Security tab
Ashok
SAP-ADV ABAP 143
Note:
In real time the above 2 steps are done by Basis Consultant
Step-3:
Creating Model View:
Select client 800 session
Go to BD64
By default Create Model View button is deselected
Select F9
Select Create Model View button
Short Text: Model view for customer master
Technical Name: CUSTOM ORDER
Enter
Ashok
SAP-ADV ABAP 144
Enter
Enter
Save
Step-5:
Distributing Model View:
Edit --- Model View ---- Distribute
Enter
You should find a message ‘model view has been created’
Note:
On distributing Model View, model view will became client independent
Creating Ports:
Select client 810 session
Go to BD64
Select your model view name
Environment ---- Generate Partner Profiles
Partner System: CUST800
Execute
You will find a message ‘port has been created’
Step-6:
Creating process codes in 810 client:
Go to WE20
Expand Partner Type LS
Select Sender logical system name (CUST800)
Right side scroll down to bottom
Under Inbound Parameters
Double click on DEBMAS
By default you will find Process Code: DEB2 which is wrong one, provide
Process Code: DEBM
Save
City: Hyderabad
Country: IN
Save
Step-7:
Running Outbound program:
Go to BD12
Customer: 7856
Output Type: DEBMAS
Execute
Step-8:
Displaying IDOC List:
Go to WE05
Execute
Select DEBMAS
Execute
Double click on IDOC Number
Expand Data Records
Go to XD01
Customer: 7856
Company Code: 3000
Enter
Title: Mr
Name: Satya
City: Hyderabad
Country: IN
Save
Go to BD12
Customer: 7856
Output Type: DEBMAS
Execute
Ashok
SAP-ADV ABAP 147
Steps:
1. Work with BD53
2. Work with BD64
3. Work with BD10
4. Work with WE05
Step-1:
Go to BD53
Reduced Message Type: ZRED_MATMAS
Create
Message Type Ref: MATMAS
Enter
Description: Reduced message type for material type
Enter
Place cursor on E1MARMM
Select button
You will find a white color change instead of red color to the segment
Double click on that segment
Select the fields which you want to filter
Select button
Enter
Save
Step-2:
Creating Model View:
Select client 800 session
Go to BD64
By default Create Model View button is deselected
Select F9
Select Create Model View button
Short Text: Model view for customer master
Technical Name: CUSTOM ORDER
Enter
Scroll down to bottom
Select short description of your model view
Select Add Message Type
Sender: CUST810
Receiver: CUST800
Message Type: DEBMAS
Ashok
SAP-ADV ABAP 148
Enter
Again, select Add Message Type
Sender: CUST800
Receiver: CUST810
Message Type: DEBMAS
Enter
Save
Step-3:
Go to BD10
Material: u-883
Message Type: MATMAS
Logical System: MATT800
Execute
Step-4:
Go to WE05
Execute
Note:
In real time we are not working with Reduced IDOC Filtering
Ashok
SAP-ADV ABAP 149
***Object:
Distribute Purchase Order Data using Message Control Technique
Message Type: ORDERS
IDOC Type: ORDERS05
Steps:
Client 800 Client 810
1. Work with SALE
Create Logical Systems
Assign Logical Systems to Clients
Note:
Conditional Records are maintained by Functional Consultant
Note:
Purchase Order creation is done by end user. Once ME21N is executed IDOC is created &
dispatched to Inbound system
Solution:
Step-1:
Creating logical systems:
Go to SALE
Expand Basic Settings
Expand Logical Systems
Select Define Logical System option
Enter
Note:
Logical systems are client independent
New Entries
Logical System Name
MATT800 SENDER
MATT810 RECEIVER
Save
Back
Back
Ashok
SAP-ADV ABAP 151
Step-2:
Creating RFC destinations in 800 client:
Go to SM59
Select ABAP Connections
Create
RFC Destination: MATT810
Description: RFC for Client 810
Target Host: SAPLID
Logon & Security tab
Scroll down to bottom
Language: EN
Client: 810
User: user1
PW Status: rgsabap
Enter
Enter
Save
Enter
Remote Logon button
Working under client 810
Note:
In real time the above 2 steps are done by Basis Consultant
Ashok
SAP-ADV ABAP 152
Note:
Sometimes you may find an error message in red color. In such case
Go back
Again, execute
Back
Step-5:
Distributing Model View:
Edit --- Model View ---- Distribute
Enter
You should find a message ‘model view has been created’
Ashok
SAP-ADV ABAP 153
Creating Ports:
Select client 810 session
Go to BD64
Select your model view name
Environment ---- Generate Partner Profiles
Partner System: MATT800
Execute
You will find a message ‘port has been created’, Enter
Note:
With the above navigation we should provide
1. Whom to transfer (Receiver address)
2. What to transfer (Message Type & IDOC Type)
3. Mode of dispatch (Transfer Immediately & Collect IDOCs)
4. Medium of data transfer (Port)
Ashok
SAP-ADV ABAP 154
Save
Ashok
SAP-ADV ABAP 155
Custom IDOC:
In Custom IDOC all IDOC options are customized
Steps:
Client 800 Client 810
1. Work with SALE
Create Logical Systems
Assign Logical Systems to Clients
Solution:
Step-1:
Creating logical systems:
Go to SALE
Ashok
SAP-ADV ABAP 156
Note:
Logical systems are client independent
New Entries
Logical System Name
MATT800 SENDER
MATT810 RECEIVER
Save
Back
Back
Step-2:
Creating RFC destinations in 800 client:
Go to SM59
Select ABAP Connections
Create
RFC Destination: MATT810
Description: RFC for Client 810
Target Host: SAPLID
Logon & Security tab
Scroll down to bottom
Language: EN
Client: 810
Ashok
SAP-ADV ABAP 157
User: user1
PW Status: rgsabap
Enter
Enter
Save
Enter
Remote Logon button
Working under client 810
Note:
In real time the above 2 steps are done by Basis Consultant
Save
Save
Save
Ashok
SAP-ADV ABAP 161
17-11-2014
Extended IDOC:
Extended IDOC = Predefined IDOC Type + Additional Segment
Steps:
Client 800 Client 810
1. Work with SALE
Create Logical Systems
Assign Logical Systems to Clients
Ashok
SAP-ADV ABAP 162
Solution:
Step-1:
Creating logical systems:
Go to SALE
Expand Basic Settings
Expand Logical Systems
Select Define Logical System option
Enter
Note:
Logical systems are client independent
New Entries
Logical System Name
EXT1800 SENDER
EXT1810 RECEIVER
Save
Back
Back
Step-2:
Creating RFC destinations in 800 client:
Go to SM59
Select ABAP Connections
Create
RFC Destination: EXT1810
Ashok
SAP-ADV ABAP 163
Note:
In real time the above 2 steps are done by Basis Consultant
KUNNR KUNNR
NAME1 NAME1
LAND1 LAND1
ORT01 ORT01
PSTLZ PSTLZ
STRAS STRAS
Save
Save
CASE SEGMENT_NAME.
WHEN ‘E1KNA1M’.
READ TABLE IDOC_DATA INTO WA_DATA WITH KEY SEGNAM =
‘E1KNA1M’.
WA_MAPPING = WA_DATA + SDATA.
SELECT SINGLE KUNNR NAME1 ORT01 PSTLZ STRAS FROM KNA1 INTO
WA_KNA1 WHERE KUNNR = WA_MAPPING-KUNNR.
WA_DATA-SDATA = WA_KNA1.
WA_DATA-SEGNAM = ‘Z1SEG’.
ENDCASE.
City: Hyderabad
Country: In
Save
Ashok
SAP-ADV ABAP 168
3. Status 29
Error in ALE Service Layer (or)
Error in Custom (or) Extended program
4. Status 26
Error in Syntax Check (or)
If Segment is wrong (or)
Mandatory Segments are deleted (or)
If Partner Profiles are not maintained in WE20
Example:
Go to WE19
IDOC Number: 8110 (it is wrong)
Execute
Double click on IDOC Number
Standard Inbound option
You will find a pop-up with error message
2. BD20
It is for processing partial IDOCs
3. WE09
It is for searching IDOCs which are being processed as on date
Ashok
SAP-ADV ABAP 169
Debugging IDOCs:
1st Method:
Go to BD20
IDOC Number: 801120
Command Prompt: /H
Enter
Enter
F6………………..
2nd Method:
Go to SE37
Function Module: IDOC_INPUT
Display
Place Dynamic Break Point at DESCRIBLE TABLE IDOC_DATA LINES
Go to BD20
IDOC Number: 801120
Execute
Ashok
SAP-ADV ABAP 170
EDI:
Electronic Data Interchange
Paperless work
EDI is computer to computer exchange of routine business data (Purchase Orders,
Invoices, Sales Orders………..etc) in standard format
Advantages of EDI:
Availability of data in electronic forms
Reduced data entry errors
Paperless work
Better competitive advantage
Accuracy of data
Speed
Security
EDI Architecture:
Ashok
SAP-ADV ABAP 171
Middle Wares:
1. EAI
Enterprise Application Integration
1. MA Series
2. Web Methods
2. EDI Systems
1. Gentian
2. Mercator
3. SAP XI
Exchange infrastructure
Ashok
SAP-ADV ABAP 172
Solution:
Step-1: Creating File Port
Go to WE21
File
Create
Port: IDOCPORT
Description: Port creation
Scroll down to bottom
Function Module: EDI_PATH_CREATE_USERNAME
Inbound File tab
Function Module: EDI_PATH_CREATE_USERNAME
Save
Outbound Trigger tab
RFC Destination: SERVER_EXEC
Save
Note:
SERVER_EXEC will transfer the IDOC file to Web methods
Save
Save
Step-5:
Go to ME21N
Vendor: 9347
Enter
Purchase Organization: 1000
Purchase Group: 001
Company Code: 1000
Enter
Ashok
SAP-ADV ABAP 174
Currency: INR
Material: 100-101
PO Quantity: 10
Net Price: 3000
Plant: 1000
Save
Once you save the application you will get a message ‘Purchase Order ……… created’
Ashok
SAP-ADV ABAP 175
BAPI:
Business Application Programming Interface
It is an interface programming across business applications
Features of BAPI:
1. BAPI is an interface programming
2. It is based on Object Oriented Programming
3. It supports all types of Languages (.Net, Java, VC++………etc)
4. It supports all type of Communication interfaces (RFC, COM, DCOM, CORBA,
TIBCO………….etc)
5. In BAPI, RFC function module converted to method & the same method is accessed by
3rd party communication interfaces
6. BAPI is synchronous
Business Object:
The entire business objected oriented programming is designed based on business objects
Every business object holds business data & does not allow it to access by outside world
Kernel:
It holds inherent data
Ashok
SAP-ADV ABAP 176
Integration Layer:
In this layer methods are defined for accessing Kernel data
Interface Layer:
Here interfaces (BAPIs) are maintained for integrating with methods
Communication Layer:
All communication interfaces (RFC, CORBA……..etc) can access this layer
Object Type:
Business Objects are created based on Object Type
It acts as a blue print (or) template for creating business objects
Key Fields:
Using this option key fields are maintained (Customer Number, Sales Order………etc)
Methods:
The main logic for extracting business data is maintained using Methods
Attributes:
These are the parameters which are passed & returns from Methods
These are actually part of Methods
Ashok
SAP-ADV ABAP 177
BOR:
Business Object Repository
It is the central repository for all business object types & their BAPIs
Features of BOR:
1. It acts as central access point (or) repository for all Business Objects, Object Types, Their
Key Fields, Methods …………..etc
2. All 3rd party Communication interfaces can access Business Objects stored in BOR
3. Business Objects maintained in BOR remains stable for a long time
Note:
The T code for working with BOR is BAPI & SW01
Ashok
SAP-ADV ABAP 178
***Types of BAPIs:
1. Standard BAPI
2. Custom BAPI
3. Extended BAPI
Standard BAPI:
In standard BAPI, all BAPI function modules are predefined
Object:
Create a bank in client database
Solution:
Go to SE38
Program: ZFI_BAPI_BANK
Create
Title: Uploading bank data using BAPI
Type: Executable Program
Save
wa_bank_address-bank_name = ‘Sbi’.
wa_bank_address-street = ‘Lbnagar’.
wa_bank_address-city = ‘Hyderabad’.
wa_bank_address-bank_brnch = ‘Lbnagarbranch’.
IF SY-SUBRC EQ 0.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
Ashok
SAP-ADV ABAP 179
EXPORTING
WAIT = ‘X’.
ENDIF.
Ashok
SAP-ADV ABAP 180
Object-2:
Create interface program for update bank data
Solution:
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-000.
PARAMETERS: p_banks TYPE banks,
p_bankl TYPE bankl.
SELECTION-SCREEN: END OF BLOCK b1.
wa_bank_address-bank_name = ‘Sbi’.
wa_bank_address-street = ‘Tnagar’.
wa_bank_address-city = ‘Chennai’.
wa_bank_address-bank_brnch = ‘Tnagarbranch’.
wa_bank_addressx-street = ‘X’.
wa_bank_addressx-city = ‘X’.
wa_bank_addressx-bank_brnch = ‘X’.
IF SY-SUBRC EQ 0.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
EXPORTING
WAIT = ‘X’.
ENDIF.
Ashok
SAP-ADV ABAP 181
*** Assignment:
Create BAPI interface program for creating sales order using
BAPI_SALEORDER_CRETEDAT2
Solution:
Ashok
SAP-ADV ABAP 182
23-11-2014
Custom BAPI:
In Custom BAPI, BAPI function modules are custom defined
Object:
Create customized BAPI for invoice object
Phases:
1. Analysis Phase
2. Design Phase
3. Implementation Phase
4. Test & Release Phase
Analysis Phase:
During this phase Project Managers will analyze which BAPI project should be implemented
for current project
Design Phase:
During this phase BAPI Structures & Tables are designed
Implementation Phase:
During this phase BAPI project will be implemented
It is further having following sub phases
1. Working with SE11 (DDIC)
2. Working with SE37 (Create RFC Form)
3. Working with SWo1 (create Business Object)
4. Working with SE38 (create Interface program)
Solution:
Step-1:
Creating Structure:
Go to SE11
Data Type: ZBAPI_INVSTR
Create
Structure
Short Description: Invoice details
Component Component Type
VBELN VBELN_VF
FKDAT FKDAT
Ashok
SAP-ADV ABAP 183
MATNR MATNR
ARKTX ARKTX
FKIMG FKIMG
NETWR NETWR
Activate
Creating Table:
Go to SE11
Database Table: ZBAPI_INVTABLE
Create
Short Description: Invoice table
Delivery Class: A
Table View Maintenance: Display / Maintenance View Allowed
Fields
Field Data Element
MANDT _/ MANDT
VBELN _/ VBELN_VF
FKDAT FKDAT
MATNR MATNR
ARKTX ARKTX
FKIMG FKIMG
NETWR NETWR
Technical Settings
Data Class: APPL0
Size Category: 0
Save
Back
Activate
Utilities ----- Table Contents ----- Create Entries
Provide input & Save
Ashok
SAP-ADV ABAP 184
Export tab
Parameter Name Typing Associated Type Pass Value
RETURN TYPE BAPIRET2 _/
Tables tab
Parameter Name Typing Associated Type
IT_INV LIKE ZBAPI_INVTABLE
IF SY-SUBRC NE 0.
RAISE INVALID-INPUT.
ENDIF.
Activate
Back
Function Module --- Release----- Release
Ashok
SAP-ADV ABAP 185
Note:
In real time if your testing is not fine go to SE37 & solve the issue
Ashok
SAP-ADV ABAP 186
Note:
In real time as a ABAP Consultant we should create business objects in BOR
Assignment-1:
Create standard BAPI for creation of material using BAPI_MATERIAL_SAVEDATA
Assignment-2:
Create standard BAPI for creating purchase order using BAPI_PO_CREATE
Ashok
SAP-ADV ABAP 187
Adobe Forms:
Using Adobe Forms you can design interactive forms with various interactive actions
In Smart Forms we can design only Paper Forms
But using Adobe Forms you can design PDF (or) Online Forms
Note:
T code for working with Adobe Forms is SFP
Adobe forms can be exploited using
ABAP knowledge
Web Dynpro
Java Script
Object:
Develop an invoice form using Adobe forms
Solution:
Go to SFP
Interface: ZBILL_INT
Create
Description: Invoice interface
Enter
By default Import option is selected
On right side select Append Row option
VBELN TYPE VBELN_VF
SELECT VBELN MATNR FKIMG ARKTX NETWR FROM VBRP INTO TABLE
IT_VBRP WHERE VBELN = VBELN.
Activate
Back
Form: ZBILL_FORM
Create
Description: Invoice form
Interface: ZBILL_INT
Enter
Expand Import
Drag & drop VBELN under ZBILL_FORM
Expand Global Data option
Drag & drop IT_VBRP under ZBILL_FORM
Expand System Fields
Expand SFPSY
Drag & drop DATE, USER NAME under ZBILL_FORM
Layout
Palettes ---- Library
Place Text Icon on Design view
Place Image Icon on design view
Double click on Image
Ok
Select any Logo, Open
Right click on image
Palettes ----- Object
Embed Image Data
Close
Place VBELN, DATE, USER NAME on design view
Place IT_VBRP on design window
Save
Close
Ashok
SAP-ADV ABAP 189
Activate
Go to SE38
Program: ZSD_ADOBE_FORM
Create
Title: Adobe form
Type: Executable Program
Save
PERFORM open_form.
PERFORM call_form.
PERFORM close_form.
FORM open_form.
CALL FUNCTION ‘FP_JOB_OPEN’
CHANGING
IE_OUTPUTPARAMS = output.
ENDFORM.
FORM call_form.
CALL FUNCTION ‘FP_FUNCTION_MODULE_NAME’
EXPORTING
I_NAME = ‘ZBILL_FORM’
IMPORTING
E_FUNCNAME = fname.
FORM close_form.
CALL FUNCTION ‘FP_JOB_CLOSE’.
ENDFORM.
Activate
Execute
Provide input
Execute
Ashok
SAP-ADV ABAP 190
Debugging Techniques:
Table Level Debugging:
Using table level debugging you can manipulate data directly from table level
Example:
Go to SE11
Database Table: KNA1
Display
Contents
Kunnr: 1000 to 1005
Execute
Select Select All option (F9)
Display (F7)
Command Prompt: /H
Enter
Enter
Debugging ----Switch to New ABAP Debugger
Variable
CODE
Enter
Scroll horizontally
Click on Change Field
Remove SHOW & provide EDIT
Note:
For delete ------ DELE
For modify ---- EDIT
For insert ------ INSR
Enter
F6 ……………….
F8
Provide input (which you want to modify)
Save
Next Entry
Provide input (which you want to modify)
Save
Ashok
SAP-ADV ABAP 191
Ashok
SAP-ADV ABAP 192
Ashok
SAP-ADV ABAP 193
Lock Object:
Using lock object you can maintain data integrity between applications
Example:
Go to SE11
Database Table: YCUSTOM
Create
Short Description: custom table
Delivery Class: A
Table View Maintained: Display / view allowed
Fields tab
Field name Data element
MANDT MANDT
KUNNR KUNNR
NAME1 NAME1
Technical Settings
Data Class: APPL0
Size Category: 0
Save
Back
Activate
Utilities ---- Table Contents ---- Create Entries
Kunnr: 1000
Name1: satya
Save
Go to SE38
Program: ZLOCK
Create
Title: lock object program
Type: Executable Program
Save
TABLES YCUSTOM.
START-OF-SELECTION.
CALL SCREEN 100.
Yes
Short Description: main screen
Layout
F6
Table: YCUTOM
Enter
Select all fields, Enter
Place the fields on screen
Flow Logic
Remove comment for MODULE STATUS_100
Double click on STATUS_100
Yes
Main Program
Enter
Go to /OSE11
Lock Object: EZLCK1
Create
Short Description: lock object
Tables
Name: YCUSTOM
Lock Mode: WRITE LOCK
Activate
Note:
Once your lock object is activated system will create 2 function modules
One for applying lock &
Another for releasing lock
KUNNR = p_cust.
Activate
Activate
Back
Activate
Testing:
Go to SE38
Execute your program
Done
Go to /OSE38
Execute your program
Not Done
Note:
In real time locks are released manually using T code SM12
o Go to SM12
o List
o Select locks
o Lock Entry ----- Delete All
Ashok
SAP-ADV ABAP 196
Ashok
SAP-ADV ABAP 197
Technical Settings
Data Class: APPL0
Size Category: 0
Save
Back
Activate
Insert the following records into table
1000 satya
1001 satya
1002 satya
1003 pruthvi
Go to SE37
Function Module: F4IF_SHLP_EXIT_EXAMPLE
Copy
To: ZSEARCH_MOD
Function Group: ZFGR
Enter
Enter
Function Module: ZSEARCH_MOD
Change
Scroll down to bottom, before EXIT
SORT RECORD_TAB.
Activate
Ashok
SAP-ADV ABAP 198
Go to SE11
Search Help: ZSEAR_HELP
Create
Enter
Short Description: elementary search help
Selection Method: ZCUST1
Search Help Exit: ZSEAR_HELP
Scroll down to bottom, provide
Search Help Parameter Export Import LPOS SPOS
NAME1 _/ _/ 1 1
Activate
Go to SE38
Program: ZCALL_SEARCH
Create
Title: search help exit program
Type: Executable Program
Save
Activate
Execute
Apply F4 on field
You will find only sorted list
i.e. 1000 satya
1004 pruthvi
Ashok
SAP-ADV ABAP 199
Question-2:
How you can maintain Logs (or) Error records in Session method?
Answer:
In Session method SAP is providing a Log file by default
No need to create a Log file for handling error records
You can find Log file by using SM35
Go to SM35
Select your session
Select Log option (F7)
Select your session
Select Display button
Question-3:
How you can perform background processing in Session method?
Answer:
Using program RSBDCSUB you can execute session in background
Example:
In above program modify subroutine PERFORM close_session.
FORM close_session.
ENDFORM.
Execute
F4
Select your Flat File
Execute
Ashok
SAP-ADV ABAP 200
Question-4:
Suppose I’m having a Flat File with 50000 records. It happened that the system crashed while
uploading data. How I know the number of records exactly uploaded?
Answer:
I will go to respective database table & copy the key values to the table & execute it
Question-5:
Assume there are 1000 records out of which I uploaded 500 records & remaining I want to
upload next day. How you will you perform this job?
Answer:
I will check the status of the records uploaded & I will delete the records from Flat File which
are correctly uploaded & remaining I will execute once again on next day
Question-6:
I’m having 2 Flat Files with 500 records & 50000 records. Which method will you prefer for
both Flat Files?
Answer:
For 500 records Call Transaction Method
For 50000 records Session Method
Question-7:
What is the difference between Session Method & Call Transaction Method?
Answer:
Session Method Call Transaciton Method
7. It for uploading large amount of data 1. It for uploading small amount of data
8. Multiple applications can be processed 2. Only single application can be processed
at one time with one BDC program at one time with one BDC program
9. In this method respective Log File is 3. In this method we have to create Log file
already given by SAP explicitly using structure BDCMSGCOLL
10.Asynchronous processing 4. Synchronous processing
11.Synchronous updating 5. Asynchronous updating
12.It is a slower method but consistent 6. Faster than Session method
Question-8:
How will you handle error records BDC?
Answer:
In real time client will ask error records during BDC upload
Ashok
SAP-ADV ABAP 201
For that we have to provide him Logs in the form of error file
In Session Method Log file you can find directly in SM35
In Call Transaction Method as processing synchronous we have to create a Log file
internal tabld based on structure BDCMSGCOLL which holds log details during
processing of application
The error records are looped to respective work area which further exported to Funtion
Module FORMAT_MESSAGE
It returns a Message ID which I will capture by using a dummy internal table
7.) What are the commands for sequential file and their syntax?
Ans:
1. Read dataset file <file> into <wa>.
2. Open dataset file <filename> in binary mode
3. Close dataset <file>.
4. Transfer <file> to <wa>.
5. Delete dataset <file>.
Ashok
SAP-ADV ABAP 202
13.) Write down the coding example of filling the data into bdc table ?
Ans:
Ashok
SAP-ADV ABAP 203
2. Background
3. Display with errors
Ashok
SAP-ADV ABAP 204
25.) An index is added to the fieldname to indicate which line is to be populated by bdc session?
Ans:
27.) A situation: an abap program creates a batch input session. We need to submit the Program
and batch input session in background. How will u do it?
Ans:
Go to SM36 and create a background job by giving job name, job class and job steps
(background scheduling steps).
Ashok
SAP-ADV ABAP 205
36.) Suppose there are 1000 records and there is an error at 66 record. How will u identify and
send it to end user?
Ans: Using BDCMSGCOLL u can capture error records and using T code SLG1 u can find it.
37.) I am uploading 1000 records using session method. I have an error at 950 record. What will
happen in both ctm and session method?
Ans:
Up to 949 records are updated using session method.
Except 950 remaining all records are update using ctm.
39.) How will generate and processing the session in the same program?
Ans: In ur program using SUBMIT RSBDCSUB VIA SELECTION-SCREEN
41.) I want to upload 10 lakh records and each record is taking 1 minute for processing. How
will solve this issue?
Ans:
Break the records into 100/1000 sessions and process ur session it will take same time as
it take for single sessions.
We can go through lsmw direct input method.
Use bapi run in background.
Ashok
SAP-ADV ABAP 206
45.) After running a bdc program with session, I found few errors next morning. What will u
do?
Ans:
Correct the error records (ur flat file) and run bdc program.
If problem is not in session then I will check the bdc program.
46.) U are given FD for bdc, how will u decide which method to use?
Ans:
It depends on client requirement
If it is large data use session method.
Small amount of data use ctm.
49.) What is the difference between batch input and direct input?
Ans:
Batch Input Direct Input
1. Validations are done based on predefined 1. Validations are done by applications
Function Module
2. We cannot send the fields according to 2. Fields can be send (our requirement)
Our requirement
Ashok
SAP-ADV ABAP 207
50.) How do u write a program in session such that it will run the program without going to
SM35 and creates a session?
Ans: SUBMIT RSBDCSUB VIA SELECTION-SCREEN AND RETURN.
Ashok
SAP-ADV ABAP 208
62.) What are the commands available for controlling batch input session?
Ans:
1. /bbeg------- restart transaction
2. /bbdel------ delete transaction from from batch input session
3. /n ----------- terminate current transaction
4. /bda--------- foreground processing
5. /bde--------- display mode to error mode
6. /bend------- end current batch input session
Ashok
SAP-ADV ABAP 209
Ashok
SAP-ADV ABAP 210
Ashok
SAP-ADV ABAP 211
BDC FAQS:
1Q: What should be the approach for writing a BDC program?
Ans:
Analysis the Data
Generate SAP structure
Develop transfer program
Create sequential file
Create batch input program
Process batch input data
4Q: What are the problems in processing batch input sessions? How is batch input process
different from processing on line?
Ans: Sessions cannot be run in parallel and not fast.
5Q: What do you do when the system crashes in the middle of a BDC batch session?
Ans:
Check no. of records already updated and
Delete them from input file and
Run BDC again.
7Q: What are the commands that allow you to process sequential file? What is their syntax?
Ans :-
1. READ DATASET (reading) and
2. TRANSFER (writing)
Syntax:
Ashok
SAP-ADV ABAP 212
OPEN DATASET for < appending=" " output=" "> in mode at POSITION
MESSAGE.
READ DATASET INTO.
CLOSE DATASET.
DELETE DATASET.
TRANSFER to
8Q: What is the process for transferring data from legacy system to SAP?
Ans:
FTP file transfer,
Manufacturer –specific field transfer NFS (network file system) (or) BDC.
9Q: How many types of tables exists and what are they in data dictionary?
Ans:
11Q: Can a transparent table exist in data dictionary but not in the data base physically?
Ans: NO
13Q: Can you create a table with fields not referring to data elements?
Ans: NO.
14Q: What is the advantage of structures? How do you use them in the ABAP programs?
Ans:
Ashok
SAP-ADV ABAP 213
When the first EXTRACT statement occurs in a program, the system creates the extract
dataset and adds the first extract record to it.
In each subsequent EXTRACT statement, the new extract record is added to the dataset.
EXEC SQL.
ENDEXEC.
19Q: What is the meaning of ABAP editor integrated with ABAP data dictionary?
Ans: Area menu
Ashok
SAP-ADV ABAP 214
20Q: What is an interactive report? What is the obvious differences of such report compared
with classical type reports?
Ans:
Interactive reporting allows the user to participate in retrieving and presenting data at
each level during the session.
Gives a basic list form, which the user can call detailed information by positioning the
cursor and entering the commands
Classical reports consists of one program the creates a single list which contains
clustered data requested, regardless of the details the user wants to see.
25Q: How are the date and time field values stored in SAP?
Ans: SY-DATUM & SY-UZEIT
4. FNAM
5. FVAL
31Q: What are the function modules associated with batch input?
Ans :-
1. BDC_OPEN_GROUP ,
2. BDC_CLOSE_GROUP ,
3. BDC_INSERT
Ashok
SAP-ADV ABAP 216
34Q: How do you find the transaction number, program number and field names?
Ans :-
Transaction no., Program no –
System -> status
Field names - F1,
Technical help
36Q: What are the available OK Codes that can be utilized during batch input processing?
Ans :-
/n –-------- terminates current batch input transaction and marks as incorrect.
/bdel –---- delete current batch input transaction from session.
/bend –----- terminate batch input processing and mark session as incorrect.
/bda –------ change display mode to process the session on screen instead of displaying only
errors.
/bde –------ change display mode to display only errors instead of processing the session on the
screen.
37Q: What is the effect of the BDC_CURSOR field name in the BDC table?
Ans :-
You can set the cursor and enter as a corresponding field value the name of the field on which
the cursor is to be positioned
Ashok
SAP-ADV ABAP 217
43Q: Give real time work done by u in BDC ? Transactions used ? parameters passed with
functions?
Ans:
44Q: Will ask u for screen no's and dynpro names for BDC that u say u have done?
Ans:
45Q: Which technical field in the BDCDATA table holds the last cursor position?
Ans:
48Q: How do you send the BDCDATA table in a Call Transaction statement?
Ans:
Ashok
SAP-ADV ABAP 218
Ashok
SAP-ADV ABAP 219
Ques-2:
What are the common errors you are facing while working with smart forms?
Answer:
9. Incorrect parameter with call function
This exception you will get if you not pass all the parameters which you maintained in smart
form
Ques-3:
How do you work with Alternate option in smart form?
Answer:
Righ click on any one Window (say LOGO)
Create ----- Window Alternate
Right click on Alternate Window
Create ----- Flow Logic ------- Alternate
Conditions option
Field name Relational Operator
LIFNR double click
Form Painter
Adjust Alternate window
Activate form
Ques-4:
How you can work with more than one Page in smart form?
Answer:
Right click on PAGE1
Create ------ Page
Right click on PAGE2
Create ---- Window
Window: LETTER
Meaning: Window for letter description
Save
Right click on LETTER window
Create ----- Text
Ashok
SAP-ADV ABAP 221
Editor
Goto ------ Change Editor
* ,,,,,,,,,,Dear Satya,
* ,,,,,,,,,,Yor are shortlisted in Google as a Technical Consultant
* ,,,,,,,,,,Thanking you,
Back
Double click on MAIN window
Window Type: Secondary Window
Double click on PAGE1
Next Page: PAGE2
Double click on PAGE2
Next Page:______
Activate form
*** Ques-5:
How you can convert a smart form into PDF format?
Answer:
Run your print program
Provide input
Execute
Select Print option (Ctrl + P)
At bottom you will find a print request number note down it (say 11716)
Go to SE38
Program: RSTXPDFT4
Execute
Spool Request: 11716
Execute
Save
Ques-6:
How you can debug a smart form?
Answer:
Go to SMARTFORMS
Form: ZPO_FORM
Change
Expand VENDOR window
Double click on CODE1
Provide BREAK-POINT
Activate form
Go to SE38
Program: ZMM_CALL_SMART_FORM (print program)
Ashok
SAP-ADV ABAP 222
Execute
Note:
In smart forms you can set only Static Break Point. You cannot set Dynamic Break Point
Ques-7:
How you can work with Excel Sheet in smart forms?
Answer:
DATA fnam TYPE STRING.
Ques-8:
How you can print multiple records in smart forms?
Answer:
ZMM_CALL_SMART_FORMN
START-OF-SELECTION.
Ashok
SAP-ADV ABAP 223
LOOP AT S_EBELN.
PERFORM get_data USING s_ebeln-low.
Ashok
SAP-ADV ABAP 224
Ques-9:
How you can migrate SAP Script to smart form?
Answer:
Go to SMARTFORMS
Utilities ---- Migration ----- Import SAP Script Form
Form: ZPO_MEDD
Name: ZPO_MEDD
Enter
Ques-10:
How you can generate smart form into PDF format during runtime of print program?
Answer:
Ques-11:
How you can send of a form in the form of mail?
Answer:
Ques-12:
How you can write code in smart forms?
Answer:
Ques-13:
How you can maintain Page Breaks in smart forms?
Answer:
2.) Difference between 'form interface' and 'global definitions' in global settings of smart
forms?
Ans:
Form Interface is where you declare what must be passed in and out of the smart form (in
from the print program to the smart form and out from the smart form to the print
program).
Global definition is where you declare data to be used within the smart form on a global
scope.
Ashok
SAP-ADV ABAP 225
ie: anything you declare here can be used in any other node in the form.
6.) How do you make sure that both, the SMARTFORM & it's function module gets
transported? (or) Does the FM with same name gets generated automatically in the transported
client?
Ans:
A smart form is transported no differently than any other object.
If it is assigned to a development class that is attached to a transport layer, it will be
transported.
The definition is transported, and when called, the function module is regenerated.
This leads to an interesting situation.
On the new machine, it is very likely the function module name will be different than the
name on the source system.
Make sure, before you call the function module, you resolve the external name to the
internal name using the 'SSF_FUNCTION_MODULE_NAME' function module.
Typically, generate the SF, then use the pattern to being in the interface.
Ashok
SAP-ADV ABAP 226
Then change the call function to use the name you get back from the above function
module.
7.)How to protect lines in the main window from splitting between pages?
Ans:
It was easy with SAP script, but how to do it with SFs
For 4.7 version if you are using tables there are two options for protection against line break
1. You can protect a line type against page break.
2. You can protect several table lines against page break for output in the main area.
8.) What are the differences between SAP Scripts and Smart forms?
Ans:
SAP Scripts are client dependent whereas Smart forms are client independent.
SAP Scripts require a driver program to display the output whereas in smart forms the
form routines can be written so that it is standalone.
An integrated Form Builder helps to design Smart forms more easily than SAP Scripts
A Table Painter and Smart styles to assist in building up the smart forms
On activation a function module is generated for Smart forms
Ashok
SAP-ADV ABAP 227
11.) I have a smart form which works fine in DEV. After transporting it to PROD, there is no
Function module generated for this smart form. As a result my program dumps in PROD?
Ans:
The Smart form that is created in the Development may not have the same name in the
Production server.
So it is always advised to use the Function Module
SSF_FUNCTION_MODULE_NAME
12.) How u write Function Module name by passing the Smart form name?
Ans:
13.) How can I make the Smart forms to choose a printer name by default?
Ans:
Ashok
SAP-ADV ABAP 228
16.) Where can I provide the input parameters to the smart form?
Ans:
The input parameters for the smart form can be defined in Global Settings->Form
Interface.
The Associated Type must be defined in the ABAP Dictionary.
17.) Where can I define my own global types for the smart form?
Ans:
The global types (within the smart form) can be defined in
Global Settings->Global Definitions->Types
The types defined here will be global through the entire smart form.
Also the form routines can be defined Global Settings->Global Definitions->Form
Routines
18.)I have defined my own Program Lines, where I have used a global variable G_TEXT. I get
an error G_TEXT is not defined?
Ans:
Whenever using the global variables in the Program Lines, enter the variable name in
Input Parameters if you are going to use (read) the variable.
If you are going to both read/write the variable value enter the same in Output
Parameters.
19.) I have created a table node for display. Where can I check the condition which must satisfy
to display the table?
Ans:
The conditions can be defined in the Conditions tab.
In smart forms all the nodes have a condition tab where you can specify the condition to
be satisfied to access the node.
20.) How can I define Page Protect in Smart forms?
Ans:
To define Page Protect for a node go to the Output options and check the Page Protection
checkbox.
Ashok
SAP-ADV ABAP 229
21.) What is the difference between Template and Table in Smart forms?
Ans:
The Template contains a fixed number of rows and columns, where the output is fixed.
The Table can have variable number of rows
22.) Where can I define the paragraph and character format for the smart forms?
Ans:
The paragraph and character format for the smart forms can be defined in the transaction
SMARTSTYLES
23.) How to add buttons and radio buttons etc in smart forms?
Ans:
Buttons is not possible in smart forms (only in adobe forms it is possible).
But you can insert checkboxes and radio buttons in smart forms.
You can print a check box in different ways..
By inserting symbols and making window as check box..
Once go through the thread u will get to k now different ways
Ashok
SAP-ADV ABAP 230
Faqs in Smartforms:
1.) What is the difference b/w Scripts and Smartforms?
2.) What is the diff b/w Table and a Template? In which requirements do u prefer table and in
which cases u prefer template?
3.) How u can debug smartforms?
4.) How u can migrate scripts into smartforms?
5.) How u can convert scripts or smartforms into pdf format?
6.) How u can print signature in last page in smartforms?
7.) How u can apply control break functionality in smartforms?
8.) What is the functionality of :
a.)Loop
b.)Alternate
c.)Command
d.)Graphic
e.)Program lines
in smartforms. Given explanation with a real time example?
Ashok
SAP-ADV ABAP 231
Example:
Go to SE93
Transaction Code: VA01
Display
Double click on Program Name
You will find a spot given by SAP
Enhance
Right click ES_SAPMV45A
Enhancement Implementation ----Create Implementation
Ques-3: What is the difference between Enhancement spot (point) & Enhancement section?
Answer:
In enhancement spot both customized & standard code will be executed
In enhancement section only customized code will be executed
Ashok
SAP-ADV ABAP 232
Ashok