Escolar Documentos
Profissional Documentos
Cultura Documentos
ABAP TUTORIAL
SAP (Systems Applications and Products in Data Processing)
Production
Purchasing
Ware house
FI/CO
Manufacturing
Company
Shipping
HR
Sales &
Distribution
ERP:Enterprise
Big Company
Resource
Money
Men
Machine
Material
Marketing
Planning
Well utilization of resources
RAMCO
PEOPLE SOFT
ORACLE APPS
SAP
ERP: It provides predefined tables.
It provides predefined application programs.
No need to creating & maintaining tables.
No need to write the programs for fetches the data from database.
BAAN:Nearly 90% of database tables & source code are related to customers &
vendors, so it is suitable for small size & mid size companies.
E.g.: Vijaya Electronics.
RAMCO:Nearly 80% of database tables & source code are related to the
finance. Hence it is suitable for financial companies. So, it is also suitable for small
size and mid size companies.
E.g.: Any automobile company.
People soft:This is good for HR department but weak in relationship with other
departments (like Production, Purchasing, Warehouse, FI/CO, Shipping, Sales
and Distribution).
SAP:SAP is good for all modules but weak in FI/CO and HR departments
when compared with PEOPLE SOFT and ORACLE APPS.
Enterprise Portal: - It is used for integrating with one module to another module.
SAP can integrate with People Soft and Oracle Apps and so on.
ADVANTAGES OF SAP: It is tightly (or) closely integrated across all the modules (or) departments.
SAP is platform independent irrespective of all Operating System
(Windows, Linux, UNIX etc...)
SAP is a ready made product, which is developed in 1972 with five IBM
employees in Germany. Customization is done within a minimum effort.
SAP contains Cross Applications, so that exchange the data from one
system to another system.
CROSS APPLICATION (CA): ALE (Application Link Enabling) is an SAP technology to support cross
application.
ALE uses Idoc to support the transformation.
Note:
Before coming the ALE, SAP uses the EDI (Electronic Data
Interchange).
Idoc is Intermediate Document to carry the data.
SAP
System
Idoc
SAP
System
Idoc
Idoc
XI
Non SAP
System
Xml
TIBCO
Middleware Converters
INTRODUCTION
01/06/10
Mathematical Operators.
Comparative Operators.
Relational & Logical Operators.
Mathematical Operators:Operator
+
-
Description
Addition
Subtraction
Example
2+3=5
3-2=1
*
**
/
Mod (%)
Multiplication
Exponential
Division
Remainder
2*3=6
2**3=2^3=8
4/2=2
3%2=1
Comparative Operators:Operator
< Or LT
<= Or LE
Description
Less than
Less than or
Equal to
> Or GT
Greater than
>= Or GE
Greater than or
Equal to
= Or EQ
Equal to
<> Or NE
Not equal
Relational & Logical Operators:Operator
AND
OR
NOT
Description
and
or
not
Example
a < b or a LT b
a <= b or a LE b
a > b or a GT b
a >= b or a GE b
a = b or a EQ b
a<>b or a NE b
Example
a<b and a<c
a<b or a<c
If you want to comment the entire line then we place * at the first
Column of the line.
E.g.: * Addition of two numbers.
In ABAP:
DATA A Type I.
DATA B Type I.
DATA C Type I.
A=10.
B=20.
C=A+B.
Write C.
DATA: A Type I,
B Type I,
C Type I.
A=10.
B=20.
C=A+B.
Write:Total is, C.
02/06/10
In C
Int a, b, c;
Scanf (%d, %d, &a, &b);
C=a+b;
Printf (%d, c);
in ABAP
Parameter: A Type I,
B Type I.
DATA C Type I.
C = A + B.
Write C.
NOTE:1. The name of the parameter should not exceed 8 character length.
2. The parameter cannot accept data type F.
3. DEFAULT is the keyword which is used to assign the default values to the
parameter variables.
Syntax:Parameter <variable name> Type <DT> default <value>.
E.g.: parameter A Type I default 10. ( is your wish for integers).
4. OBLIGATORY is the keyword which is used to provide the input field as
mandatory field.
Syntax:Parameter <variable name> Type <DT> obligatory.
E.g.: parameter A Type I obligatory.
Structure of an ABAP program:-
Header
Declarations
Business Logic
Definition of Reusable Blocks
Constants
*. CONSTANTS is the declare
Keyword to declare the Variables.
Syntax:Constants <vn> Type <DT>value<value>
E.g.: Constants A Type I value 10.
*.constants variables values never value
Change with in the program.
Business Logic:In ABAP business logic is retrieving/to get the data from a
database & display it in a predefined format.
Reusable Blocks:<procedure/functions>
Common terminology
SQL: Structured Query Language.
<subroutines>
In ABAP
SQL
DDL
(Data Definition Lang)
It is used to create the
table as well as alter
the tables.
DML
(Data manipulation Lang)
1. Insert
2. Update
3. Modify
4. Delete
DCL
(Data Control Lang)
1.Commit work
2.Rollback work
E.g.:
Data type
Length
Short description
E_ID
E_Name
E_Add
char
char
char
10
25
35
Employee Id.
Employee name.
Employee address.
NOTE: Each table must have atleast one field as a primary field that should be the
character data type & that should be first field in the table.
Save the table. (Ctrl + s).
Check the table (ctrl + F3).
Click on technical settings
1. Provide data class (APPL0, APPL1 ).
2. Select the size category (0).
3. Save the technical settings.
4. Come back.
Activate the table.
Steps to provide the data to the table:
Steps to display the data: In the menu bar utilities table contents display.
Click on execute (F8).
NOTE:1. If you want to provide the data to the table manually then we must
select table maintenance allowed.
2. We can provide up to 16 primary keys per a table.
Field
E_ID
Data type
char
Length
10
Short description
Domain
Data element
Domain:-
04/06/10
Bottom-up Approach
Bottom-up Approach:-
Top-down Approach
Eid
Ename
Eadd
YSPRAO_730_EMP
Field name
Eid
Domain
C
10
Data element
YSPRAO_730_Eid
Employee id
YSPRAO_730_Eid YYSPRAO_730_EMP
Ename
C
25
YSPRAO_730_Ename
Employee name
YSPRAO_730_Ename YYSPRAO_730_Ename
C
35
YSPRAO_730_Eadd
Employee address
Eadd
YSPRAO_730_Eadd
YYSPRAO_730_Eadd
Steps to create the Emp table by using Top-down approach data type
element: Execute SE11.
Select the radio button database table.
Provide your table name (YSPRAO_730_Emp1).
Click on create enter.
Provide any short meaningful description (Emp table by using Top-down
approach).
Provide delivery class (a).
Select the maintenance allowed.
Click on the fields tab.
Provide the field name (Eid) & data element name which is not there
(ZZSPRAO_730_Eid).]
Double click on the data element save before editing yes local object
cerate the data element yes.
Provide a meaningful description.
Provide domain name which is not created (ZSPRAO_730_Eid).
Double click on domain save before editing yes local object yes.
Provide a short description, data type & length.
Eid
ZZSPRAO_730_Eid
Data element ZZSPRAO_730_Eid
Short description Employee id
Domain ZSPRAO_730-Eid
Domain
Short description
Data type Char
Length
10
NOTE:1. In the real time always create the table by using data element type,
because if we want to establish the relationship between any two
tables we need common domain name in both the tables.
2. In the Direct/built-in type there is no domain concept.
Foreign Key Relationship:-
05/06/10
Foreign key is a field in one table i.e., connected
with another table via, foreign key relationship. The purpose is to validate the data
being entered in one table (foreign key table) by checking against list of possible
values in another table i.e., check table.
Check table
Eid
Ename
1.
2.
3.
4.
Sai
Raj
Tej
Ram
Eid
Esal
Technical requirements to establish the primary & foreign key relationship: The domain name of the both the fields in both the tables must be the same.
The check table field must be the primary field.
Steps to establish the Foreign key relationship: Execute SE11.
Select the radio button database table.
Provide your foreign key table name.
Click on change mode.
Select the field (for which field we want to establish foreign key
relationship).
Click on foreign key icon.
Provide your check table name.
Click on generate proposal.
Enter.
Save the table.
Check the table.
NOTE:1. T006 is the standard database table which contains all the unit of
measurement (UOM).
2. TCURC is the standard database table which contains all the
currencies.
3. If you want to display the particular filed information click on
contents in the menu bar settings format list choose fields
select your required fields enter execute.
INTERNAL TABLES
07/06/10
Program:Eid
C
DATA: Begin of Emp,
Eid (10) Type C,
Ename (25) Type C,
Eadd (35) Type C,
End of Emp.
Emp
Ename
10 C 25
Eadd
C 35
Indexed
Standard
Hashed
Sorted
08/06/10
If you want to declare all the fields from any one of the
database table.
Syntax:DATA: Begin of <WA name>.
Include Structure <Db table name>.
DATA End of <WA name>.
DATA <IT name> like table of <WA name>.
E.g.:
WA_T001 BUKRS BUTXT ORT01
DATA: Begin of WA_T001.
Include Structure T001.
DATA End of WA_T001.
DATA IT_T001 like table of WA_T001.
IT_T001 BUKRS BUTXT ORT01
By default TABLES keyword creates one WA with the name of database table
name & also contains all the fields in database table.
Declaring the internal table with header line by using OCCURS keyword.
Syntax:DATA: Begin of <IT name> occurs 0,
List of fields/ internal structure,
End of <IT name>.
E.g.:
DATA: Begin of IT_T001 occurs 0,
BUKRS like T001-BUKRS,
BUTXT like T001-BUTXT,
ORT01 LIKE T001-ORT01,
End of IT-T001.
Here IT_T001 acts as an internal table with header line, i.e., it creates one
work area with the name of internal table name i.e., IT_T001.
Declaring the internal table with header line by using Types keyword.
Syntax:Types: Begin of <Type name>,
List of fields,
End of <Type name>.
Data <IT name > Type table of <Type name> with header line.
E.g.:
IT_T001 BUKRS BUTXT ORT01
09/06/10.
1. Clear.
2. Refresh.
3. Free.
Clear:Clear always used to clear the contents of the work area only.
Syntax:Clear < work area name >.
E.g.:
Clear WA_T001.
WA_T001 BUKRS BUTXT ORT01
1000
TCS
HYD
After Clear
E.g.:
NOTE:-
E.g.:
1. In the real time, we never use clear to clear the contents of internal
table.
2. If we are working with internal table with header line then the name of
he work area as well as the name of the internal table are same, in this
situation also clear clears the contents of the work area.
3. If you want to clear the contents of the internal table then we use []
to the internal table.
Clear IT_T001.
IT_T001 BUKRS BUTXT ORT01
Clear IT_T001 [].
IT_T001 BUKRS BUTXT ORT01
1000
TCS
2000
IBM
3000
HCL
After Refresh
HYD
CHE
BAN
NOTE:If we are working with internal table with header line then the name of
work area as well as the name of the internal table are same, in this situation also
refresh clears the contents of the internal table only.
KIND
T
(Standard)
Num of records
available in the
internal table.
LINES
S
(Sorted)
H
(Hashed)
Kind:Kind is the keyword which returns the type of the internal table.
If it is a standard internal table then it returns T.
Single record
Multiple record
READ
LOOP AT
Modify the internal table by using MODIFY keyword.
Delete the data from the internal table by using DELETE keyword (other than
clear, refresh).
E.g.:
Retrieving the data from database table & placing it into internal table:10/0610.
1.
2.
HCL
CAPTAMI
NI
ORT01
HYD
CHE
MUM
BAN
PUN
Read table <IT name> into <WA name> with key <condition>.
Read table IT_T001 into WA_T001 with key BUKRS=4000.
Reading multiple records from the internal table by using loop at keyword:Syntax:-
E.g.:
Endloop.
Modify the internal table by using MODIFY keyword:
If you are not mentioning any condition then it deletes the data entirely in the
internal table.
Sort the data in the internal table:Syntax:
If we have two similar internal tables, if you want to move the data from one
internal table to another.
Syntax:<IT2> = <IT1>.
If you want to append the data from first internal table to second.
Syntax:-
If
Case
Looping
If:Syntax:If <condition>.
Block of statements.
Else/elseif <condition>.
Block of statements.
Do
Endif.
E.g.:
Case:Syntax:-
E.g.:
Note:-
In the real time we always use case instead of nestedif, because case is
faster as well as clear than if.
While:Syntax:While <condition>.
Block of statements.
Endwhile.
Do:Syntax:Do <num of times>.
Block of statements.
Enddo.
Note:In the real time we always use while instead of do, because while is faster
than do.
Open SQL:-
11/06/10.
Open SQL
DDIC
DML
DCL
(Data Dictionary) (Data manipulation language) (Data control language)
This is used to
1. Insert.
1. Commit work.
create the tables as
2. Update.
2. Rollback work.
well as alter the tables.
3. Modify.
4. Delete.
Note:1. Open SQL is used to work with databases not with internal tables.
2. Insert, Update, Modify & Delete a single record in to the database table is
always through work area & multiple records through internal table.
3. When ever we are working with database tables then we must declare the
structure of work area as well as structure of the internal table as similar as
database.
Insert single record:Insert inserts a record in to the database table if there is no
match found in the database based on the key field. Otherwise it ignores the
records.
Syntax:Insert < DB table name > from < WA name >.
E.g.:
Data WA_T001 like T001.
WA_T001-BUKRS = 0786.
WA_T001-BUTXT = SP RAO TECH.
WA_T001-ORT01 = CHE.
WA_T001-LAND1=IN.
Insert T001 from WA_T001.
If sy-subrc= 0.
Write: / inserted successfully.
Else.
Write: / nit inserted.
Endif.
Insert (multiple records):Insert inserts the multiple records in to the database
table if there is no match found in the database table for all records in the internal
table based on the key field. If at least one record is matched then it ignores all the
records in the internal table as well as terminates the entire transaction.
Syntax:Insert < DB table name > from table < IT name >.
E.g.:
Data WA_T001 like T001.
Data IT_T001 like table of WA_T001.
WA_T001-BUKRS = 0998.
WA_T001-BUTXT = RAM TECH.
WA_T001-ORT01 = CHE.
Append WA_T001 to IT_T001.
WA_T001-BUKRS = 1000.
WA_T001-BUTXT = RAGHU TECH.
WA_T001-ORT01 = MUM.
Append WA_T001 to IT_T001.
Insert T001 from table IT_T001.
Note:If you want to avoid the termination of the program then we use accepting
duplicate keys in the syntax of insert.
Syntax:Insert <DB table name> from table <IT name> accepting duplicate
keys.
The above statement avoids the termination of the program as well as inserts the
non-duplicate records & ignores the duplicate records.
Note:SY-DBCNT is the system variable which returns number of records
successfully inserted in to the database table.
Update (single record / over write):Update updates the data in to the database;
if there is a match found in the database based on the key field otherwise it ignores
the record.
Syntax:Update <DB table name> from <WA name >.
Note:In this case, we must pass changed information along with old information
in the work area.
E.g.:
Data WA_T001 like T001.
WA_T001-BUKRS =0786.
WA_T001-BUTXT = SPRAO TECH.
WA_T001-ORT01 = MUM.
Update T001 from WA_T001.
Update particular column:Syntax:Update <DB table name> set <field1> = <value> <field2> = <value>
.. Where <condition>.
E.g.:
Update T001 set ORT01 =CHE where BUKRS= 0786.
Modify: Modify acts like update if there is a match found in the database based on the
key field otherwise it acts like insert.
Modify never fails.
Syntax:1.
2.
E.g.:
Data: WA_T001 like T001,
IT_T001 like table of T001.
WA_T001-BUKRS = 1000.
WA_T001-BUTXT = TCS.
WA_T001-ORT01 = CHE.
Append WA_T001 to IT_T001.
WA_T001-BUKRS = 0999.
WA_T001-BUTXT = VENKI.
WA_T001-ORT01 = HYD.
Append WA_T001 to IT_T001.
Modify T001 from table IT_T001.
Delete:Delete deletes the data from the database based on condition.
Syntax:E.g.:
Commit work:-
12/06/10.
This command is used to commit the database after changed
happen in the database.
Syntax:Commit work.
Rollback work:This command is used to undo the database operations.
Syntax:Rollback work.
Select-options:Select-options is a keyword which accepts single value,
multiple single values, single range, multiple single ranges.
Syntax:Select-options <name of the select-options> for <variable name>.
E.g.:
Data V1 like T001-BUKRS.
Select-options S_BUKRS fro V1.
S_BUKRS
to
Note:The name of the select-options acts as an internal table with header line. i.e.,
the name of the work area as well as the name pf the internal table is the similar
name of the select-options.
Components/ fields of the select-options:1. Low the low value of the select-options.
2. High the high value of the select-options.
3. Sign include (I) or exclude (E).
4. Option between (BT) or not between (NB)
Equal (EQ) or not equal (NE).
Note:The name of the select-options should not exceed 8 character length.
Sign=I
Sign=I
Option=BT
Option=N
1000<=x<=2000
x<=1000
x=>2000
1000---------2000
Sign=E
Option=BT
1000<x<2000
Sign=E
Option=N
x<1000
x<2000
----1000-----2000
----1000-----2000----Note:By default select-options contain sign is include option is between.
table
Note:In the real time when ever we are working with company code, if it is only
one company then we remove the extension and the interval.
Some of the standard database tables:MARA:- Material master table
1. MATNR Material number.
2. MTART Material type. (Material type means raw material, semi material,
finished material)
3. MATKL Material group.
4. BISMT Old Material.
5. MEINS UOM.
Inner join pick the data from both the tables if and only if there is one
or more than one entry is available in right hand side table with corresponding left
hand side table.
E.g.:
T001 BUKRS
Output:-
1000
3000
4000
4000
4000
BUTXT
1000
1000
3000
4000
4000
4000
KNB1 BUKRS
116
241
171
991
997
1020
KUNNR
TCS
116
HCL 171
HP
991
HP
997
HP
1020
14/06/10.
MARA
MATNR
MTART
MAKT
MATNR
MAKTX
EKKO
EBELN
LIFNR
BSART
EKPO
EBELN
EBELP
MENGE
MEINS
NETPR
Assignment:-
NAME1
AKONT
BANKS
KNA1
KUNNR
NAME1
KNB1
AKONT
KUNNR
BUKRS
KNBK
KUNNR
BANKS
BANKL
BANKN
BANKL
BANKN
Left outer join:Left outer join pick the data from left-hand side table even
though there is no match found in the right-hand side table.
E.g.:
T001 BUKRS BUTXT KNA1 BUKRS KUNNR
1000
TCS
2000
IBM
3000 1000HCL 116
4000 1000HP 241
5000 3000CSE 761
4000
991
4000
997
Output:4000
1020
1000
TCS
116
1000
TCS
241
2000
IBM
..
3000
HCL
761
4000
HP
991
4000
HP
997
4000
HP
1020
5000
CSE
..
In the above examples remove the inner join & place the left outer join.
Reports:
15/06/10.
Parameter <name of the radio button> radio button group <group name>.
E.g.:
Parameter: P_MALE radio button group G,
P_FEMALE radio button group G.
Selection-screen Design:Data V1 like T001_BUKRS.
Selection-screen begin of block B with frame title text-001.
Select-options S_BUKRS for V1.
Parameter: P_Dis as check box,
P_Non Dis as check box.
Selection-screen end of block B.
Output:Selection-criteria
S_BUKRS
to
Display
Non Display
Note: If you want to provide the meaningful txt to the input variable, then you
go to; menu bar go to text elements selection texts.
Select the check box, if the field is coming from data dictionary,
otherwise we pass the input manually.
Save the text.
Activate the text.
Back.
Note:If we are working with Begin of line & End of line then the name of the
parameters will disappear, at that time we must provide comment before or after
the check box or radio button.
Syntax of providing a comment:Selection-screen comment X(Y) text-<no>.
Starting num of
Position characters
Note:-
Skip is the keyword to provide the space in between any two input
variables.
Syntax:Selection-screen skip <no>.
to
Non Display
SPRAO EDU
RAJ EDU
..
Note:We can have only one basic list & up to 20 secondary lists.
SY-LSIND is the system variable which contains the current list index
number.
Events in Classical reports:-
16/06/10.
Events in classical reports are
1.
2.
3.
4.
5.
6.
7.
Initialization.
At selection-screen.
At selection-screen on.
Start-of-selection.
Top-of-page.
End-of-page.
End-of-selection.
3
start-ofSelection
Top-of-page
5
End-ofselection
4
6
End-of-page
S_BUKRS-high = 2000.
S_BUKRS-sign = I.
S_BUKRS-option = BT.
Append S_BUKRS.
S_BUKRS-low = 3000.
S_BUKRS-high = .
S_BUKRS-sign = I.
S_BUKRS-option = EQ.
Append S_BUKRS.
Message:1.
2.
3.
4.
5.
Execute SE91.
Provide your message class.
Click on create.
Provide short description.
17/06/10.
4. ZMENG quantity.
5. MEINS UOM.
6. NETWR Net value.
At selection-screen:Validation:E.g.:1.
2.
Click on save.
Provide the variant name & description.
Save.
Note:If you want to avoid the title in the displayed output then we must NO
STANDARD PAGE HEADING in the name of the report.
Object:Based on the given company codes to display the company codes,
company names, names & cities by using events, in the top always display
the welcome to sprao technologies in the bottom to display thank you.
Program:DATA V1 LIKE T001-BUKRS.
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME
TITLE TEXT-001.
SELECT-OPTIONS S_BUKRS FOR V1.
SELECTION-SCREEN END OF BLOCK A.
DATA: BEGIN OF WA_T001,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
ORT01 LIKE T001-ORT01,
END OF WA_T001.
DATA IT_T001 LIKE TABLE OF WA_T001.
AT SELECTION-SCREEN.
SELECT BUKRS FROM T001 INTO V1 UP TO 1 ROWS WHERE
BUKRS IN S_BUKRS.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E000(YSMSG) WITH 'INVALID COMPANY'.
ENDIF.
START-OF-SELECTION.
SELECT BUKRS BUTXT ORT01 FROM T001 INTO TABLE
IT_T001 WHERE BUKRS IN S_BUKRS.
TOP-OF-PAGE.
WRITE 'WELCOME TO SAP'.
END-OF-PAGE.
WRITE 'THANK YOU'.
END-OF-SELECTION.
LOOP AT IT_T001 INTO WA_T001.
WRITE :/ WA_T001-BUKRS, WA_T001-BUTXT, WA_T001ORT01.
ENDLOOP.
Events in interactive reports:1. At line-selection.
2. At user-command.
3. Top-of-page during line-selection.
4. At PF<N>.
5. SET PF-STATUS.
At line-selection:At line-selection is an event which is triggered at the time of
user clicks on any record of any list.
At user-command:It is an event which is triggered at the time of user clicks on
any menu item.
Top-of-page during line-selection:It is an event which is triggered at the top of
each secondary list.
At PF<N>:It is an event which is triggered at the time of user clicks on any
function keys (F1 to F12).
Set PF-Status:It is an event which is used to attach the own GUI to the program.
5. SY-LSIND.
SY-LISEL:It is the system variable which contains the contents of the selected
record.
SY-LILLI:It is the system variable which contains the exact line number of the
selected record by the user.
SY-UCOMM:It is the system variable which contains the function code of the
selected menu item.
SY-LINNO:It is the system variable which contains the line number of the last
record displayed.
SY-LSIND:It is the system variable which contains the current list index number.
Interactive reports supports the user interaction is always through double
click or F2.
When ever the user double clicks on any record of any list at line-selection
event will be triggered & list index will be incremented by one.
If you want to retrieve the data for this list we should know the record which
is clicked by the user in the previous list.
Hide:Hide is the keyword which maintains the copy of the previous list with
output line numbers & their contents. When ever the user double clicks on any
record of any list at that time at line-selection event will be triggered & list index is
incremented by one & that particular record will be moving from hide area to work
area.
Based on the work area we retrieve the data for the
next list.
Note:Hide always maintain after the write statement.
Object:To display the company codes, company names & cities in the basic
list, when ever the user clicks on any record then we display the customer
under that company in the first secondary list. When ever the user clicks on
any record in the first secondary list then we display the customer list in the
second secondary list.
Program:DATA: BEGIN OF WA_T001,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
ORT01 LIKE T001-ORT01,
END OF WA_T001.
DATA IT_T001 LIKE TABLE OF WA_T001.
DATA: BEGIN OF WA_KNB1,
BUKRS LIKE KNB1-BUKRS,
KUNNR LIKE KNB1-KUNNR,
AKONT LIKE KNB1-AKONT,
END OF WA_KNB1.
DATA IT_KNA1 LIKE TABLE OF WA_KNA1.
DATA: BEGIN OF WA_KNA1,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
ORT01 LIKE KNA1-ORT01,
END OF WA_KNA1.
DATA IT_KNA1 LIKE TABLE OF WA_KNA1.
SELECT BUKRS BUTXT ORT01 FROM T001 INTO TABLE
IT_T001.
LOOP AT IT_T001 INTO WA_T001.
WRITE: / WA_T001-BUKRS, WA_T001-BUTXT, WA_T001ORT01.
HIDE: WA_T001-BUKRS, WA_T001-BUTXT, WA_T001-ORT01.
ENDLOOP.
AT LINE-SELECTION.
IF SY-LSIND = '1'.
18/06/10.
CONVERSION_EXIT_ALPHA_INPUT is the functional module which
is used to append zeros to the input variable based on the length of the input
variable.
E.g.:
DATA A (5) TYPE C.
A=231.
CONVERSION_EXIT_ALPHA_INPUT
INPUT = A.
OUTPUT = A.
A 00231.
Steps to call the function module: Open the program.
Place the cursor where we want to call the function module.
Click on pattern.
Provide your function module name.
CONVERSION_EXIT_ALPHA_INPUT
Enter
ENDLOOP.
AT LINE-SELECTION.
IF SY-LSIND = '1'.
SELECT LIFNR BUKRS AKONT FROM LFB1 INTO TABLE
IT_LFB1 WHERE BUKRS =SY-LISEL+0(4).
LOOP AT IT_LFB1 INTO WA_LFB1.
WRITE: / WA_LFB1-LIFNR, WA_LFB1-BUKRS, WA_LFB1AKONT.
ENDLOOP.
ELSEIF SY-LSIND = '2'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT
= SY-LISEL+5(10)
IMPORTING
OUTPUT
= SY-LISEL+5(10).
SELECT LIFNR NAME1 ORT01 FROM LFA1 INTO TABLE
IT_LFA1 WHERE LIFNR = SY-LISEL+5(10).
LOOP AT IT_LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1ORT01.
ENDLOOP.
ENDIF.
19/06/10.
In the above two techniques generates the next list based on the lineselection, not based on field-selection.
If you want to generate the next list based on the field selection then we go
for Get cursor technique.
Syntax:Get cursor field <variable 1> value <variable 2>.
Note:Get cursor technique returns the field name as well as field value which is
selected by the user.
GUI title
GUI status
Title bar
Menu bar
STD tool bar
Function keys
Application tool bar
Note:1.
2.
3.
4.
21/06/10.
Inner join pick the data based on the ON condition first, next it
based on WHERE condition.
In the real time the maximum program execution tome in fore-ground is
600sec.
More than two tables join, some times leads to timeout, so we go for FOR
ALL ENTRIES.
For all entries pick the data based on WHERE condition first, next it based
on ON condition.
Object:Based on the given company codes to display the company codes,
company names, customer numbers.
Program:-
WA_FINAL-BUTXT = WA_T001-BUTXT.
APPEND WA_FINAL TO IT_FINAL.
CLEAR: WA_FINAL, WA_T001, WA_KNB1.
ENDLOOP.
WRITE: 1(5)'BUKRS', 7(28)'BUTXT', 25(5)'KUNNR'.
SKIP.
LOOP AT IT_FINAL INTO WA_FINAL.
WRITE: / WA_FINAL-BUKRS, WA_FINAL-BUTXT, WA_FINALKUNNR.
ENDLOOP.
Object:Based on the given purchasing document number to display the
document number, document type, vendor number, item number & price.
Program:DATA V1 LIKE EKKO-EBELN.
SELECT-OPTIONS S_EBELN FOR V1.
DATA: BEGIN OF WA_EKKO,
EBELN LIKE EKKO-EBELN,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF WA_EKKO.
DATA IT_EKKO LIKE TABLE OF WA_EKKO.
DATA: BEGIN OF WA_LFA1,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF WA_LFA1.
DATA IT_LFA1 LIKE TABLE OF WA_LFA1.
DATA: BEGIN OF WA_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
NETPR LIKE EKPO-NETPR,
END OF WA_EKPO.
DATA IT_EKPO LIKE TABLE OF WA_EKPO.
ENDLOOP.
LOOP AT IT_FINAL INTO WA_FINAL.
WRITE: / WA_FINAL-EBELN, WA_FINAL-BSART, WA_FINALLIFNR, WA_FINAL-NAME1,
WA_FINAL-EBELP, WA_FINAL-NETPR.
ENDLOOP.
Object:-
22/06/10.
Based on the given sales document number to display the sales
document number, document type, customer number, customer name, item number,
material number, material description & net value.
Program:INCLUDE YSAI_INCLUDE1.
DATA: BEGIN OF WA_VBAK,
VBELN LIKE VBAK-VBELN,
AUART LIKE VBAK-AUART,
KUNNR LIKE VBAK-KUNNR,
END OF WA_VBAK.
DATA IT_VBAK LIKE TABLE OF WA_VBAK.
DATA: BEGIN OF WA_KNA1,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
END OF WA_KNA1.
DATA IT_KNA1 LIKE TABLE OF WA_KNA1.
DATA: BEGIN OF WA_VBAP,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
NETWR LIKE VBAP-NETWR,
MATNR LIKE VBAP-MATNR,
END OF WA_VBAP.
DATA IT_VBAP LIKE TABLE OF WA_VBAP.
DATA: BEGIN OF WA_MAKT,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF WA_MAKT.
Macros
Functionality
Subroutines Function module
Macros:-
23/06/10.
If you want to access the block of statements more than once in a
program, then we place those statements in the definition of the macro.
Macros are used to perform the arithmetical operations.
Macros can take up to 9 place holders. (&1, &2. &9).
Syntax of defining the Macro:Define <name of the macro>.
----------Business logic.
-----End-Of-Definition.
Syntax of calling the Macro:<Macro name> <list of place holders>.
Note:In the macros, definition should be the first & the calling should be the next.
E.g.:
1.
2.
END-OF-DEFINITION.
ZCAL 15 * 10.
WRITE RESULT.
ZCAL 15 + 10.
WRITE RESULT.
Multiple records using macros:DATA: BEGIN OF EMP,
EID (10) TYPE C,
ENAME (25) TYPE C,
EADD (35) TYPE C,
END OF EMP.
DATA EMP1 LIKE TABLE OF EMP.
DEFINE FILL.
EMP-EID = &1.
EMP-ENAME = &2.
EMP-EADD = &3.
APPEND EMP TO EMP1.
END-OF-DEFINITION.
FILL 1 SPRAO SANATH NAGAR.
FILL 2 RAJ BEGUMPET.
FILL 1 SANDEEP BEGUMPET.
LOOP AT EMP1 INTO EMP.
WRITE: / EMP-EID, EMP-ENAME, EMP-EADD.
ENDLOOP.
Note:We cannot nest the definition of the macro (with in a macro we cant write
another macro).
In the real time macros are used in HR ABAP (HR ABAP use INFOTYPE).
Sub-Routine:Sub-routines are procedures that can be defined in any ABAP
program and call from the same/other ABAP program.
Syntax of defining the Subroutine:Form <name of the subroutine> using <IV1> type <DT> <IV2> type
<DT>. Changing <OV1> type <DT> <OV2> type <DT>.
----------Business logic
-----End form.
IV- input variable, OB- output variable, DT- data type.
Syntax of calling the Subroutine:Perform <name of the subroutine> using <input1><input2>. Changing
<output1><output2>..
Note:1. In the subroutine calling should be the first & definition should be the next.
2. We cannot place any executable statement after the definition of the
subroutine.
DATA RESULT TYPE I.
PARAMTER: P_INPUT1 TYPE I,
P_INPUT2 TYPE I.
PERFORM ADD USING P_INPUT1 P_INPUT2 CHANGING
RESULT.
WRITE RESULT.
FORM ADD USING A TYPE I B TYPE I CHANGING C TYPE I.
C = A + B.
ENDFORM.
E.g.:
DATA: BEGIN OF WA_T001,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
END OF WA_T001.
DATA IT_T001 LIKE TABLE OF WA_T001.
SELECT BUKRS BUTXT ORT01 FROM T001 INTO TABLE
IT_T001.
PERFORM READ-DATA USING IT_T001 4 CHANGING
WA_T001.
WRITE: / WA_T001-BUKRS, WA_T001-BUTXT, WA_T001ORT01.
24/06/10.
Subroutine normally ends with ENDFORM if
we want to terminate the subroutine earlier then we use EXIT or CHECK
commands.
EXIT is used to terminate the subroutine unconditionally.
CHECK is used to terminate the subroutine conditionally.
E.g.:
DATA R TYPE I.
PERFORM ZDIV USING P_INPUT1 P_INPUT2 CHANGING R.
WRITE R.
FORM ZDIV USING A TYPE I B TYPE I COMING C TYPE I.
CHECK B <> 0.
C = A + B.
ENDFORM.
Differences between Macros & Subroutines:Macros
1. In macro definition should be the
first & the calling should be the next.
2. The definition of the macro as
well as the calling of the macro in
the same program.
3. Macros can take up to 9 place
holders.
4. We can place any executable
statements after the definition of the
macro.
5. Macros are used in HR ABAP.
Subroutines
1. In subroutine calling should be the
first & definition should be the next.
2. The definition of the subroutine as
well as the calling of the subroutine
may or may not be in the same
program.
3. Subroutines can take any number
of place holders.
4. We cant place any executable
statements after the definition of the
macro.
5. Subroutines are used in both
ABAP & HR ABAP.
Global data:Subroutines can access the global declarations in which they are
defined.
When ever the changes occurred in the subroutine those changes will be reflected
to global declarations.
Note:LOCAL is the keyword to avoid the changes in subroutines.
E.g.:
TABLES T001.
T001-BUKRS = 1000.
T001-BUTXT = TCS.
T001-ORT01 = HYD.
PERFORM ZGLOBAL.
WRITE: / T001-BUKRS, T001-BUTXT, T001-ORT01.
FORM ZGLOBAL.
LOCAL T001.
T001-BUKRS = 2000.
T001-BUTXT = IBM.
T001-ORT01 = MUM.
WRITE: / T001-BUKRS, T001-BUTXT, T001-ORT01.
ENDFORM.
Function module:-
Subroutines
FM1
FM2
FM3
FG
Note:We can test the function module independently without calling the function
module.
Steps to create Function group: Execute SE37.
In the menu bar goto function groups create group.
Provide your function group name.
Provide short description.
Save local object.
Steps to activate the function group: Execute SE37.
In the menu bar environment inactive objects.
Expand your function group.
Select your function group.
Click on activate (in ECC 6.0 select function group right click activate).
Components of the function module:1.
2.
3.
4.
5.
Attributes.
Import.
Export.
Changing.
Tables.
6. Exception.
7. Source code.
1.Attributes:Attributes specify the type of the function module, normal or remote.
We can access the normal function module with in the server only, where as we can
access remote function modules with in the server as well as outside the server
also.
2. Import acts like using in the subroutine.
3. Export acts like changing the subroutine.
4. Changing acts like both import & export.
5. Tables acts like both import & export only for internal tables.
6. Exception use to handle the errors.
7. Source code the logic related to function module.
Differences between function module & subroutine:Function module
1. Function modules are global, i.e.,
we can access the function module
with in the server as well as outside
the server also.
2. We can test the function module
independently.
3. We can handle the errors in
function module.
4. Function modules are defined by
using SE37 transaction code.
Subroutine
1. Subroutines are local, i.e., we can
access the subroutine with in the
server only.
2. We cant test the subroutine
independently without calling the
subroutine.
3. We cant handle the errors in
subroutine.
4. Subroutines are defined by using
SE38 transaction code.
Execute SE37.
Provide your function module name.
Create.
Provide function group name & short description.
Save.
25/06/10.
To develop the function module, to display the material details, based on
the given material number.
Program:IMPORT.
P_MATNR LIKE MARA-MATNR.
EXPORT.
WA LIKE MARA.
EXCEPTIONS.
NO_DATA.
SOURCE CODE.
SELECT SINGLE * FROM MARA INTO TABLE WA WHER
MATNR = P_ MATNR.
IF SY-SUBRC <> 0.
RAISE NO_DATA.
ENDIF.
Steps to call a function module: Open the program.
Place the cursor where you want to call the function module & click on the
pattern.
Provide your FM name.
E.g.:
DATA X TYPE I.
PARAMETER: P_INPUT1 TYPE I,
P_INPUT2 TYPE I.
CALL FUNCTION 'YSAI_FM'
EXPORTING
A = P_INPUT1
B = P_INPUT2
IMPORTING
C = X.
WRITE X.
ALV (ABAP LIST VIEWER):ALV is used to display the output with predefined functionalities such as
1. Sort the list in ascending order
2. Sort the list in descending order
3. Filtering
4. Down the list
5. Change the layout
6. Send as attachment
7. Word processing
8. Excel sheet
9. Graphics
STEPS TO WORK WITH ALV:
1. Declare the final internal table and fill the data in internal table (the data we want display)
2. Prepare the field catalogue internal table (about the fields) i.e. .column position, column
heading, hotspot, emphasize, edit.
3. Call the REUSE_ALV_LIST__DISPLAY or REUSE_ALV_GRID_DISPLAY function
module
REUSE_ALV_GRID_DISPLAY:
It is function module which displays output in grid format.
REUSE_ALV_LIST_DISPLAY:
It is function module which used to display in list format.
The input for the above two function module is two internal tables
1. DATA INTERNAL TABLE
2. FIELD CATALOGUE INTERNAL TABLE
Program: to view the all data in the table.
DATA: IT_T001 LIKE TABLE OF T001.
SELECT * FROM T001 INTO TABLE IT_T001.
CALL FUNCTION REUSE_ALV_GRID_DISPLAY
EXPORTING
I_STRUCTURE_NAME = T001
TABLES
T_OUTTAB = IT_T001.
NOTE:
Whenever we working with all the fields form any one of the database table at that time
we no need to prepare field catalogue we simply pass I_STRUCTURE _NAME as Database
table name.
In this scenario function module picks the column headings from the data element of each
field and display fields in the similar order of the fields in the table.
PREPARE THE FIELD CATALOGUE:
Methode1: Whenever working with all the fields from any one of the database tables then we no
need prepare field catalogue we simply pass I_STRUCTURE_NAME as database table name.
Methode2: Manually filling field catalogue.
Metohde3: By using REUSE_ALV_FIELDCATALOG_MERGE function module.
REUSE_ALV_FIELDCATALOG_MERGE:
It is the function module which is used to prepare the field catalogue the input for the
above function module is data work area. If we are working with internal table with header line
then we pass internal table name
The output for the above function module is field catalogue internal table.
Some of the fields in Field Catalogue Internal Table:
FIELD NAME ---- Name of the field
COL_POS -------- Column Position
SELTEXT_S
SELTEXT_M
Column Heading
SELTEXT_L
HOTSPOT ---------Handle Symbol
EDIT----------------Change Mode
EMPHASIZE------ Colour
NO_OUT ---------- Hide the field
NO_ZERO -------- Remove the leading zeros
NO_SIGN -------- Internal table name
TABNAME ------- Remove the leading sign
OUTPUTLEN ---- Length of the field
S --- small
M --- medium
L --- long
NOTE:
In SLIS we have one type that is SLIS_T_FIELDCAT_ALV which contains the entire
fields related to field catalogue. So we simply declare field catalogue internal table by referring
SLIS_T_FIELDCAT_ALV.
NOTE:
SLIS is the type group which contains all the types related to ALV.
STEPS TO CREATE TYPE GROUP:
SAVE
PROGRAM:
TYPE-POOL YSPRAO.
TYPES: BEGIN OF YSPRAO-T001,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
ORT01 LIKE T001-ORT01,
END OF YSPRAO-T001.
SAVE, CHECK, ACTIVATE
NOTE: Whenever we are referring any type under any type group then we must include type
group name in the report (not in the report name)
Type-pools:
It is the key word which is used to include the any type group.
PROGRAM:
DATA WA_T001 TYPE YSPRRAO-T001.
DATA IT_T001 LIKE TABLE OF WA_T001.
SELECT BUKRS BUTXT ORT01 FROM T001 INTO TABLE IT_T001.
LOOP AT IT_T001 INTO WA_T001.
WRITE: / WA_T001-BUKRS, WA_T001-BUTXT, WA_T001-ORT01.
ENDLOOP.
NOTE: EMPHASIZE = CXYZ
Where C = Colour
X = Colour Number
Y = Intensity
Z = Foreground/Background
1 Foreground, 2 Back ground.
NOTE: SY-CPROG is system variable which contains current program name.
OBJECT:
To display the purchasing document numbers, document type, vendor number by using
ALV.
REPORT YRAKESH_ALV_FCATMANUAL
.
TYPE-POOLS SLIS.
*** DECLARE IT.
DATA : BEGIN OF WA_EKKO,
EBELN LIKE EKKO-EBELN,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF WA_EKKO.
DATA IT_EKKO LIKE TABLE OF WA_EKKO.
***FILL IT.
SELECT EBELN BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
*** DECLARE FIELDCATLOG.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
= 'BSART'.
'2'.
='DOC.TYPE'.
= 'C110'.
IT_FCAT.
WA_FCAT-FIELDNAME = 'LIFNR'.
WA_FCAT-COL_POS = '3'.
WA_FCAT-SELTEXT_M ='VENDOR'.
WA_FCAT-EDIT = 'X'.
WA_FCAT-NO_OUT = 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
***DISPLAY OUTPUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
*
IS_LAYOUT
=
IT_FIELDCAT
= IT_FCAT
TABLES
T_OUTTAB
= IT_EKKO.
OBJECT:
To display customer numbers, names and cities by using
REUSE_ALV_FIELDCATLOG_MERGE in ALV.
Program:
REPORT
YRAKESH_ALV_FCAT_FM
TYPE-POOLS SLIS.
*** DECLARING IT
DATA: BEGIN OF WA_KNA1,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
ORT01 LIKE KNA1-ORT01,
END OF WA_KNA1.
DATA IT_KNA1 LIKE TABLE OF WA_KNA1.
***FILLING IT
SELECT KUNNR NAME1 ORT01 FROM KNA1 INTO TABLE IT_KNA1.
*** DECALRING FILE CAT IT
DATA IT_FCAT TYPE SLIS_T_FIELDCAT_ALV.
***FILLING FIELD CATLOG
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME
= SY-CPROG
I_INTERNAL_TABNAME
= 'WA_KNA1'
I_INCLNAME
= SY-CPROG
CHANGING
CT_FIELDCAT
= IT_FCAT.
***DISPLAY THE DATA
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM
= SY-CPROG
IT_FIELDCAT
= IT_FCAT
TABLES
T_OUTTAB
= IT_KNA1.
WORKING WITH EVENTS:
In ALV events are handled through SUB ROUTINES only whenever we working with
events then we must declare an internal table which contains two fields i.e. Event Name(NAME)
which form handle that event (FORM) .
NOTE:
In SLIS we have one type that is SLIS_T_EVENT which contains the above two fields
so that we simply declare our Event Internal Table by referring SLIS_T_EVENT.
NOTE:
REUSE_ALV_COMMENTARY_WRITE is the function module which is used to
display the text or comment in the TOP_OF_ PAGE or END_ OF_ LIST events. The input for
the above function module is an internal table which contains two fields that is
1. What to display (INFO)
2. How to display (TYP).
NOTE:
In SLIS we have one type that is SLIS_T_LISTHEADER which contains the above two
fields so that we simply declare the above two fields, so that simply declare internal tables by
referring SLIS_T_LISTHEADER.
STEPS TO UPLOAD LOGO IN ALV:
Execute OAER.
Provide CLASS NAME : Pictures
CLASS TYPE: OT
OBJECT KEY: YSPRAO (Any Name)
Execute or F8.
In Bottom Window
Expand Standard.Doc.Type
Double Click on SCREEN
NOTE:
Whenever we are working with Events then we must pass I_CALLBACK_PROGRAM
as current program name in the Grid Display.
PROGRAM:
*&-----------------------------------------------------------*
*& Program to print TOP_OF_PAGE and END_OF_LIST Events
*
*------------------------------------------------------------*
REPORT YRAKESH_ALV_EVENTS
.
TYPE-POOLS SLIS.
*** DECLARING IT
DATA :BEGIN OF WA_FINAL,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
KUNNR LIKE KNB1-KUNNR,
AKONT LIKE KNB1-AKONT,
END OF WA_FINAL.
DATA IT_FINAL LIKE TABLE OF WA_FINAL.
***FILLING IT
SELECT T001~BUKRS T001~BUTXT KNB1~KUNNR KNB1~AKONT INTO TABLE
IT_FINAL
FROM T001 INNER JOIN KNB1 ON T001~BUKRS = KNB1~BUKRS.
*** DECALRING FILE CAT IT
DATA IT_FCAT TYPE SLIS_T_FIELDCAT_ALV.
***FILLING FIELD CATLOG
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME
= SY-CPROG
I_INTERNAL_TABNAME
= 'WA_FINAL'
I_INCLNAME
= SY-CPROG
CHANGING
CT_FIELDCAT
= IT_FCAT.
***DECLARE EVENT IT
DATA : IT_EVENT TYPE SLIS_T_EVENT,
WA_EVENT LIKE LINE OF IT_EVENT.
***FILLING THE EVENT IT
WA_EVENT-NAME = 'TOP_OF_PAGE'.
WA_EVENT-FORM = 'ZTOP'.
APPEND WA_EVENT TO IT_EVENT.
WA_EVENT-NAME = 'END_OF_LIST'.
WA_EVENT-FORM = 'ZEOL'.
APPEND WA_EVENT TO IT_EVENT.
***DISPLAY THE DATA
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM
= SY-CPROG
IT_FIELDCAT
= IT_FCAT
IT_EVENTS
= IT_EVENT
TABLES
T_OUTTAB
= IT_FINAL.
**** DEFINING SUB ROUTINE
FORM ZTOP.
DATA : IT_LIST TYPE SLIS_T_LISTHEADER,
WA_LIST LIKE LINE OF IT_LIST.
WA_LIST-INFO = 'These r Customer under Company'.
WA_LIST-TYP = 'S'. " H->header, S->selection, A->action
APPEND WA_LIST TO IT_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY
= IT_LIST
I_LOGO
='YRAKESH'.
ENDFORM.
FORM ZEOL.
DATA : IT_LIST1 TYPE SLIS_T_LISTHEADER,
WA_LIST1 LIKE LINE OF IT_LIST1.
WA_LIST1-INFO = 'THAN Q'.
WA_LIST1-TYP = 'A'.
APPEND WA_LIST1 TO IT_LIST1.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY
= IT_LIST1
I_END_OF_LIST_GRID
= 'X'.
ENDFORM.
USER_COMMAND:
It is an event which acts like both AT LINE SELCTION as well as AT USER
COMMAND in the ordinary reports.
It is Event which is triggered at the time of user click on any record of any list as well as
any menu item.
OBJECT:
Based on the given company codes to display the company code to display the
company codes, company names and cities by using ALV, whenever user clicks on company
code then We display the all the customers information under that company.
REPORT YRAKESH_ALV_IREP
TYPE-POOLS SLIS.
DATA V1 LIKE T001-BUKRS.
SELECT-OPTIONS S_BUKRS FOR V1 .
***DECLARE IT_TOO1.
DATA : BEGIN OF WA_T001,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
ORT01 LIKE T001-ORT01,
END OF WA_T001.
DATA IT_T001 LIKE TABLE OF WA_T001.
***DECLARE IT_KNB1.
= IT_T001.
FORM ZTOP.
DATA : IT_LIST TYPE SLIS_T_LISTHEADER,
WA_LIST LIKE LINE OF IT_LIST.
WA_LIST-INFO = 'COMPANY DETAILS'.
WA_LIST-TYP = 'S'.
APPEND WA_LIST TO IT_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY
= IT_LIST
I_LOGO
= 'YRAKESH'.
ENDFORM.
***DEF OF FORM ZEOL.
FORM ZEOL.
DATA
ENDFORM.
*** DEF OF FORM ZUC.
FORM ZUC USING A LIKE SY-UCOMM B TYPE SLIS_SELFIELD.
IF B-FIELDNAME = 'BUKRS'.
SELECT KUNNR BUKRS AKONT PERNR FROM KNB1 INTO TABLE IT_KNB1 WHERE
BUKRS = B-VALUE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT
TABLES
T_OUTTAB
= IT_FCAT1
= IT_KNB1.
ENDIF.
ENDFORM.
Date: 28.06.2010.
SOME OF THE IMPORTANT TRANSACTION CODES.
XD03 ------Display Customer
XK03 ------ Display Vendor
MM03 ----Display Material
ME23N --- Display Purchase Order.
VA03 ----- Display Sales Order
MB03 ---- Display Material Document
FB03 ----- Display Accounting Document.
SYNTAX OF CALLING TRANSACTION:
CALL TRANSACTION <T-CODE>.
E.g. Call Transaction XK03.
SYNTAX OF SET THE VALUE TO THE TRANSACTION
SET PARAMETER ID <ID Name> FIELD <Value>.
E.g. SET Parameter ID LIF Field P5602.
OBJECT:
Based on the given Purchasing document number to display Purchasing Document
number, Document type, Vendor Number, Item Number and Quantity by using ALV. If user
clicks on any Purchasing Document Number (PO) then we display the Purchase Order details by
using ME23N transaction. If the user clicks on any Vendor then we display the vendor details by
using XK03 transaction.
HINT: EBELN, BSART, LIFNR, EBELP, MENGE
EKKO
EKPO
EBELN
EBELN
BSART
EBELP
LIFNR
MENGE
REPORT
YRAKESH_ALV_TRANS
TYPE-POOLS SLIS.
DATA V1 LIKE EKKO-EBELN.
SELECT-OPTIONS S_EBELN FOR V1 .
***DECLARE ITs
DATA : BEGIN OF WA_EKKO,
EBELN LIKE EKKO-EBELN,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF WA_EKKO.
DATA IT_EKKO LIKE TABLE OF WA_EKKO.
DATA: BEGIN OF WA_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
COL(4) TYPE C,
END OF WA_EKPO.
DATA IT_EKPO LIKE TABLE OF WA_EKPO.
DATA : BEGIN OF WA_FINAL,
EBELN LIKE EKKO-EBELN,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
EBELP LIKE EKPO-EBELP,
MENGE LIKE EKPO-MENGE,
END OF WA_FINAL.
DATA IT_FINAL LIKE TABLE OF WA_FINAL.
***FILLING DATA INTO ITS USING FOR ALL ENTRIES.
SELECT EBELN BSART LIFNR FROM EKKO INTO TABLE IT_EKKO WHERE EBELN
IN
S_EBELN.
IF NOT IT_EKKO IS INITIAL.
SELECT EBELN EBELP MENGE FROM EKPO INTO TABLE IT_EKPO FOR ALL
ENTRIES IN
IT_EKKO WHERE EBELN = IT_EKKO-EBELN.
ENDIF.
LOOP AT IT_EKPO INTO WA_EKPO.
WA_FINAL-EBELN = WA_EKPO-EBELN.
WA_FINAL-EBELP = WA_EKPO-EBELP.
WA_FINAL-MENGE = WA_EKPO-MENGE.
READ TABLE IT_EKKO INTO WA_EKKO WITH KEY EBELN = WA_EKPO-EBELN.
WA_FINAL-BSART = WA_EKKO-BSART.
WA_FINAL-LIFNR = WA_EKKO-LIFNR.
APPEND WA_FINAL TO IT_FINAL.
ENDLOOP.
***DECLARE CATALOG
***DECLARING IT
DATA: BEGIN OF WA_MARA,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
END OF WA_MARA.
DATA IT_MARA LIKE TABLE OF WA_MARA.
***FILLING IT_MARA
SELECT MATNR MTART MATKL FROM MARA INTO TABLE IT_MARA .
***DECLARING IT_FCAT.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.
***FILLING IT_FCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME
= SY-CPROG
I_INTERNAL_TABNAME
= 'WA_MARA'
I_INCLNAME
= SY-CPROG
CHANGING
CT_FIELDCAT
= IT_FCAT.
***CUSTOMIZING
WA_FCAT-HOTSPOT = 'X'.
MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING HOTSPOT
WHERE FIELDNAME = 'MATNR'.
WA_FCAT-EMPHASIZE = 'C610'.
MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING EMPHASIZE
WHERE FIELDNAME = 'MATKL'.
****DISPLAY OUT PUT
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT
= IT_FCAT
TABLES
T_OUTTAB
= IT_MARA.
Date: 29.06.2010
BLOCKED ALV:
Blocked ALV is used to display the output in Block wise.
STEPS TO WORK WITH BLOCKED ALV:
1. Intialize the Blocked ALV using REUSE_ALV_BLOCK_LIST_INIT function module.
The input for above function module is CURRENT PROGRAM NAME.
2. Append the each block/Internal table to blocked ALV by using
REUSE_ALV_BLOCK_LIST_APPEND
Function module
The input for the above function module is
1. Data Internal Table
I_PROGRAM_NAME
I_INTERNAL_TABNAME
I_INCLNAME
CHANGING
CT_FIELDCAT
= SY-CPROG
= 'WA_EKKO'
= SY-CPROG
= IT_FCAT1.
REPORT
YRAKESH_BALV_3TAB
TYPE-POOLS SLIS.
DATA V1 LIKE T001-BUKRS.
SELECT-OPTIONS S_BUKRS FOR V1.
***DECLARE IT TABLES.
DATA : BEGIN OF WA_T001,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
ORT01 LIKE T001-ORT01,
END OF WA_T001.
DATA IT_T001 LIKE TABLE OF WA_T001.
DATA : BEGIN OF WA_KNB1,
KUNNR LIKE KNB1-KUNNR,
BUKRS LIKE KNB1-BUKRS,
AKONT LIKE KNB1-AKONT,
PERNR LIKE KNB1-PERNR,
END OF WA_KNB1.
DATA IT_KNB1 LIKE TABLE OF WA_KNB1.
DATA: BEGIN OF WA_KNBK,
KUNNR LIKE KNBK-KUNNR,
BANKS LIKE KNBK-BANKS,
BANKL LIKE KNBK-BANKL,
BANKN LIKE KNBK-BANKN,
END OF WA_KNBK.
DATA IT_KNBK LIKE TABLE OF WA_KNBK.
***FILL THE IT TABLES.
SELECT BUKRS BUTXT ORT01 FROM T001 INTO TABLE IT_T001 WHERE BUKRS
IN
S_BUKRS.
IF NOT IT_T001 IS INITIAL.
SELECT KUNNR BUKRS AKONT PERNR FROM KNB1 INTO TABLE IT_KNB1
FOR ALL
ENTRIES IN IT_T001 WHERE BUKRS = IT_T001-BUKRS.
ENDIF.
IF NOT IT_KNB1 IS INITIAL.
SELECT KUNNR BANKS BANKL BANKN FROM KNBK INTO TABLE IT_KNBK
FOR ALL
ENTRIES IN IT_KNB1 WHERE KUNNR = IT_KNB1-KUNNR.
ENDIF.
***DECLARE IT_FCAT.
DATA : IT_FCAT1 TYPE SLIS_T_FIELDCAT_ALV,
IT_FCAT2 TYPE SLIS_T_FIELDCAT_ALV,
IT_FCAT3 TYPE SLIS_T_FIELDCAT_ALV.
***FILL IT_FCAT.
I_TABNAME
IT_EVENTS
TABLES
T_OUTTAB
= 'IT_KNB1'
= IT_EVENT2
= IT_KNB1.
HIERARCHICAL ALV:
This is used to display the Header and Item Details in Hierarchical Manner.
REUSE_ALV_HIERSEQ_ LIST_DISPLAY:
It is function module which is used to display the output in hierarchical manner the input
for the above function module is two Data Internal Tables (Header, Item), Field Catalogue
Internal Table, Key Information (linking fields of Header and Item)
*&--------------------------------------------------------------------*
* To display Purchasing Document header and item details by using
* heirarchical ALV Based on Purchasing document No.
*&--------------------------------------------------------------------*
REPORT
YRAKESH_ALV_HIER_EKKOEKPO
TYPE-POOLS SLIS.
DATA V1 LIKE EKKO-EBELN.
SELECT-OPTIONS S_EBELN FOR V1.
***Declaring Data ITs.
DATA : BEGIN OF WA_EKKO,
EBELN LIKE EKKO-EBELN,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
BUKRS LIKE EKKO-BUKRS,
END OF WA_EKKO.
DATA IT_EKKO LIKE TABLE OF WA_EKKO.
DATA : BEGIN
EBELN
EBELP
MENGE
MEINS
NETPR
OF WA_EKPO,
LIKE EKPO-EBELN,
LIKE EKPO-EBELP,
LIKE EKPO-MENGE,
LIKE EKPO-MEINS,
LIKE EKPO-NETPR,
COL(4) TYPE C,
END OF WA_EKPO.
DATA IT_EKPO LIKE TABLE OF WA_EKPO.
***Filing Data ITs.
SELECT EBELN BSART LIFNR BUKRS FROM EKKO INTO TABLE IT_EKKO WHERE
EBELN
IN S_EBELN.
SELECT EBELN EBELP MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO
WHERE
EBELN IN S_EBELN.
WA_EKPO-COL = 'C910'.
MODIFY IT_EKPO FROM WA_EKPO TRANSPORTING COL WHERE NETPR > 1000.
***Declaring Field Catalogue IT.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.
*** Filling Field Catalogue IT.
WA_FCAT-FIELDNAME = 'EBELN'.
WA_FCAT-COL_POS = '1'.
WA_FCAT-SELTEXT_M = 'PUR.DOC'.
WA_FCAT-TABNAME = 'IT_EKKO'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-FIELDNAME = 'BSART'.
WA_FCAT-COL_POS = '2'.
WA_FCAT-SELTEXT_M = 'DOC.TYP'.
WA_FCAT-TABNAME = 'IT_EKKO'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-FIELDNAME = 'LIFNR'.
WA_FCAT-COL_POS = '3'.
WA_FCAT-SELTEXT_M = 'VEN.NUM'.
WA_FCAT-TABNAME = 'IT_EKKO'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-FIELDNAME = 'BUKRS'.
WA_FCAT-COL_POS = '4'.
WA_FCAT-SELTEXT_M = 'CO.CODE'.
WA_FCAT-TABNAME = 'IT_EKKO'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-FIELDNAME
WA_FCAT-COL_POS =
WA_FCAT-SELTEXT_M
WA_FCAT-TABNAME =
= 'EBELN'.
'1'.
= 'PUR.DOC'.
'IT_EKPO'.
= 'EBELP'.
'2'.
= 'DOC.TYP'.
'IT_EKPO'.
= 'MENGE'.
'3'.
= 'QTY'.
'IT_EKPO'.
= 'MEINS'.
'4'.
= 'UOM'.
'IT_EKPO'.
= 'NETPR'.
'5'.
= 'PRICE'.
'IT_EKPO'.
I_TABNAME_HEADER
I_TABNAME_ITEM
IS_KEYINFO
TABLES
T_OUTTAB_HEADER
T_OUTTAB_ITEM
= 'IT_EKKO'
= 'IT_EKPO'
= WA_KEY
= IT_EKKO
= IT_EKPO.
REPORT
YRAKESH_HIRARCHICAL_ALV1
TYPE-POOLS SLIS.
DATA V1 LIKE BKPF-GJAHR.
SELECT-OPTIONS S_GJAHR FOR V1.
DATA V2 LIKE BKPF-BUKRS.
SELECT-OPTIONS S_BUKRS FOR V2.
***DECLARING IT TABLES.
DATA : BEGIN OF WA_BKPF,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
BUKRS LIKE BKPF-BUKRS,
BLART LIKE BKPF-BLART,
BUDAT LIKE BKPF-BUDAT,
BLDAT LIKE BKPF-BLDAT,
END OF WA_BKPF.
DATA IT_BKPF LIKE TABLE OF WA_BKPF.
DATA : BEGIN OF WA_BSEG,
BELNR LIKE BSEG-BELNR,
= 'BELNR'.
'1'.
= 'ACC.DOC.NO'.
'IT_BKPF'.
= 'GJAHR'.
'2'.
= 'FISCAL YR'.
'IT_BKPF'.
= 'BUKRS'.
'3'.
= 'COMPANY CODE'.
'IT_BKPF'.
= 'BLART'.
'4'.
= 'A/C_DOC_TY'.
= '8'.
WA_FCAT-TABNAME = 'IT_BKPF'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME
WA_FCAT-COL_POS =
WA_FCAT-SELTEXT_S
WA_FCAT-TABNAME =
= 'BUDAT'.
'5'.
= 'POST_DATE'.
'IT_BKPF'.
= 'BLDAT'.
'6'.
= 'DOC_DATE'.
'IT_BKPF'.
= 'BELNR'.
'1'.
= 'ACC.DOC.NO'.
'IT_BSEG'.
= 'GJAHR'.
'2'.
= 'FISCAL YR'.
'IT_BSEG'.
= 'BUKRS'.
'3'.
= 'COMPANY CODE'.
'IT_BSEG'.
= 'BUZEI'.
'4'.
= 'ITEM'.
'IT_BSEG'.
= 'DMBTR'.
'5'.
= 'LOCAL_CURR.'.
'IT_BSEG'.
= 'WRBTR'.
'6'.
= 'DOC_CURR.'.
'IT_BSEG'.
*&--------------------------------------------------------------------*
*To display Purchasing doc no.,Item no's,Quantity,UOM and
Netprice by
*using ALV and also diplay the purchase documents no.in RED color
if the
* amount is more than thousand and also add one menu item
(DOWNLOAD) in
*application tool bar if we are clicking on Download Button the
we
*download data into Desktop .
*&--------------------------------------------------------------------*
REPORT
YRAKESH_ALV_GUI
TYPE-POOLS SLIS.
DATA V1 LIKE EKPO-EBELN.
SELECT-OPTIONS S_EBELN FOR V1.
***DECLARE DATA IT.
INCLUDE YRAKESH_IT_EKPO.
***FILLING DATA IT.
SELECT EBELN EBELP MENGE MEINS NETPR FROM EKPO INTO TABLE
IT_EKPO WHERE
EBELN IN S_EBELN.
WA_EKPO-COL = 'C610'.
MODIFY IT_EKPO FROM WA_EKPO TRANSPORTING COL WHERE NETPR > 1000.
***DECLARE FIELDCATALOG IT.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.
***FILLING FIELDCATLOG IT.
WA_FCAT-FIELDNAME
WA_FCAT-COL_POS =
WA_FCAT-SELTEXT_M
APPEND WA_FCAT TO
CLEAR WA_FCAT.
= 'EBELN'.
'1'.
= 'PUR_DOC_NO'.
IT_FCAT.
WA_FCAT-FIELDNAME
WA_FCAT-COL_POS =
WA_FCAT-SELTEXT_M
APPEND WA_FCAT TO
CLEAR WA_FCAT.
= 'EBELP'.
'2'.
= 'ITEM NO'.
IT_FCAT.
WA_FCAT-FIELDNAME
WA_FCAT-COL_POS =
WA_FCAT-SELTEXT_M
APPEND WA_FCAT TO
CLEAR WA_FCAT.
= 'MENGE'.
'3'.
= 'Quantity'.
IT_FCAT.
WA_FCAT-FIELDNAME
WA_FCAT-COL_POS =
WA_FCAT-SELTEXT_M
APPEND WA_FCAT TO
CLEAR WA_FCAT.
= 'MEINS'.
'4'.
= 'UOM'.
IT_FCAT.
WA_FCAT-FIELDNAME
WA_FCAT-COL_POS =
WA_FCAT-SELTEXT_M
APPEND WA_FCAT TO
CLEAR WA_FCAT.
= 'NETPR'.
'5'.
= 'PRICE'.
IT_FCAT.
LAY OUT.
WA_EVENT-NAME = 'USER_COMMAND'.
WA_EVENT-FORM = 'ZUC'.
APPEND WA_EVENT TO IT_EVENT.
CLEAR WA_EVENT.
***DISPLAY O/P.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM
= SY-CPROG
IS_LAYOUT
= WA_LAYOUT
IT_FIELDCAT
= IT_FCAT
IT_EVENTS
= IT_EVENT
TABLES
T_OUTTAB
= IT_EKPO.
***FILLING THE FORMS
FORM ZPSS USING A TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STAT'.
ENDFORM.
FORM ZUC USING B LIKE SY-UCOMM C TYPE SLIS_SELFIELD.
IF B = 'DOWN'.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
FILETYPE
TABLES
DATA_TAB
= 'DAT'
= IT_EKPO.
ENDIF.
ENDFORM.
To display the Purchasing Document , items
<write Questions Here>
2/7/10
DB
SE11
Note:
In the real time we always create the transaction code for any executable program
Steps to work with module pool program
1.
Create a module pool program and implement the retrieving logic
2.
Design the required screen and attach to the program
3.
Design the required menus and attach to the screen
4.
Design the database table based on client requirement
Note:
-the above four transaction codes we can work with in a single transaction i.e. SE80
Steps to create a module pool program
-Execute SE80
-click on edit object
-select the program tab
-provide your program
click on create
-remove top include
with top incl
-enter
-select on type is module pool
Type Module pool
-save
-local object
-in the left panel select the program.
-Provide your program
-save
Working with screen painter
-Screen painter is a tool which contain both graphical as well as alpha numerical mode.
Components of Screen painter
1. Attribute
2. Layout
3. Element list
4. Flowlogic editor
1. Attrivbute: Attribute specify the type of the screen either normal or sub screen or dialog screen
2. Layout: Layout is the collection of screen element that input/output screen, push button, radio
button, check box, table control.
3. Element list: Elements list contains the entire screen element which design in the current
screen and this data types and length.
4. Flow logic editor: Flow logic editor contains logic related to the screen.
- The linking or communication b/n flow logic editor to abap editor is always through
screen element that is each element in the screen that should be an equalent declaration is
available in abap editor.
Event in flow logic editor
1. PBO (Process before Output)
2. PAI (Process after Input)
3. POV (Process on Value Request)
4. POH (Process on Help request)
1. PBO: It is an event which is trigger before displaying the screen.
-this is used to provide the default values to the screen.
2. PAI: It is an event which is triggers often providing the input to the screen.
-this is used to implement the logic.
3. POV: is an event which is trigger at the time of user clicks on f4 button.
-this is used to provide the list of possible values to the given input variable.
Input1
Input2
Result
BAC
FCOD-BAK
ADDITIO
FCOD-ADD
-Save
-Back.
Steps to activate the program
-Double click on program in the left panel
-Right click
-Activate
Steps to execute transaction code
-select the program in left panel
-right click
-create
Transaction
-provide your transaction code
-provide short description
-enter
-select first radio button.
-Provide program name
-screen no
Step to execute the program
-select the transaction code in the left panel
-right click
-execute
Direct processing
Source code:
-save.
5/7/10
Program
Screen 1
Leave program
Screen 2
leave to screen 0
Screen 3
leave to screen 0
Obi
ccode
cname
city
INSERT
BACK
FCOD-BAK
TOO1
FCOD-ADD
-Save
-Back.
Note:
-if we want to design the screen with db fields then open the screen (layout) click on F4
(dictionary program field)
-provide your db table name
-enter
-select your require fields
-enter.
Source code:
Obi
-create table
ZVENEQF
ENO
10
25
15
C
C
25
10
COURSE
10
NAME
PHONE NO
ZTIME
SCREEN 1000
ENO
Name
PHONE
NEXT
BACK
SCREEN 2000
COURSE
TIMING
SAVE
BACK
VRM-SETT-VALUES:
-Is the function module which is used to provide dropdown list to the any input variable.
-The input for the above function module is field name for which field we want to
provide dropdown list.
-An internal table of which contains two fields that are key and text
NOTE:
-In VRM we have type that is VRM_VALUES which contains the above two fields. So, that
we simple declare our internal table by referring VRM-VALUES.
-If we want to provide mask double click on field (in the Layout)
-In the attribute
Program
Input Not possible
If we want to provide field as a mandatory
Required
CODE
Working with table control
-table control is used to display the multiple records in a tabular format.
Ranges
selection-option
Low, high,
Sign, option
It wont provide any screen
To enter the input.
by default sign = I
Option = BT
7/7/10
SCREEN 1000
CCODE
TO
DISPL
AY
SE
L
CCODE
BACK
CUSTOME RECON
R
Download
Attribute
Line sel
Back
Code
WORKING WITH SUBSCREEN ARES
-Sub screen area must be placed in normal screen only.
SE
L
-each sub screen area can call only one sub screen at a time.
Syntax of include or calling the sub screen into sub screen areas
Call subsreen <sub screen area name> including <program name> <screen no>
EX:
CALL SUBSCREEN SA1 INCLUDING SY-REPID 100.
NOTE:
SY-REPID: Is the system variable which contains the current program name.
-if we want to enable the PAI of sub screens then we must call the sub screen area name
in the PAI of normal screen.
Screen
Code
Working with tab strip control
-tab strip is the strip of tab each tab contains only one sub screens area.
-each sub screen area can call only one sub screen at a time.
- By default tab strip contains 2 tabs.
-only one tab is always active.
Declaring the tab strip in the ABAP editor
CONTROLS <TAB STRIP NAME> TYPE TABSTRIP.
EX: CONTROLS TBC TYPE TABSTRIP.
By default the PBO of each screen contains GUI title and GUI status
Syntax of active the tab
<TAB STRIP NAME>-ACTIVE TAB = <TAB NAME> .
EX:
TBC-ACTIVETAB = TAB1.
SCREEN
CODE
Working with process on value request (POV)
Note
-F4IF_INT-_TABLE_VALUE_REQUEST is the function is module which is used to
provide the list of possible values to the input variable.
- The input for the above function module is
-data internal table
-return field of data internal table
-field name (for which field we want to provide list of possible
value)
-screen no (the field is available in which screen)
-program name (screen is attached to which program)
Obi
Screen
Code
Note
-leave to list-processing: is used to display the output like in ordinary reports
9/9/10
Working with validation
-there are three type of validation
1. System validation
SAP SCRIPT
If you want to print the business document such as invoice. purchase order. sales order etc... We
need LAYOUTs. Layouts are designed through FORMS.
SAP-SCRIPT is a tool used to design the business documents. The SAP provides layouts for
almost all the applications. Most of the time ABAPer job is changes the layout or adding some addition
logic to the STANDARD DRIVER PROGRAM. Driver program is used to retrieving the data from the
database and transferred to the LAYOUT SET.
Components of SAP-SCRIPT:
1. LAYOUT
2. DRIVER PROGARM
Component of LAYOUT:
1. HEADER
2. PAGES
3. WINDOWS
4. PAGE WINDOWS
5. PARAGRAPH FORMATS
6. CHARACTER FORMATS
7. DOCUMENTATION
1.
HEADER:
Header is used to maintain the administrative information. i.e.. FORM NAME, LANGUAGE,
PAGE FORMAT, FIRST PAGE and DEFAULT PARAGRAPH (Default Settings).
2.
PAGES:
Page is the physical area where we can place the window. We can not print the text on page.
3.
WINDOWS:
We can place the same window in multiple pages. We can not print the text on window.
4.
PAGE WINDOWS:
Page window is nothing but placing the window on the page with co-ordinates (Left. Upper.
Width and Height). We can print text only on the page windows.
5.
PARAGRAPH FORMATS:
Paragraph format is used to align the entire PARAGRAPH with same font and same font type.
6.
CHARACTER FORMATS:
Character format is used to align the particular text with same font and same font type.
7.
DOCUMENTATION:
This is used to maintain the documentation related to FORM.
NOTE: The transaction code for form painter is SE71.
Steps to design the LAYOUT/FORM:
1. Execute SE71, Provide your form name, Click on CREATE. ENETER. Provide short description.
2. Click on PAGES (Application tool bar). In the MENU BAR click on EDIT -> Create Element.
Provide your page name and Description.
3. Click on WINDOWS (Application tool bar). In the MENU BAR click on EDIT -> Create
Element. Provide your window name and Description.
4. Click on Page Windows (Application tool bar). In the MENU BAR click on EDIT -> Create
Element. Select the required window provide left. upper margins. width and height.
Repeat for all the WINDOWS.
MAIN WINDOW is the default window in SAP-SCRIPT. We can place the main Window up to 99
times per page (00 to 98).
5. Click on PARAGRAPH FORMAT (Application tool bar). Provide paragraph format name (any
name) Enter. Provide short description provide FONT. TABS. etc save.
6. Click on HEADER, Click on basic settings provide your first page and default paragraph. save.
Steps to open the LAYOUT:
1. In the menu bar click on settings -> form painter. select the check box graphic form painter. Enter.
2. In the application tool bar click on layout. align the layout activate.
NOTE: Printing the DATA on the page window is always through SYMBOLS. Each symbol start with &
and ends with &.
There are four types of symbols.
1. PROGRAM SYMBOLS
2. SYSTEM SYMBOLS
3. STANDARD SYMBOLS
4. TEXT SYMBOLS
1.
PROGRAM SYMBOLS:
These are the program variables. i.e.. &WA_T001-BUKRS&
&WA_MCHA-CHARG&
2.
SYSTEM SYMBOLS:
These are the system variables. i.e.. &DATA& &TIME&
3.
STANDARD SYMBOLS:
These are coming from the TTDTG Standard Table.
Example:
&Mr.& &Mrs.&
4.
TEXT SYMBOLS:
These are the variables which are defined in page window. Example:
DEFINE &a&.
Steps to transfers the data from driver program to LAYOUT:
1. Create an executable program and implement all the retrieving logic.
2. Access the layout from the DRIVER PROGRAM by using OPEN_FORM function module. The
input for this function module is FORM NAME.
3. Transfers the DATA from the DRIVER PROGRAM to PARTICULAR WINDOW by using
WRITE_FROM function module. The input for this function module is WINDOW NAME.
Repeat the same step for all the WINDOWs.
4. Close the form by using CLOSE_FORM function module. No input for this function module.
Steps to place the SYMBOLS on the PAGE WINDOW:
1. Execute SE71. Provide your form name and click on change mode.
2. Click on PAGE WINDOWS. Double click on your WINDOW. Click on text element (left side of
header tab).
COCODE:
&WA_T001-BUKRS&
CNAME:
& WA_T001-BUTXT&
CCITY:
& WA_T001-ORTO1&
Come back. Save and activate (form activate).
Text Element:
Text element is the name given to the black of elements in the page window. The text element
name is followed by /E.
If we pass text element name in the WRITE_FORM function module then WRITE_FORM
transfers the data from driver program to all the statements which are defined under text element.
/E
*
*
*
SURYA
COCODE:
&WA_T001-BUKRS&
CNAME:
& WA_T001-BUTXT&
CCITY:& WA_T001-ORTO1&
When ever we are working with main window then we must pass text element name in the page
window. otherwise the first record will be printed twice.
LOOP AT IT_KNB1 INTO WA_KNB1.
CALL FUNCTION WRITE_FORM
/E
MAIN
EXPORTING
*
&WA_KNB1-BUKRS& &WA_KNB1ELEMENT
= MAIN
KUNNR& &WA_KNB1-AKONT&
WINDOW
= MAIN
.
ENDLOOP.
Footer:
PAGE NUMBER:
PAGE &PAGE& OF &SAPSCRIPT-FORMPAGES&
Current page
total no. of pages
Sign:
/:
IF &NEXTPAGE& EQ 0.
*
SURYA
/:
ELSE
*
PAGE &PAGE& OF &SAPSCRIPT-FORMPAGES&
/:
ENDIF
SAP-SCRIPT (FORM/LAYOUT) is client dependent. where as program is client independent.
Steps to COPY the FORM from one client to another client:
If the form is available in 800 client in $TMP package, if you want to copy into 810 client:
1. Execute SE71. in the menu bar click on utilities -> copy from client.
2. Provide your source form name. source client (800) and provide target form name (same as
source form name or different form name) execute.
If the form is available in 800 client in your own package (DEVK901449), if you want to copy in to
810 client:
1. Execute SCC1. Provide your source client (800). Provide your transport request
(DEVK901449). select check box INCL TASKS FOR REQUEST.
2. Click on Start immediately (F5) in the Application.
Steps to change the OBJECT PACKAGE (Development Class):
1. Execute SM30. provide the table/view as TADIR. click on maintain.
2. Select the check box of your request object and object name. execute.
3. Double click on object remove the old package and provide your new package ENTER.
Steps to maintain the BACK UP of SAP-SCRIPT layout or DOWNLOAD:
NOTE: RSTXSCRP is the standard program which is used to download as well as upload the SAPSCRIPT to PRESENTATION SERVER.
1. Execute SE38. provide program name RSTXSCRP. click on execute.
2. Provide your form name. mode is EXPORT (DOWNLOAD to local drivers). click on execute
provide your path. Execute.
Steps to UPLOAD or RE-LOAD the SAP-SCRIPT:
1. Execute SE38. provide program name RSTXSCRP. click on execute.
2. Provide your form name. mode is IMPORT (UPLOAD from local drivers). click on execute
provide your path name. ENTER (Transfer).
Steps to convert SAP-SCRIPT OUTPUT to PDF format:
This is the two step procedure.
1. Create SPOOL Request
2. Convert SPOOL to PDF
NOTE: RSTXPDFT4 is the standard report which is used to convert SPOOL TO PDF.
Steps to create SPOOL:
Execute Driver Program. provide input. click on execute. provide output device LP01. select the
Check box NEW SPOOL REQUEST. click on print.
Steps to identify the SPOOL:
Execute SP02. identify the SPOOL number.
Or
In Menu bar Click on SYSTEM ->
OWN SPOOL REQUEST.
Steps to convert SPOOL to PDF:
Execute SE38. Provide program RSTXPDFT4. Execute. provide your path and click on transfer.
Control Commands:
1. INCLUDE
2. DEFINE
3. ADDRESS..ENDADDRESS
4. PROTECT..ENDPROTECT
5. TOPENDTOP
6. BOTTOM...ENDBOTTOM
7. IF.ENDIF
8. CASE..ENDCASE
9. NEW-PAGE
10. SET DATE/TIME MASK
11. PERFORM.ENDPERFORM
12. NEW-WINDOW
1.
INCLUDE:
Include command is used to include the standard text which is defined in the SO10 transaction.
Steps to define Standard Text:
Execute SO10 transaction. Provide your standard text name. click on create and provide your text
information save.
Steps to include the Standard Text in the PAGE WINDOW:
Execute SE71. Open the Form in Change mode. Click on page window. click on text element.
place the cursor where you want place the standard text. click on Insert-> Activate.
Syntax:
/:
INCLUDE <std text name> OBJECT <obj name> ID <idname>.
2.
DEFINE:
Define command is used to declare the variables in the page window.
Syntax:
/:
DEFINE &<variable name>&
Example:
/:
DEFINE &dob& = feb21
3.
ADDRESS..ENDADDRESS:
AddressEndaddress is used to print the Address in the format of Target country.
/:
ADDRESS
*
&WA_KNB1-NAME1&
*
&WA_KNB1-ORT01&
*
&WA_KNB1-STRAS&
Street
*
&WA_KNB1-ORT02&
*
&WA_KNB1-PSTLZ&
Postal code
*
&WA_KNB1-LAND1&
/:
ENDADDRESS
4.
PROTECT..ENDPROTECT:
ProtectEndprotect is used to print the continuous text with out any page break.
First it checks the each and every page to print the continuous text. if there is no space is available
for all the pages then the system breaks the text and prints it.
/:
PROTECT
*
SURYA
*
PRAVEEN
*
SRI
/:
ENDPROTECT
5.
TOPENDTOP:
TopENDTOP is used to print the heading in the main window.
/:
TOP
*
SURYAPRAVEEN
SRI
/:
ENDTOP
6.
BOTTOM...ENDBOTTOM:
BOTTOMENDBOTTOM is used to print the footer information in the main window.
/:
BOTTOM
*
PRAVEENASURYA
/:
ENDBOTTOM
NOTE: TOPENDTOP & BOTTOMENDBOTTOM are works with in the main window only.
7.
IF.ENDIF:
IfEndif functionality is similar as in the ordinary ABAP (Reports).
8.
CASEENDCASE:
Case...Endcase functionality is similar as in the ordinary ABAP (Reports).
9.
NEW-PAGE:
New page command is used to break the page.
/:
IF
&WA_KNB1-KUNNR& = 218
*
NEW-PAGE
/:
ENDIF
10.
SET DATE/TIME MASK:
Set date/time mask command are used to display the data and time in different formats.
Syntax:
/:
SET DATE MASK = MMDDYYYY
*
DATE &DATE&
/:
SET TIME MASK = HHMMSS
*
TIME &TIME&
11.
PERFORMENDPERFORM:
This command is used to adding some additional logic to the standard driver program without
disturbing the standard driver program.
Syntax:
/:
PERFORM <FORM NAME> IN PROGRAM <PROGRAM NAME>
/:
USING &INPUT1&
/:
USING &INPUT2&
/:
/:
/:
CHANGING &OUTPUT1&
/:
CHANGING &OUTPUT2&
/:
/:
/:
ENDPERFORM
12.
NEW-WINDOW:
NEW-WINDOW is used to call the next window.
*
NEW-WINDOW
Difference between MAIN WINDOW and VARIABLE WINDOW:
MAIN WINDOW
3.
TOPENDTOP
&
BOTTOM
1.
Main window is the default window in
ENDBOTTOM are works in the main
SAP-SCRIPT. we cant create the main
window only.
window.
4.
Without main Window we cant create
2.
We can print the continuous text on the
SAP-SCRIPT.
main window.
5.
We can place the SAME MAIN
WINDOW up to 99 times per page.
6.
We can SPLIT the main window into
smaller windows.
1.
VARIABLE WINDOW
We cant create the variable window.
2.
4.
SAP-SCRIPFORM:
PAGEWINDOWS
WINDOW
DESCRIPTION
LEFT
RIGHT
WIDTH
HEIGHT
MAIN 00
Main Window
1.00 CM
6.50 CM
18.50 CM
10.00 CM
COMPANY
Company Address
10.50 CM
2.50 CM
9.00 CM
3.00 CM
FOOTER
Total Amount
1.00 CM
17.50 CM
18.50 CM
1.00 CM
TITLE
Title Window
1.00 CM
0.50 CM
18.50 CM
1.00 CM
VENDOR
Vendor Address
1.00 CM
2.50 CM
9.00 CM
3.00 CM
TEXT ELEMENTS:
FOR TITLE WINDOW
/:
BOX FRAME '20' TW
T
PURCHASE DOCUMENT
FOR MAIN WINDOW
/:
BOX FRAME 20TW.
/:
BOX XPOS '0' CM YPOS '1' CM WIDTH '185' MM HEIGHT '0' CM FRAME '20' TW
/:
BOX XPOS '4' CM YPOS '0' CM WIDTH '0' CM HEIGHT '101' MM FRAME '20'TW
/:
BOX XPOS '7.5' CM YPOS '0' CM WIDTH '0' CM HEIGHT '101' MM FRAME '20'TW
/:
BOX XPOS '11.5' CM YPOS '0' CM WIDTH '0' CM HEIGHT '101' MM FRAME '20'TW
/:
BOX XPOS '14.5' CM YPOS '0' CM WIDTH '0' CM HEIGHT '101' MM FRAME '20'TW
/:
TOP
M
..PURC.DOC ..ITEM..QTY..UOM..PRICE
/:
ENDTOP
/E
MAIN
M1
&WA_EKPO-EBELN&..&WA_EKPO-EBELP&..&WA_EKPO MENGE & ..
=
&WA_EKPO-MEINS&..&WA_EKPO-NETPR&
FOR COMPANY ADDRESS WINDOW
/:
BOX FRAME '20' TW
T
COMPANY ADDRESS
*
&WA_T001-BUKRS&
*
&WA_T001-BUTXT&
*
&WA_T001-ORT01&
*
&WA_T001-LAND1&
FOR VENDOR ADDRESS WINDOW
/:
BOX FRAME '20' TW
T
VENDOR ADDRESS
/:
ADDRESS
*
&WA_LFA1-LIFNR&
*
&WA_LFA1-NAME1&
*
&WA_LFA1-ORT01&
*
&WA_LFA1-STRAS&
*
&WA_LFA1-LAND1&
/:
ENDADDRESS
FOR FOOTER WINDOW
/:
BOX FRAME '20' TW
M1
TOTAL........&W_TOTAL&
NOTE: SPELL_AMOUNT is the function module which is used to print the amount in words.
The inputs for this function module are AMOUNT and CURRENCY.
The output for this function module is AMOUNT in WORDS.
NOTE: In the Real time based on the page. BASIS people create the page format as well as output device.
Based on these two things we develop the LAYOUT.
NOTE: In real time when ever we are working with LABELS we split the MAIN window depends on
label size.
Steps to Print The Output In Both Sides:
1. Execute SE71 Transaction, Provide your form name, Click on change mode.
2. Click on pages in the application tool bar.
3. Print attributes, Print mode D.
Steps to Access Multiple Layouts or Forms In The Same Driver Program (Or) Print Program:
1. Create an executable program and implement all the retrieving logic.
2. Access the layouts from the driver program by using OREN_FORM function module. Input for
the above function module FORM NAME (Optional).
3.
I. Start the each form by using START_FORM function module. Input is FORM NAME.
II. Transfer the data from driver program to particular page window by using
WRITE_FORM function module. Input is WINDOW NAME. Repeat the same step II for
all the page windows.
III. End each form by using END_FORM function module. Repeat the same step 3 for each
form.
4. Close the form by using CLOSE_FORM function module.
OPEN_FORM
START_FORM
WRITE_FORM
WRITE_FORM
END_FORM
START_FORM
WRITE_FORM
WRITE_FORM
END_FORM
START_FORM
WRITE_FORM
WRITE_FORM
WRITE_FORM
END_FORM
CLOSEFORM
NOTE:
Without a CLOSE_FORM we cant print the output.
Steps to Debug The Sap-Script:
METHOD1:
1. Execute SE71 Transaction. Provide form name.
2. In the menu bar -> UTILITIES -> ACTIVE DEBUGGER (Here only current form is in
debugging mode).
3. Execute the program. Provide sample input. Execute. ENTER.
4. Press F5 and identify the values.
METHOD2:
1. Execute SE38
2. Provide program name RSTXDBUG.
3. Execute the program. Provide sample input. Execute. ENETR.
4. Press F5 and identify the values.
NOTE:
TTXFP is the standard database table which contains form names as well as their driver
programs (Here sub programs are available).
NOTE:
TNAPR is the standard database table which contains applications, layouts and driver
programs (Main program).
Working With Standard Scripts:
The function of this standard script is
1. Change the layout
2. Adding some additional logic to the driver program.
NOTE:
NACE is the Transaction which contains all the applications, output types, their forms
and Driver Programs.
The output type is designed by the functional people. Each application having number of output
types depending on the document type.
Each output contains
a. Driver program
b. Layout
Steps to Change The Existing Layout:
STEP1: Identify the standard layout.
STEP2: Copy the standard form into Z form.
STEP3: Convert the original language to our required language.
STEP4: Change the layout as per client requirement.
STEP5: Place the new layout in the NACE Transaction.
STEP1 Steps to Identify the Standard Layout:
1. Execute NACE transaction
2. Select your application
3. Click on output types in the application toolbar.
4. Select your output type which is given by functional people (NEU-New PO Print out).
5. Double click on processing routines in the left panel and identify the standard form (Example:
MEDRUCK).
STEP2 Steps to Copy the Standard Form Into Z Form:
1. Execute SE71.
2. In the menu bar click on utilities -> COPY FROM CLIENT.
3. Provide your form name which is identified by the Standard form.
4. Provide
Source client : 000
Target form : <z-form>
5. Click on execute, Local object.
STEP3 Steps to Convert the Original Language to Our Required Language:
1. Execute SE71.
2. Provide your Z form name (created form in step2). Provide language DE, Click on change mode.
3. In the menu bar click on UTILITIES -> CONVERT ORIGINAL LANGUAGE.
From language
DE (German)
To language
EN (English)
4. ENTER.
SMARTFORM:
Smart forms are used to design the business documents such as purchase order, sales order,
invoice, Performa etc.
Smart forms are introduced from 4.6c version onwards. It also supports output mode as EMAIL.
Components of Smart forms:
1. Smart form layout.
2. Function module.
3. Print layout.
Components of the smart forms layout:
1. Global settings.
2. Pages and windows.
Components of Global settings:
1. Form attributes
2. Form interface
3. Global definition
Form attributes:
Form attributes contain header information i.e.
Form name
Language
Page format
Created by..
Form interface: this is used to declare the variables, work area and internal tables which we need to
transfer the data from print program to layout.
Global definition: this is used to declare the variables, work-area and internal table which are used to
implement the logic in the layout.
PAGES: page is the physical area where we place the window. We cant print the text in the page.
WINDOWS: we can place the same window in n number of pages but we cant print the data directly
on the window.
Procedure of Smart Form:
1. Based on the client requirement we design the smart form layout by using SMARTFORMS tcode.
2. After activating the smart form it generates a function module.
3. Based on the function module we develop the print program.
NOTE: Printing the data on the page window is always through symbols.
There are four types of symbols.
1. Program symbols
2. System symbols
3. Standard symbols
4. Text symbols.
Each symbol starts with & ends with &.
Differences between Sap scripts and Smart forms:
SAPSCRIPTS
6.
We cant use the same paragraph and
1.
Multiple page formats are not possible In
character formats more than once in a script.
SAPSCRIPTS.
SMARTFORMS
2.
SAPSCRIPT is client dependent i.e., that
1.
Multiple page formats are possible in
means if you create the form in one client that
SMARTFORMS.
is not available in all clients.
2.
SMARTFORMS are client independent.
3.
Without a main window we cant design
That means form is available in all the clients
SAPSCRIPT.
under the server if you create in any client.
4.
Colors are not possible in SAPSCRIPTS.
3.
Without a main window we can design the
5.
For complex coding we select the
smart form.
SAPSCRIPTS
4.
5.
7.
8.
9.
10.
11.
12.
6.
13.
1.
2.
3.
4.
5.
6.
25.
7.
8.
29.
9.
68. Steps to Provide Ms-Word as Text Editor in Smart form Or Sap script:
1. Execute I18N t-code.
2. Expand I18N customizing. Double click on MS-WORD as editor.
3. select the checkboxes
69.
SAPSCRIPT
SMARTFORMS
70. 4. Click on activate.
71.
(This is possible only after configuring the system).
72. Steps to Maintain the Backup (Or) Download the Smart form Layout:
1. Execute SMARTFORMS t-code
2. Provide your smart form name which you want to download.
3. In the menu bar click on utilities -> download form, ENTER
4. Provide file name, SAVE.
73. Steps to Reload the Smart forms (Or) Upload the Smart forms:
1. Execute SMARTFORMS t-code
2. Provide your smart form name and click on delete, yes.
3. In the menu bar click on utilities -> upload form, Provide your form name, ENTER.
4. Browse the file, click on LOCAL OBJECT.
74. NOTE:
75.
Whenever the smart form is transported from development server to quality server
and production server the function module name never transport.
76.
77.
78.
79.
80.
81. NOTE:
82.
SSF_FUNCTION_MODULE_NAME is the function module which is used to
generate the function module based on the smart form.
83. Input for this function module is Smart form name.
84. Output for this function module is function module name.
85. NOTE:
86.
If you want to declare the select-options in the SMART-FORMS then we must create
a structure with four fields.
1. SIGN (c,1)
2. OPTION (c,2)
3. LOW
Depends on
4. HIGH
input fields.
87.
After creating the structure we refer it to the smart form.
88. Steps to Create The Structure:
1. Execute SE11.
2. Select the radio button data type, Provide your structure name, click on create.
3. Select the radio button structure, Provide short description.
4. Click on predefined type (built-in-type), Provide the components.
89.
Component
data type
length
short description
90.
SIGN
CHAR
1
SIGN
91.
OPTIONS
CHAR
2
OPTIONS
92.
LOW
CHAR
4
LOW
93.
HIGH
CHAR
4
HIGH
94.
The length varies with the type like for P.O. Length is (C, 10).
95.
SAVE, CHECK, ACTIVATE structure.
96.
97.
98. OBJECT:
Based on the company code displaying the customers under company
99. Steps to Create Smart form:
1. Execute SMARTFORMS t-code
2. Provide your SMARTFORM name, click on create, Provide short description.
3. In the left panel click on form interface, under tables tab, Declare the select option
100.
S_BUKRS LIKE <STRUCTURE NAME>
4. Double click on global definitions in left panel, under types tab declare TYPES.
101.
TYPES: BEGIN OF TY_FINAL,
102.
BUKRS LIKE T001-BUKRS,
103.
BUTXT LIKE T001-BUTXT,
104.
KUNNR LIKE KNB1-KUNNR,
105.
END OF TY_FINAL.
5. Click on global definitions, under global data tab, declare the WA and IT.
106.
WA_FINAL TYPE TY_FINAL
107.
IT_FINAL TYPE TABLE OF TY_FINAL
6. Click on INITIALISATION tab, Provide input and output parameters and implement the logic.
108.
Input
output
109.
S_BUKRS
IT_FINAL
110. Logic:
111. SELECT T001~BUKRS T001~BUTXT KNB1~KUNNR INTO TABLE IT_FINAL FROM
T001 INNER JOIN KNB1 ON T001~BUKRS = KNB1~BUKRS WHERE T001~BUKRS IN
S_BUKRS.
7. Select the main window in the left panel, Right click -> create -> low logic -> loop.
112.
Double click on loop icon, in data tab provide
113.
IT_FINAL
INTO
WA_FINAL
8. Select the loop in the left panel -> right click -> create -> text.
114.
Text icon is created under main window.
115.
Double click on text icon, click on text editor -> Provide the data.
116.
&WA_FINAL-BUKRS& &WA_FINAL-BUTXT& &WA_FINAL-KUNNR&
117.
SAVE, CHECK, ACTIVATE the form.
9. In the menu bar click on environment -> function module name.
10. Based on the function module develop the print program in ABAP editor
118. ABAP Editor:
119.
DATA: FN_MODULE TYPE RS38L_FNAM.
120.
DATA V1 LIKE T001-BUKRS.
121.
SELECT-OPTIONS SO_BUKRS FOR V1.
122.
CALL FUNCTION SSF_FUNCTION_MODULE_NAME
123.
EXPORTING
124.
FORM NAME = <FORM NAME>
125.
IMPORTING
126.
FM_NAME = FN_MODULE .
127.
CALL FUNCTION FM_MODULE
128.
TABLES
129.
S_BUKRS
= SO_BUKRS .
130. (Here RS38L_FNAM is structure name of the function module
SSF_FUNCTION_MODULE_NAME, this is obtained by providing the function module name in
SE37 t-code. under export tab, you can get the structure name. you have to provide this because you
are creating structure for select-options.]
131. Steps To Convert Sap script Layout to Smart Form:
132. METHOD-1:
1. Execute SMARTFORMS t-code; provide your smart form name.
2. In the menu bar click on utilities -> migration -> import sap script form.
3. Provide your script form name, ENTER.
4. SAVE, CHECK, ACTIVATE the form.
133.
134.
METHOD-2:
135.
FB_MIGRATE_FORM is the function module which is used to convert script layout
to smart form.
136.
Here provide the function module name in SE37 and click on display and execute
and provide your script and target smart form name and execute and save. The script will
converted into smart form.
137.
Steps to convert SAP-SCRIPT OUTPUT to PDF format:
138.
This is the two step procedure.
3. Create SPOOL Request
4. Convert SPOOL to PDF
139.
NOTE: RSTXPDFT4 is the standard report which is used to convert SPOOL TO
PDF.
140.
Steps to create SPOOL:
141.
Execute Driver Program, provide input, click on execute, provide output
device LP01, select the Check box NEW SPOOL REQUEST, click on print.
142.
Steps to identify the SPOOL:
143.
Execute SP02, identify the SPOOL number.
Or
In Menu bar Click
on SYSTEM -> OWN SPOOL REQUEST.
144.
Steps to convert SPOOL to PDF:
145.
Execute SE38, Provide program RSTXPDFT4, Execute, provide your path
and click on transfer.
146.
Working With Smart Styles:
1. Smart styles are used to design the paragraph and character formats.
2. The T-code is SMARTSTYLES.
147.
Steps To Create Paragraph & Character Format:
148.
Paragraph Format:
1. Execute smart style T-code.
2. Provide your style name, click on create, Provide short description.
3. In the left panel select the paragraph formats. Right click -> create node, Provide
paragraph format name <P1>, ENTER.
4. Provide short description, under font tab provide
149.
Font family
ELVE
150.
Font size
6.0 pt
151.
Font style
OLD
152.
COLOR
5. Under tabs tab, Provide tab positions
153.
Repeat the same for all the paragraph formats.
154.
Character Formats:
6. In the left panel select character formats right click -> create node, provide your
character format name <C1>.
7. Provide short description, Under font tab provide
155.
Font family
ELVE
156.
Font size
6.0 pt
157.
Font style
OLD
158.
COLOR
159.
Repeat the same for all the character formats
8. In the left panel double click on the header data
160.
Standard settings
161.
Standard paragraph P1
162.
SAVE, CHECK, ACTIVATE the SMARTSTYLES.
163.
OBJECT:
Based on
the purchasing document number
display the vendor address and
purchasing document details.
164.
Steps to Design:
1. Execute SMARTFORMS.
2. Provide the smart form name, Click
on CREATE, provide short
description.
3. In the left panel click on form
interface, Under import tab
165. P_EBELN
LIKE EKKOEBELN
4. In the left panel click on global
definitions, Under types tab provide
types
166.
TYPES: BEGIN OF TY_EKKO,
167.
EBELN LIKE EKKO-EBELN,
168.
LIFNR LIKE EKKO-LIFNR,
169.
END OF TY_EKKO.
170.
TYPES: BEGIN OF TY_LFA1,
171.
LIFNR LIKE LFA1-LIFNR,
172.
ADRNR LIKE LFA1-ADRNR,
173.
END OF TY_LFA1.
174.
TYPES: BEGIN OF TY_EBELN,
175.
EBELN LIKE EKPO-EBELN,
176. EBELP LIKE EKPO-EBELP,
177.
MENGE LIKE EKPO-MENGE,
178. MEINS LIKE EKPO-MEINS,
179.
NETPR LIKE EKPO-NETPR,
180. END OF TY_EKPO.
181.
Under on global data tab,
182.
WA_EKKO
TYPE
TY_EKKO
183.
WA_LFA1
TYPE
TY_LFA1
184.
WA_EKPO
TYPE
TY_EKPO
185.
IT_EKPO
TYPE TABLE OF
TY_EKPO
186.
W_TOTAL
LIKE
EKPO-NETPR
187.
Under initialization tab
188.
Input
output
189.
P_EBELN
WA_EKKO
190.
WA_EKKO
WA_LFA1
191.
IT_EKPO
192.
Logic:
193.
SELECT SINGLE EBELN LIFNR FROM EKKO INTO WA_EKKO WHERE
EBELN = P_EBELN.
194.
SELECT SINGLE LIFNR ADRNR FROM LFA1 INTO WA_LFA1 WHERE
LIFNR= WA_EKKO-LIFNR.
195.
SELECT EBELN EBELP MENGE MEINS NETPR FROM EKPO INTO TABLE
IT_EKPO WHERE EBELN = P_EBELN.
5. Under main window in the left panel select the page right click -> create -> address.
6. Double click on address, Provide address number.
196.
&WA_LFA1_ADRNR&
7. In the left panel select address Right click -> create -> graphics.
197.
In the left panel double click on the graphics
198.
NAME
<SURYA>
199.
OBJECT
GRAPHICS
200.
ID
BMAP
201.
Select the radio button bitmap image
8. Select the main window in the left panel, right click -> create -> table.
202. Under the tables tab, select the line right click -> rename the line -> provide new
name, ENTER.
203.
In the left panel select double click on pages and windows, in the left most
corner you will find details, double click and provide cell widths as required.
204.
Click on the data tab.
205. LOOP:
206.
Internal table
IT_EKPO
INTO
WA_EKPO
9. Select the header in the table left panel Right click -> create -> table line. Select the line type
as LINE1 which name you have given in the 8th step.
207. In the left panel you can see cells under header
208.
Click on 1st cell -> right click -> create -> text.
209. Double click on the text Click on general attributes tab, Click on text editor. P1 PUR.DOC
210.
Provide your first column cell name (Repeat the same for all the cells).
10. elect the Main area in the left panel, Right click -> create -> table line (this is for providing
data in the columns in the main area 6 more cells will be provide under main area)
11. Select the first cell right click -> create -> text.
211.
Double click on text, click on text editor, Provide data.
212.
P2
&WA_EKPO-EBELN&
213.
Repeat the same step 12 for all the cells.
214. In the left panel select the net price. Right click -> create -> flow logic -> program lines.
215.
Double click on the code in the left panel.
216. Input
output
217.
EKPO-NETPR
W_TOTAL
218.
W_TOTAL = W_TOTAL + WA_EKPO-NETPR
219.
Under main window in the left panel, select the table in the left panel select the first
line, Right click -> insert -> empty line underneath (creates empty space for footer)
12. Select the new line right click -> rename line -> provide new name, ENTER.
13. Click on table Select the pattern, by clicking on the top most right corner.
220.
Click on display framed patterns Select your pattern.
14. Select the footer in the left panel right click -> create -> table line. Select the line.
221.
Select the cell -> create -> text.
222.
Click on text editor provide data with its paragraph.
223.
P3
TOTAL &W-TOTAL(C) & Here C refers to COMPRESS i.e. no space is
provided.
15. SAVE ,CHECK ACTIVATE the form
16. In the menu bar -> click on environment -> function module.
17. Based on the function module develop the print program in ABAP editor.
224. ABAP Editor:
225.
DATA FN_MODULE TYPE RS38L_FNAM.
226.
PARAMETER PR_EBELN LIKE EKKO-EBELN.
227.
CALL FUNCTION SSF_FUNCTION_MODULE_NAME
228.
EXPORTING
229.
FORM NAME = <FORM NAME>
230.
IMPORTING
231.
FM_NAME = FN_MODULE .
232.
CALL FUNCTION FM_MODULE
233.
TABLES
234.
P_EBELN
= PR_EBELN .
235. Events in Internal Table or Control Break Statements:
1.
2.
3.
4.
AT FIRST
AT LAST
AT NEW <field name>
AT END OF <field name>
236.
These events are work with in the LOOPENDLOOP of the internal table. Each
event ends with ENDAT.
237.
NOTE: Before using these events we must sort the internal table based on the new
field.
238. AT FIRST: This is the event which is
triggered at the first record of the internal table
239. Advantage: This is used to print the heading.
240. AT LAST:
This is the event which is
triggered at the last record of the internal table.
241. Advantage: This is used to print the grand
totals.
242. AT NEW:
This is the event which is
triggered at the new record of each block.
243. Advantage: This is used to print the individual
heading of each record.
244. AT END OF: This is the event which is triggered at the last record of each block.
245.
Advantage:
This is used to print the subtotals.
246.
247. REQUIREMENT:
248.
Logic:
249.
LOOP AT IT_EKPO INTO
WA_EKPO.
250.
AT FIRST.
251.
WRITE /PURCHASING
DOCUMENTS.
252.
ENDAT
253.
AT NEW EBELN.
254.
WRITE /WA_EKPO-EBELN.
255.
ENDAT
256.
WRITE : / WA_EKPOEBELP,WA_EKPO-MENGE,WA_EKPOMEINS, WA_EKPO-NETPR.
257.
S_TOTAL = S_TOTAL +
WA_EKPO-NETPR.
258.
G_TOTAL = G_TOTAL +
WA_EKPO-NETPR.
259.
AT END OF EBELN.
260.
WRITE: /SUBTOTAL, S_TOTAL.
261.
CLEAR W_STOTAL.
262.
ENDAT.
263.
ATLAST
264.
WRITE: / GRANDTOTAL IS
G_TOTAL.
265.
ENDAT.
266.
ENDLOOP.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288. BDC
289.
(Batch Data
Conversions/Communication)
290.
291. BDC is used to upload the data from the flat file to their particular Database table.
292. Writing a BDC Program is nothing but automate existing transaction code.
293. Each transaction can create only one record at time. If we want to create
thousands of records one way execute the same transaction thousand thousands of
time, another way is develop BDC Program to automate the existing Transaction
code.
294.
295. Some of the Important Transaction code:
1. XK01/MK01/FK01 Create Vendor.
14.
ME22N Change Purchasing
2. XK01 Central
Order
3. MK01 Material wise
15.
ME23N Display Purchasing
4. FK01 - Finance
Order
5. XK02/MK02/FK02 Change
16. VA01 Create Sales Order
Vendor.
17.
VA02 Change Sales Order
6. XK03/MK03/FK03 Display
18.
VA03 Display Sales Order
Vendor.
19. KS01 Create Cost Centre
7. XD01/VD01/FD01 Create Customer
20.
KS02 Change Cost Centre
8. XD02/VD02/FD02 Change
21.
KS03 Display Cost Centre
Customer
22. KE51 Create Profit Centre
9. XD03/VD03/FD03 Display
23.
KE52 Change Profit Centre
Customer
24.
KE53 Display Profit Centre
10. MM01 Create Material
11.
12.
26.
27.
29.
30.
33.
36.
45.
46.
48.
49.
51.
54.
55.
39.
57.
42.
62.
VF03 Display Billing
63.
64.
65.
66. STEPS TO DEVELOP THE BDC PROGRAM
1. Analyse the transaction code that means analyse the each and every screen and their field
information.
2. Extract the data from Non SAP to Flat file.
3. Upload the data from flat file to Internal Table /BDC Program.
4. For Each record in the internal table, we collect the screen and field details to automate the
existing transaction.
5. Call the transaction for each and every record in internal table.
73.
74.
75.
Vendor: _______
Account: ______
Provide
Name:________
76.
Search term: ___
77.
Country: _______
78. Note: Whenever we click on SAVE button record will be stopped.
79. Note: BDC_OKCODE is the last entry of any screen.
80. STEP2: Extract data from NON-SAP to Flat File
81.
Note: This is End user or Functional people job.
82.
83. Fig .1
84.
85. STEP 3:
86.
89. It is function module which is used to browse the file and as well as upload the
data to internal table. The input for above function module is FILE TYPE =
DAT the output for the function module is an internal table which is similar as
Flat File.
90.
91. Program:
92. *---------------------------------------------------------------------*
93. *WORKING WITH FILES USING UPLOAD FM
*
94. *---------------------------------------------------------------------*
95. REPORT YRAKESH_FILE1_UPLOAD.
96.
97. DATA: BEGIN OF WA_FILE,
98.
BUKRS LIKE T001-BUKRS,
99.
BUTXT LIKE T001-BUTXT,
100.
ORT01 LIKE T001-ORT01,
101.
END OF WA_FILE.
102. DATA IT_FILE LIKE TABLE OF WA_FILE.
103. CALL FUNCTION 'UPLOAD'
104.
EXPORTING
105.
FILETYPE
= 'DAT'
106.
TABLES
107.
DATA_TAB
= IT_FILE
108.
.
109. LOOP AT IT_FILE INTO WA_FILE.
110.
WRITE: / WA_FILE-BUKRS, WA_FILE-BUTXT, WA_FILE-ORT01.
111. ENDLOOP.
112. GUI_UPLOAD:
113.
It is function module which uploads data from Flat File to Internal
Table. The input for the above function module is File Name. The output above
function module is Internal Table which similar as Flat File.
114. F4_FILENAME:
115.
It is function module is used to browse the file the output for the function
module is filename.
116. AT SELECTION-SCREEN ON VALUE-REQUEST:
117.
It is an Event which is triggered at the time of user clicks F4 button.
118. Program 2:
119. *---------------------------------------------------------------------*
120. *PROG TO UPLOAD DATA FROM FLAT FILE TO INTRENAL TABLE
USING GUI_UPLOAD
121. *FM
122. *---------------------------------------------------------------------*
123. REPORT YRAKESH_FILE2_GUI_UPLOAD.
124. DATA: BEGIN OF WA_FILE,
125.
BUKRS LIKE T001-BUKRS,
126.
BUTXT LIKE T001-BUTXT,
127.
ORT01 LIKE T001-ORT01,
148
128.
END OF WA_FILE.
129. DATA IT_FILE LIKE TABLE OF WA_FILE.
130. DATA V1 TYPE STRING.
131. PARAMETER P_FILE LIKE IBIPPARMS-PATH.
132.
133. AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
134. CALL FUNCTION 'F4_FILENAME'
135. IMPORTING
136.
FILE_NAME
= P_FILE
137.
.
138. START-OF-SELECTION.
139. V1 = P_FILE.
140. CALL FUNCTION 'GUI_UPLOAD'
141.
EXPORTING
142.
FILENAME
= V1
143.
HAS_FIELD_SEPARATOR
= 'X'
144.
TABLES
145.
DATA_TAB
= IT_FILE
146.
.
147. LOOP AT IT_FILE INTO WA_FILE.
148.
WRITE: / WA_FILE-BUKRS, WA_FILE-BUTXT, WA_FILE-ORT01.
149. ENDLOOP.
150. ALSM_EXCEL_TO_INTERNAL _TABLE:
151. It is function module which is used to upload the data from Excel sheet to
Internal Table. The input for above function module is File Name, Begin Column,
Begin Row, End Column, and End Row. The output for above function module is
an Internal table which contains 3 fields Row, Column, Value
152. Program 3
153.
154. *---------------------------------------------------------------------*
155. *PROG TO UPLOAD DATA FROM EXCEL SHEET TO INTRENAL TABLE
USING
156. *ALSM_EXCEL_TO_INTERNAL_TABLE FM
157. *---------------------------------------------------------------------*
158. REPORT YRAKESH_FILE3_XSEL_FM.
159. ***DECLARE IT TABLE****
160. DATA: BEGIN OF WA_FILE,
161.
BUKRS LIKE T001-BUKRS,
162.
BUTXT LIKE T001-BUTXT,
163.
ORT01 LIKE T001-ORT01,
164.
END OF WA_FILE.
165. DATA IT_FILE LIKE TABLE OF WA_FILE.
166.
167. ***DECLARING IT FOR CONVERTING FM IT TO DATA IT.
168. DATA: WA LIKE ALSMEX_TABLINE, XCEL FM O/P IT TYPE
169.
IT LIKE TABLE OF WA.
149
170. ***DECLARATIONS
171. DATA V1 TYPE RLGRAP-FILENAME. "XCEL I/P FILENAME TYPE
172. PARAMETER: P_FILE LIKE IBIPPARMS-PATH. " F4_FILENAME FM
FILE_NAME TYPE
173. PARAMETER:
P_BC TYPE I,
174.
P_BR TYPE I,
175.
P_EC TYPE I,
176.
P_ER TYPE I.
177. AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
178.
CALL FUNCTION 'F4_FILENAME'
179.
IMPORTING
180.
FILE_NAME
= P_FILE
181.
.
182. START-OF-SELECTION.
183.
V1 = P_FILE.
184.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
185.
EXPORTING
186.
FILENAME
= V1
187.
I_BEGIN_COL
= P_BC
188.
I_BEGIN_ROW
= P_BR
189.
I_END_COL
= P_EC
190.
I_END_ROW
= P_ER
191.
TABLES
192.
INTERN
= IT
193.
.
194. ***LOGIC TO CONVERT XCEL FM TO OUR DATA IT.
195. LOOP AT IT INTO WA.
196.
CASE WA-COL.
197.
WHEN '0001'.
198.
WA_FILE-BUKRS = WA-VALUE.
199.
WHEN '0002'.
200.
WA_FILE-BUTXT = WA-VALUE.
201.
WHEN '0003'.
202.
WA_FILE-ORT01 = WA-VALUE.
203.
ENDCASE.
204. AT END OF ROW.
205.
APPEND WA_FILE TO IT_FILE.
206. ENDAT.
207. ENDLOOP.
208. ***DISPLAYING OUT PUT.
209. LOOP AT IT_FILE INTO WA_FILE.
210.
WRITE: / WA_FILE-BUKRS, WA_FILE-BUTXT, WA_FILE-ORT01.
211.
ENDLOOP.
212. DOWN LOAD:
213. It is function module which is used to browse the file as well as download the
data into Internal table from File.
150
214. The input for above function module is file type = DAT and Data Internal
Table which data you want download.
215. GUI_DOWNLOAD:
216. It is function module which is used to download data from Internal table to
Present Server.
217. The input for the above function module is File Name with Extension, an
Internal table which contains the data.
218.
219. APPLICATION SERVER:
220. It is SAP Directory the transaction code for SAP Directory AL11.
221. Steps to Download the data into Application Server:
222. 1. Open the file <Data set> in write mode.
223. 2. Loop at <Data Internal Table > Into <Work Area>.
224.
Transfer the data From <Work Area> to <File>.
225.
End loop.
226. 3. Close the file <data set>.
227. SYNTAX of Open Data Set:
228.
OPEN DATASET <file name> IN BINARY/TEXT FOR
OUTPUT/INPUT.
229. SYNTAX of Close Data Set:
230.
CLOSE DATASET<file name>.
231. SYNTAX of Transfer Data set:
232.
TRANSFER <Work Area Name> TO <File Name>.
233. Note: . (Dot) directory default directory in AL11.
234.
235. *---------------------------------------------------------------------*
236. *PROG TO DOWN LOAD DATA TO APPLICATION SERVER. (IN ECC 4.7)
*
237. *---------------------------------------------------------------------*
238. REPORT YRAKESH_FILE4_APP_SER_DOWN.
239. DATA : BEGIN OF WA_T001,
240.
BUKRS LIKE T001-BUKRS,
241.
BUTXT LIKE T001-BUTXT,
242.
ORT01 LIKE T001-ORT01,
243.
END OF WA_T001.
244. DATA IT_T001 LIKE TABLE OF WA_T001.
245. SELECT BUKRS BUTXT FROM T001 INTO TABLE IT_T001.
246. OPEN DATASET 'RAKESH' IN TEXT MODE ENCODING DEFAULT
FOR OUTPUT.
247.
LOOP AT IT_T001 INTO WA_T001.
248.
TRANSFER WA_T001 TO 'RAKESH'.
249.
ENDLOOP.
250. CLOSE DATASET 'RAKESH'.
251.
Date: 30.07.2010
151
268.
In Data Dictionary we have one Structure BDCDATA which contains
above five fields, so that we simply declare our internal table by referring
BDCDATA structure.
269. STEP5:
270. Calling the transaction is of two types
1. Call Transaction Method
2. Session Method
271.
152
amount of data
5. Call transaction is immediate Database
update.
6. Call transaction returns SY-SUBRC
7. Back schedule is not possible
8. This Synchronous update, Asynchronous
process
283.
289.
290.
291.
2. LOOP AT <Data Internal Table>
292. ----293. ----Collect the Screen and Field details
294. ----295. CALL FUNCTION BDC_INSERT.
296. The input for function module is
1. Transaction code.
2. BDC Data Internal Table.
297.
ENDLOOP.
298. OBJECT:
299.
Develop a conversion program to upload the vendor master data by
using Session method the Flat file contains Vendor number, Company code, Name,
Search term , recon account , Cash management group.
300. Steps to Process the Session
:
Execute SM35
Select Session name.
Click on Process application tool bar.
301.
OBJECT:
153
302.
Upload the vendor as well as customer master data by using BDC
session method the Vendor flat file contains vendor number, name, search term and
city. The customer flat file contains customer name, Search term and city.
303. HINTS:
304. IT_VENDOR
305. IT_CUSTOMER
306. CALL FUNCTION BDC_OPEN_GROUP
307.
I/P : GROUP = MTCODE.
308.
USER = RAKESH
309. LOOP AT IT_VENDOR INTO WA_VENDOR.
310.
311.
Vendor.
312.
-----------------------
-------------
318.
319.
Customer.
320.
-----------------------
-------------
321. ENDLOOP.
322. CALL FUNTION BDC_INSERT.
323. I/P: TRANSACTION CODE = XD01.
324.
BDC DATA INTERNAL TABLE = IT_BDCDATA.
325. ENDLOOP.
326. CALL FUNCTION BDC_CLOSE_GROUP.
327.
154
340.
341.
342.
155
423.
424.
425.
426.
427.
428.
429.
430.
431.
432.
433.
434.
435.
436.
437.
438.
439.
440.
441.
442.
443.
444.
-
IDOC
7/8/10
Different types of distributing the data
1. Send entire copy
2. Send changes only (change pointer technique)
3. Get entire copy
Send change only (change pointer technique)
Whenever the changes occurred in the master data the standard sap
itself prepare one change document.
SMD (shared master data) is a tool which reads the distribution model
and indentifies the interested receiver.
If any receiver is available then it generates the change pointer for
the change document.
The change pointer technique reads the change pointer and
generates as well as dispatch the communication IDOC to their
particular receiver system.
445.
446.
447.
CDHDR
CDPOS
448.
(CHANGE DOCUMENT HEADER TABLE)
DOCUMENT ITEM TABLE)
449.
450.
451.
452.
453.
(CHANGE
2. RECEIV
ER
5. LS810_S
AP1
3. MSG
TYPE
6. CREMA
S
157
454.
IF ANY RECEIVER IS AVAILABE
455.
IF GENERATE CHANGE POINTER THE
CHANGE DOCUMENT
456.
DCP TABLE
457.
CHANGE POINTER TECHIQUE GENERATE
AS WELL AS
DISPATCH THE IDOC AS
RECEIVER
458.
459.
NOTE
-
Open the CDHDR the pass the obj ID as our vendor no, customer no,
and identify the obj class, changeneres.
Open the CDPOS table and pass the obj class ,obj ID and changes
which is identified in the CDHDR and get the old and new values of
object.
460.
461.
462.
463.
464.
systems.
465.
466.
467.
468.
generally.
469.
470.
471.
472.
473.
474.
475.
receiver system.
476.
477.
478.
479.
480.
481.
482.
483.
484. SENDER
485.
486.
487.
158
488.
CREFET
489.
490.
VENDOR
CREMAS
CUSTOMER
DEBFET
MATERIAL
MATFET
DEBMAS
MATMAS
491.
492.
NOTE :
493.
-EDIMSG is the standard data base table which contains
msg types and requesting msg types and idoc types.
494.
-ALEREQ01 is the idoc type for any requesting msg type.
495.
496.
497.
498.
499.
500.
501.
502.
503.
504.
505.
506.
507.
508.
509.
510.
511.
512.
513.
514.
515.
516.
517.
518.
519.
520.
521.
522.
523.
524.
525.
526.
527.
528.
529.
159
530.
531.
532.
533.
534.
800 CLIENT)
535.
536.
537.
538.
tool bar
539.
540.
541.
542.
543.
bar
544.
545.
546.
547.
548.
549.
550.
551.
552.
553.
554.
555.
556.
557.
558.
559.
560.
561.
562.
563.
564.
565.
566.
567.
568.
569.
570.
571.
572.
-execute BD64
-click on change mode
-click on create model view on application
-provide short description
-provide technique name
-enter
-select the distribute model
-click on add msg type in the application tool
-provide
Sender
Receiver
Msg type
-enter
-repeat the same for all the receiver and msg type
-click on save
Steps to create port
-Execute WE21
-Select the transactional RFC
-Click on create in application tool bar
-Enter
-It automatically generate on port number
-provide short description
RTF destination
-Save
Steps to create outbound partner profile
-Execute WE20
-Select your partner in the left panel
-click on create outbound parameter
-provide your msg type
Port number
Basic type
-Save
Steps to send the quest
160
573.
574.
575.
576.
577.
578.
579.
580.
581.
582.
583.
584.
585.
586.
587.
588.
589.
590.
591.
592.
593.
594.
595.
596.
598.
599.
600.
601.
602.
603.
604.
605.
606.
607.
608.
609.
610.
611.
612.
613.
614.
615.
616.
-Execute BD15
COPY THE FORM
-Click execute
test idoc by using the WE05 (or) WE02
Steps to create the INBOUND PARTNER PROFILE
-Execute WE 20
-select the partner LS810-SAP1
-Provide msg type
Process code
-Save
test the idoc by using the WE05 (or ) WE02
Reprocess the idoc by using the BD81
IDOC FILTERING
Filter techniques
SEGMENT FILTERING
REDUCED IDOC
IDOC FILTERING
-Idoc filtering is always placed at the distribution model
597.
-Before generating the communication idoc the ALE service layer
reads the
distribution model and identify the interesting receiver.
-If any receivers available then it check the filtering condition
whether the given input satisfy
The filter condition or not.
-If it satisfies then only it generate communication IDOC.
Steps to create IDOC Filtering
Creating distribution model
-Execute BD64
-Expand your distribution model
-Expand msg type
-Double click no filter set
-Double click on create filter group
-Expand data filtering
-Expand filter group
-Double click on material type
-Click on insert line
-provide your material type
-Enter
-Enter
-Save
161
617.
618.
Create partner profile by using the WE 20
619.
620.
NOTE : IDOC filtering is used to drop the IDOC at run time.
621.
622.
623.
9/8/10 - 10/8/10
624.
SEGMENT FILTERING
625.
-Segment filtering is used to drop the segment permanently
626.
-The transaction code for segment filtering is BD56
627.
Steps to work with segment filtering
628.
After executing the WE05 (test the idoc)
629.
Execute BD56
630.
-Provide msg type
631.
-Click on new entries in the application tool bar
632.
-Provide your
633.
Segment Type
Sender
Type
Receiver
E1LFA1
LS
LS800_SAP1
LS
LS810_SAP1
634.
-Save
635.
-Enter
636.
Test the idoc by using the WE05
637.
638.
REDUCED IDOC
639.
-Reduced idoc is used to drop the segment as well as fields
permanently.
640.
-The transaction code for reduced idoc is BD53
641.
-Here we create a new msg type with the existing msg type.
642.
-Based on the new msg type configure the ALE.
643.
(Create distribution model , create output partner profile)
644.
Steps to work with Reduced IDOC
645.
-Execute BD53
646.
-Provide new msg type
647.
-Click on create
648.
-Provide your reference msg type
649.
-Provide short description
650.
-Enter
651.
Note :
652.
*We cant drop the mandatory segment which are in light green color
653.
-Select the required segment
654.
-Click on select the option in the application tool bar.
655.
-Double click on the segment select the fields click on select.
656.
-Repeat the same for all the segment .
657.
-Click on save.
658.
-With this new msg type we create the distribution model and out bound
partner profile
162
659.
660.
Difference b/w Segment filtering & Reduced idoc
661.
662.
SEGMENT FILTERING
663.
REDUCED IDOC
664.
In the segment filtering is used
665.
This is used to drop the
to drop the segment permanently.
segment as well as fields permanently.
666.
Here we no need to change the
667.
It generates the new msg type
ALE configuration.
based on this we configure the ALE.
668.
Here selected segment will be
669.
Here selected segment only
drop.
transformed.
670.
The transaction code is BD56
671.
The transaction code is BD53
672.
673.
674.
NOTE:
675.
-In the real time when ever we executing ABAP related transaction
code , if we get the error (your not authorized for the Transaction code and
transaction name) in the status bar , then we must execute SU53 transaction and
take the print screen and sends to basis (or) security people.
676.
677.
678.
679.
CUSTOM IDOC
680.
ALE configuration settings for the custom idoc outbound .
1. Create segment (WE31)
2. Create idoc (WE30)
3. Create message type (WE81)
4. Link the message type to idoc type (WE82)
5. Create the port number (WE21)
6. Create the outbound partner profile (WE20)
7. Distribution model is not required if we pass control record information
in the program.
681.
Steps to create Segment
682.
-Execute WE31
683.
-provide your segment name with z1
ex:
Z1VEN_SEG
684.
-Click on create.
685.
-Provide short description
686.
-provide
687.
FIELD NAME
DATA ELEMENT
688.
EID
ZZEID
689.
ENAME
ZZENAME
690.
691.
692.
-Click on save.
693.
NOTE
163
694.
-When ever we create the segment at the time an equal ant
structure is create in the DDIC as well as create segment definition.
695.
696.
Steps to create IDOC
697.
-Execute WE30
698.
-Provide your object name
699.
Ex: Zven_idoc
700.
-Click on create
701.
-provide short description
702.
-Enter
703.
-Select the idoc
704.
-Click on create segment
705.
-provide your segment name
706.
-Provide Max and Min values
707.
Max val
708.
Min val
709.
710.
-Save
711.
Save
712.
713.
Steps to create msg type
714.
-Execute WE 81
715.
-Click on change mode in application tool
716.
-Enter
717.
-Click in new entries in application tool bar.
718.
-Provide your msg type and short description
719.
-Click on save.
720.
721.
Steps to link the msg type to idoc type
722.
-Execute WE82
723.
-Click on change mode
724.
-Click new entries in the application tool bar
725.
-Provide your msg type basic type extension type
726.
-Save
727.
728.
Steps to Identify the release
729.
-Execute SE11
730.
-Open the table EDIMSG
731.
-Click on content
732.
-Click on execute
733.
-Select the Release field
734.
-Click on descending
735.
736.
Steps to create port number
737.
-Execute the WE21
738.
-Select transaction RFC
164
739.
740.
741.
742.
743.
744.
745.
746.
747.
748.
749.
750.
751.
752.
753.
754.
755.
756.
757.
758.
759.
760.
761.
762.
763.
764.
765.
766.
767.
768.
769.
770.
771.
772.
773.
774.
775.
776.
777.
778.
779.
780.
781.
782.
783.
784.
-Click on create
-Select the radio button own port
-provide your partner name
-Enter
-provide short description
- Provide RFC destination
-Click on save
Steps to create outbound partner profile
-Execute WE20
-Select the partner type LS
-Click on create
-Provide partner number
-Save
-Click on create outbound parameters
-provide msg type
-port number
-Select the radio button transfer IDOC
Immediate
-IDoc basic type
-Save
TO
165
785.
786.
787.
788.
STEP 2 . BASED ON THE INPUT THE PREPARE THE MASTER
DATA
789.
790.
OUTBOUND
DISTRIBUTED MODELPROGRAM
791.
7. SEN
8. RE
9. MS
792.
APPLICATION
LAYER
MASTER
DATA
DE
CEI
G
793.
R
VE
TYP
794.
ALV
R
E
SERVICE
LAYER
10.
11.
12.
795.
IDOC1
IDOC2
796.
797.
798.
799.
ALE COMUNICATION LAYER
DISPATCH TO RECEIVER
800.
801.
STEP 3.
IDENTIFY THE RECEIVER
802.
STEP 4.
DISPATCH THE IDOC TO THEIR PARTICULAR RECEIVER
803.
804.
805.
Steps to
develop the custom idoc outbound program
1. Design the selection screen as fallows
806.
VENDOR
807.
MSG TYPE
808.
LOCAL SYS
809.
2. Generate the master idoc
TO
810.
(Based on the
given input we fetch the data base and place it into an in internal table)
3. Collect the control records information
811.
Receiver ,msg type , idoc --- )
(Sender ,
812.
4.Generate
as well as dispatch the communication idoc to their particular receivers.
813.
Design the
selection screen
814.
DATA V1 LIKE ZVEN_EMPDET-EID.
166
815.
SELECTION-SCREEN : BEGIN OF BLOCK B WITH FRAME
TITLE TEXT-001.
816.
SELECT-OPTIONS S_EID FOR V1.
817.
PARAMETER : P_MSG TYPE EDI_MESTYP OBLIGATORY ,
818.
P_LSYS TYPE LOGSYS.
819.
820.
SELECTION-SCREEN END OF BLOCK B.
821.
822.
Steps to
identify the data element of msg type and logical system
823.
-Execute
BD14 or BD16 or BD12
824.
-Place the
cursor msg type
825.
-Click on
F1
826.
-Click on
technical setting
827.
-Identify
the data data element
828.
829.
Generate the
master idoc
830.
NOTE :
Whenever we are working with custom idoc then we must declare one internal
table one internal table for data , one internal table for control record , one
internal table for communication idoc .
831.
832.
833.
SOURCE CODE FOR OUTBOUND PROCEE :
834.
835.
DATA : IT_DATA LIKE TABLE OF EDIDD,
836.
WA_DATA LIKE LINE OF IT_DATA.
837.
838.
DATA : IT_CONT LIKE TABLE OF EDIDC,
839.
WA_CONT LIKE LINE OF IT_CONT.
840.
841.
DATA : IT_COMM LIKE TABLE OF EDIDC,
842.
WA_COMM LIKE LINE OF IT_COMM.
843.
844.
DATA : WA_SEG LIKE Z1MADHU_SEG,
845.
IT_SEG LIKE TABLE OF WA_SEG.
846.
847.
SELECT EID ENAME EWMD ETRT FROM ZVEN_EMPDET INTO
TABLE IT_SEG WHERE
848.
EID IN S_EID.
849.
167
850.
LOOP AT IT_SEG INTO WA_SEG.
851.
WA_DATA-SEGNAM = 'Z1V_CS'.
852.
WA_DATA-SDATA = WA_SEG.
853.
854.
APPEND WA_DATA TO IT_DATA.
855.
CLEAR WA_DATA.
856.
857.
ENDLOOP.
858.
859.
WA_CONT-MESTYP = 'ZV_CMSG'.
860.
WA_CONT-RCVPOR = 'ZV_PORT'.
861.
WA_CONT-RCVPRT = 'LS' .
862.
WA_CONT-DOCTYP = 'Z1V_CID'.
863.
WA_CONT-RCVPRN = 'LS810-SAP1'.
864.
APPEND WA_CONT TO IT_CONT.
865.
CLEAR WA_CONT.
866.
867.
LOOP AT IT_CONT INTO WA_CONT.
868.
869.
870.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
871.
EXPORTING
872.
MASTER_IDOC_CONTROL
= WA_CONT
873.
TABLES
874.
COMMUNICATION_IDOC_CONTROL
=
IT_COMM
875.
MASTER_IDOC_DATA
=
IT_DATA.
876.
877.
commit WORK.
878.
ENDLOOP.
879.
880.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
881.
EXPORTING
882.
I_CALLBACK_PROGRAM
= SY-CPROG
883.
I_STRUCTURE_NAME
= 'EDIDC'
884.
*
IMPORTING
885.
TABLES
886.
T_OUTTAB
= IT_COMM.
887.
888.
Collect the
control records information is nothing but fill an internal table which contains the
fallowing fields
889.
RCVPOR RECEIVER PORT
890.
RCVPRT RECEIVER PARTNER TYPE
168
891.
RCVPRN - RECEIVER PARTNER NUMBER
892.
DOCTYP- IDOC TYPE
893.
MESTYP MESSAGE TYPE
894.
895.
SAMPLE
CODE :
896.
897.
WA_CONT-MESTYP = 'ZV_CMSG'.
898. WA_CONT-RCVPOR = 'ZV_PORT'.
899. WA_CONT-RCVPRT = 'LS' .
900. WA_CONT-DOCTYP = 'Z1V_CID'.
901. WA_CONT-RCVPRN = 'LS810-SAP1'.
902. APPEND WA_CONT TO IT_CONT.
903.
-Repeat the
same for all the receiver
904.
905.
MASTER_IDOC _DISTRIBUTE is function model which is used generate
as well as dispatch
906.
the
communication idoc to their particular receiver system.
907.
-This
function model acts like both ALE service layer as well as ALE communication
idoc to
908.
their
particular receiver system.
909.
-This
function model acts like both ALE service layer as well as ALE communication
layer.
910.
-The input
for the above function model control records work area and data internal table.
911.
-The output
for the function model is communication idoc internal table .
912.
913.
914.
SAMPLE
CODE
915.
916.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
917.
EXPORTING
918.
MASTER_IDOC_CONTROL
= WA_CONT
919.
TABLES
920.
COMMUNICATION_IDOC_CONTROL
=
IT_COMM
169
921.
MASTER_IDOC_DATA
IT_DATA.
922.
923.
924.
by using the WEO5.
925.
926.
927.
928.
929.
930.
931.
932.
933.
934.
935.
936.
937.
938.
939.
940.
941.
942.
943.
944.
945.
170