You are on page 1of 83

1 SAP-ABAP ENTERPRISE RESOURCE PLANNING (ERP): ERP is a package which provides solution for departmental functionalities of an organization.

SAP SAP SAP R!le ADVANTAGES: SAP can support any database at the back end. Platform independent. Supports multiple languages. Faster b w networks. !an support any database in the backend. "ransaction failure is very less comparing # other erp packages $%.%&'(. life cycle implement ti!n" Package evaluation. Pro)ect planning and designing. Proto type. *ap analysis. +usiness process re,engineering. s w installation and testing. End user training. Application transportation. *o live. Support and maintenance. l n#$c pe: -evelopment server $functional(. .uality server$ testing(. Production server $end,user uses the system(. !f ABAPe%: Screen creation. "able creation. -ata migration. Reporting. Redirecting SAP data from d,base to o p devices.$scripts / forms(.

R&' 0 real time data processing. ABAP&( 0 advanced business application programming. 1f a language provides a d,base by default is called 2th generation language.

R&' ARC)ITECTURE CO*PONENTS: +" DISPATC)ER - "his component acts as an interface between the P3 and AS. 1t receives user4s re5uest from P3 and allocates a work area for each re5uest from the user. ," -OR. PROCESS , "his component allocates memory area for each re5uest received from dispatcher on a roll,in and roll,out basis. 6nce a re5uest is processed7 the memory area is rolled out to allocate for ne8t re5uest from dispatcher. '" DATABASE CONNECTIVIT/ , 6PE9 S.3 , 1t receives each user4s re5uest in open S.3 format $19SER"7 :P-A"E7 -E3E"E7 ;6-1F<( and converts them in native S.3 format $-atabase used at the back end(. , 9A"1=E S.3 , 1t checks for synta8 errors in re5uests received and passes the re5uest to database through gateway service. (" *ESSAGE SERVICE , 1f there are any synta8 errors in re5uests received7 the 9ative S.3 component uses message service to raise error messages for the end user from the message pool. ;essage pool is a container of user, defined and pre,defined messages. 0" GATE-A/ SERVICE , 1f there is a distributed database at the back end7 user4s 5ueries are redirected to appropriate database using gateway service. "his component acts as an interface between AS and -3.

-)AT IS CLIENT IN SAP1 !31E9" is the topmost hierarchy in SAP database. Each functional module in SAP is assigned a client. "he ob)ects developed by A+APer for each module is stored in a package and re5uest number and finally saved under a client number assigned for the particular module.

"he development ob)ects in SAP is divided into two types> REPOSITOR/ OB2ECTS E?E!:"A+3E PR6*RA;S 19!3:-E PR6*RA;S ;6-:3E P663 PR6*RA;S ;ESSA*E !3ASSES S:+R6:"19E P663S F:9!"169 *R6:PS !3ASS P663S

DATA DICTIONAR/ OB2ECTS "A+3ES =1E@S -A"A "<PES -6;A19S "<PE *R6:PS SEAR!A AE3PS 36!B 6+CE!"S

LOGGING INTO SAP: !31E9" > D%% :SER9A;E > SAP:SER PASS@6R- > =1" 3A9* > E9 $6P"169A3( CREATING A PAC.AGE IN SAP: PA!BA*E is a folder created by A+APer to store his own development ob)ects in SAP. N 3i4 ti!n$ t! c%e te p c5 4e:

Enter 4SE#E4 "code in !ommand Prompt area of SAP EAsy Access Screen ,F Press Enter ,F 6pens Package +uilder Screen ,F Select Package Radiobutton ,F Specify Package 9ame starting with G or < ,F !lick on !reate pushbutton ,F 6pens an interface ,F Enter Short -escription for your package ,F Select Software !omponent as A6;E ,F !lick on Save ,F 6Pens another interface to assign re5uest number ,F !lick on !REA"E RE.:ES" ,F 6pens interface ,F Enter short description ,F !lick on !ontinue ,F A Re5uest number is

4 created and assigned for your package ,F !lick on !ontinue ,F A package is created ,F Save ,F !ome back. CREATING PROGRA*S IN SAP EDITOR: SE&D is the "code used to open A+AP editor7 where we create source code. N 3i4 ti!n$ t! c%e te $imple p%!4% m in SE'6 E#it!%: SE&D ,F 6pens A+AP Editor 1nitial screen ,F Specify program name starting with G or < ,F Select Source !ode radio button ,F !lick on !reate pushbutton ,F 6pens another interface ,F Enter short description for program ,F Select Program type as E8ecutable Program ,F !lick on Save ,F Specify Package 9ame ,F Assign re5uest number ,F !lick on continue ,F 6pens A+AP Editor page. C7 % cte%i$tic$ !f ABAP P%!4% m: A+AP is not case sensitive. A+AP is case sensitive only during comparison. Every A+AP statement should end with a period $full stop(. !"R3HS shortcut key is used to save A+AP codes in editor. !"R3HFE shortcut key is used to transform the screen into !AA9*E -1SP3A< mode. !"R3HF# shortcut key is used to check for synta8 errors in source code. !"R3HF& shortcut key is used to activate current program.

ACTIVATION: "his concept is used to make the current ob)ect to be accessible by other ob)ects within the same client or different client or vice versa. FD function key is used to e8ecute the A+AP program $-irect Processing(. !"R3HI is used to comment the A+AP statement. !"R3HF is used to de comment the A+AP statement.

=AR1A+3E -E!3ARA"169 19 A+AP> -A"A is the statement used to declare variables in A+AP. E4" c!#e: -A"A A "<PE 1. A J E%%. @R1"E A.

5 1n the above code7 A is a variable of integer type. A is assigned a value 4E%%4. @R1"E statement is used to print out the value of A. "he output of a program is printed in 3PS $list,processing screen(. "he default value of an integer data type is 4%4. "he default value of a character data type is 49:334. An integer variable takes EE character spaces in 3PS screen to print out its value and the value is printed in right,)ustified manner. "he first E% character space is used to print the value and the EEth character space is for sign $positive or negative(.

e4" c!#e: -A"A A "<PE 1 =A3:E 4,E%%4. @R1"E A 3EF",C:S"1F1E-. "<PE statement is used to assign data type for the variable declared. =A3:E statement is used to assign initial value for the variable.

ABAP GUI
A+AP screens can be created using the following two statements> E. PARA;E"ERS #. SE3E"169,S!REE9 "he following statements are used in common> +" PARA*ETERS to create input bo8es7 checkbo8es and radio buttons. #. SE3E!"169,S!REE9 +E*19 6F 319E , E9- 6F 319E. , "his statement is used to create input fields in a same row. '" SELECTION-SCREEN CO**ENT. , "his statement is used to specify the positions and label names for each input field declared using begin of line , end of line. e4" c!#e Selection,screen begin of line. selection,screen comment E%$EK( lb# for field a. Parameters> a $E%(. selection,screen comment K%$EK( lb& for field b. parameters > b$E%(. selection,screen comment $EK( lb2. parameters > c$E%(. selection,screen end of line. selection,screen pushbutton E%$E%( 3+E user,command P+E. 1nitialization. lbE J 4PR19"4. lb# J 4enter A value4. lb& J 4enter + value4. at SE3E!"169,S!REE9.

7 case sy,ucomm. when 4P+E4. 3EA=E "6 31S",PR6!ESS19*. write > a7 b . endcase. (" SELECTION-SCREEN POSITION" "his statement is used to specify the position of input fields. "here are two attributes for specifying position using this statement. "hey are> P6SL36@ P6SLA1*A E*. SE3E!"169,S!REE9 SE3E!"169,S!REE9 PARA;E"ERS A$E%(. SE3E!"169,S!REE9 PARA;E"ERS +$E%(. SE3E!"169,S!REE9 +E*19 6F 319E. P6S1"169 P6SL36@. P6S1"169 P6SLA1*A. E9- 6F 319E.

0" SELECTION-SCREEN BEGIN O8 SCREEN - END O8 SCREEN" , "his statement is used to create a screen in *:1. A screen number should be specified for each user,defined screen. "his screen can be called within the program using the following statement> CALL $electi!n-SCREEN 9$c%een:n;m<e%=" eg. SE3E!"169,S!REE9 +E*19 6F S!REE9 E%% "1"3E "E. SE3E!"169,S!REE9 +E*19 6F +36!B +E. PARA;E"ERS > !AE AS !AE!B+6?7 !A# AS !AE!B+6?7 !A& AS !AE!B+6?. SE3E!"169,S!REE9 E9- 6F +36!B +E. SE3E!"169,S!REE9 +E*19 6F +36!B +#. PARA;E"ERS > R+E RA-16+:""69 *R6:P A7 R+# RA-16+:""69 *R6:P A7 R+& RA-16+:""69 *R6:P A. SE3E!"169,S!REE9 E9- 6F +36!B +#.

8 SE3E!"169,S!REE9 P:SA+:""69 E%$E%( 3+E :SER,!6;;A9- P+E. SE3E!"169,S!REE9 E9- 6F S!REE9 E%%. SE3E!"169,S!REE9 +E*19 6F S!REE9 #%% AS @19-6@ "1"3E "#. PARA;E"ERS > -$E%(7 E$E%(7 F$E%(. SE3E!"169,S!REE9 E9- 6F S!REE9 #%%. initialization. tE J 4SE3E!" !AE!B+6?ES A9- RA-16+:""69S4. "# J 4PARA;E"ERS4. at selection,screen. case sy,ucomm. @AE9 4P+E4. !A33 S!REE9 #%%. E9-!ASE. >" SELECTION-SCREEN BEGIN O8 BLOC. - END O8 BLOC." "his statement is used to create blocks within the screen area. ?" SELECTION-SCREEN PUS)BUTTON. , "his statement is used to create pushbuttons in *:1. S<9"A?> SE3E!"169,S!REE9 P:SA+:""69 Istarting positionF$pushbutton length( IlabelL=ariableF :SER,!6;;A9- Ipushbutton nameF. @henever a pushbutton is created and e8ecuted7 a system variable S<, :!6;; holds the arguments for the pushbutton. 191"1A31GA"169 and A" SE3E!"169,S!REE9 are the selection,screen events. :sing these type of events7 A+AP is called as event,driven programming. @henever the selection,screen programs are e8ecuted7 the order of e8ecution of events will be> 191"1A31GA"169. A" SE3E!"169,S!REE9. S"AR",6F,SE3E!"169.

9 "6P,6F,PA*E. E9-,6F,PA*E. E9-,6F,SE3E!"169. E*. !6-E PARA;E"ERS > A$E%(7 +$E%(. SE3E!"169,S!REE9 P:SA+:""69 E%$E%( 3+E :SER,!6;;A9- P+E. 191"1A31GA"169. 3+E J 4PR19" A4. A" SE3E!"169,S!REE9. !ASE S<,:!6;;. @AE9 4P+E4. 3EA=E "6 31S",PR6!ESS19*. @R1"E > A7 +. E9-!ASE. 1n the above code7 AT SELECTION-SCREEN event is used to hold the event functionalities of the pushbuttons declared within the program. @henever a pushbutton is created and e8ecuted7 A" SE3E!"169,S!REE9 event get triggered. INITIALI@ATION event is used to declare initial display values for the pushbutton component in the selection,screen. S/-UCO** system variable holds the arguments of pushbutton and passes these arguments dynamically to the screen. LEAVE TO LIST-PROCESSING statement is used to print the statements in 3PS7 because these statements cannot be printed inside selection,screen. After e8ecuting the program7 use 4+A!B4 statement in the command prompt of 3PS to come back to the selection,screen and then come back to the program. E*. !6-E # PARA;E"ERS > A$E%(7 +$E%(.

10 SE3E!"169,S!REE9 P:SA+:""69 E%$E%( 3+E :SER,!6;;A9- P+E. selection,screen skip. SE3E!"169,S!REE9 P:SA+:""69 E%$E%( 3+# :SER,!6;;A9- P+#. 191"1A31GA"169. 3+E J 4PR19" A4. lb# J 4E?1"4. A" SE3E!"169,S!REE9. !ASE S<,:!6;;. @AE9 4P+E4. 3EA=E "6 31S",PR6!ESS19*. @R1"E > A7 +. @AE9 4P+#4. 3EA=E PR6*RA;. E9-!ASE. 6" SELECTION-SCREEN S.IP" "his statement is used to create a blank line within the selection,screen components. A" SELECTION-SCREEN ULINE" "his statement is used to draw a horizontal line within the selection,screen component. +B" SELECT-OPTIONS" E*. !6-E> "A+3ES ;ARA. SE3E!",6P"169S S"A319 F6R ;ARA,;"AR". SE3E!" M FR6; ;ARA @AERE ;"AR" 19 S"A319. @R1"E > ;ARA,;"AR". E9-SE3E!". @R1"E > S"A319,36@7 S"A319,A1*A7 S"A319,S1*97 S"A319,6P"169. @henever a range is created using SE3E!",6P"169S statement7 SAP creates an internal table with the same variable name $S"A319 in this case( in the background with the following fields>

11 36@ A1*A S1*9 6P"169 ++" SELECTION-SCREEN 8UNCTION .E/S" "he pushbuttons declared in the header part of the screen are referred to as F:9!"169 BE<S. A user can be allowed to create only K function keys. S<9"A?> SE3E!"169,S!REE9 F:9!"169 BE< IfunctionLkeyLnumberF. SS!RF1E3-S is a predefined structure used to assign display values for function keys. "A+3ES SS!RF1E3-S. PARA;E"ERS > A$E%(7 +$E%(. SE3E!"169,S!REE9 SE3E!"169,S!REE9 SE3E!"169,S!REE9 SE3E!"169,S!REE9 SE3E!"169,S!REE9 191"1A31GA"169. SS!RF1E3-S,F:9!"?"L%E SS!RF1E3-S,F:9!"?"L%# SS!RF1E3-S,F:9!"?"L%& SS!RF1E3-S,F:9!"?"L%2 SS!RF1E3-S,F:9!"?"L%K A" SE3E!"169,S!REE9. !ASE S<,:!6;;. @AE9 4F!%#4. !A33 "RA9SA!"169 4SED%4. J J J J J 4S"A3194. 4CE*A94. 4S<E-4. 4-EEPA4. 4BAR"A1B4. F:9!"169 F:9!"169 F:9!"169 F:9!"169 F:9!"169 BE< BE< BE< BE< BE< E. #. &. 2. K.

12 @AE9 4F!%E4. !A33 "RA9SA!"169 4SEEE4. @AE9 4F!%&4. !A33 "RA9SA!"169 4SE&N4. @AE9 4F!%24. !A33 "RA9SA!"169 4SE&D4. @AE9 4F!%K4. 3EA=E PR6*RA;. E9-!ASE. @hen we create function keys7 SAP automatically generates name for each function key. "he name of first function key is 4F!%E4 7 the second one is 4F!%#47 etc. So the name range for function keys start from F!%E , F!%K. E*. PR6*RA; "6 !A33 SE3E!"169,S!REE9 @1"A P:SA+:""69S SE3E!"169,S!REE9 +E*19 6F 319E. SE3E!"169,S!REE9 !6;;E9" E%$EK( 3+E. PARA;E"ERS > A$E%(. SE3E!"169,S!REE9 !6;;E9" 2%$EK( 3+#. PARA;E"ERS > +$E%(. SE3E!"169,S!REE9 E9- 6F 319E. SE3E!"169,S!REE9 SE3E!"169,S!REE9 SE3E!"169,S!REE9 SE3E!"169,S!REE9 SE3E!"169,S!REE9 P:SA+:""69 E%$E%( 3+& :SER,!6;;A9- P+E. SB1P. P:SA+:""69 E%$E%( 3+K :SER,!6;;A9- P+&. SB1P. P:SA+:""69 E%$E%( 3+2 :SER,!6;;A9- P+#.

MSE3E!"169,S!REE9 +E*19 6F S!REE9 #%% AS @19-6@ "1"3E "#. SE3E!"169,S!REE9 +E*19 6F +36!B +E.

13 PARA;E"ERS > !AE AS !AE!B+6?7 !A# AS !AE!B+6?7 !A& AS !AE!B+6?. SE3E!"169,S!REE9 E9- 6F +36!B +E. SE3E!"169,S!REE9 +E*19 6F +36!B +#. PARA;E"ERS > R+E RA-16+:""69 *R6:P A7 R+# RA-16+:""69 *R6:P A7 R+& RA-16+:""69 *R6:P A. SE3E!"169,S!REE9 E9- 6F +36!B +#. MSE3E!"169,S!REE9 E9- 6F S!REE9 #%%. 191"1A31GA"169. 3+E J 4E9"ER A =A3:E4. 3+# J 4E9"ER + =A3:E4. 3+& J 4-1SP3A<4. 3+2 J 4E?1"4. 3+K J 4!A33 9E?"4. A" SE3E!"169,S!REE9. !ASE S<,:!6;;. @AE9 4P+E4. 3EA=E "6 31S",PR6!ESS19*. @R1"E > A7 +. 1F !AE J 4?4. 3EA=E "6 31S",PR6!ESS19*. @R1"E 4F1RS" !AE!B+6? 1S SE3E!"E-4. E9-1F. 1F !A# J 4?4. @R1"E > 4SE!69- !AE!B+6? 1S SE3E!"E-4. E9-1F. 1F !A& J 4?4. @R1"E > 4"A1R- !AE!B+6? 1S SE3E!"E-4. E9-1F. 1F R+E J 4?4. @R1"E > 4F1RS" RA-16+:""694.

14 E3SE1F R+# J 4?4. @R1"E > 4SE!69- RA-16+:""694. E3SE1F R+& J 4?4. @R1"E > 4"A1R- RA-16+:""694. E9-1F. @AE9 4P+#4. 3EA=E PR6*RA;. @AE9 4P+&4. !A33 SE3E!"169,S!REE9 #%%. E9-!ASE.

E9 , 31+RAR< AE3P

15

DATA DICTIONAR/
-ata dictionary ob)ects are> "A+3ES =1E@S -A"A E3E;E9"S -6;A19S SEAR!A AE3P 36!B 6+CE!" "<PE *R6:P

SEEE is the "code used to access and create data dictionary ob)ects. Some of the predefined tables to be used in common are> ;ARA , *E9ERA3 ;A"ER1A3 -A"A. ;AR! , P3A9" -A"A F6R ;A"ER1A3. =+AB , SA3ES -6!:;E9" > AEA-ER -A"A. B9AE , *E9ERA3 -A"A 19 !:S"6;ER ;AS"ER. B9+E , B9!E , "%%E , 3FAE , 3F+E , 3F!E , CREATING A TABLE: "here are two ways to create a table> E. built,in type. #. using data elements and domains. SEEE ,F select -A"A+ASE "A+3E radiobutton ,F Specify table name starting with G or < ,F Enter short description. "able creation involves specifying delivery class7 maintenance7 data class and size. -E31=ER< !3ASS specifies whether the table is Application table7 customizing table7 etc.

16

Application table stands for master and transaction data table. 1n master table7 reads are more7 writes are less. 1n transaction table7 reads are less7 writes are more. * inten nce: Specifies whether a table can be modified in the future or not. 1t is suggested to create a built,in type table with 4;A19"E9A9!E A336@E-4. Tec7nic l Settin4$: "his area has two attributes namely> -ata !lass , Specifies whether the table is application table or customizing table. Size !ategory , Specifies initial size for the table inside the database. TABLES CLASSI8ICATION BASED ON BU88ERING: S19*3E +:FFER19* , @henever a table is created with this option and when the user tries to access records from the database table7 a buffer is created in AS for only a single record. *E9ER1! +:FFER19* , +y default7 a buffer is created in AS for a single record. +ut depending on selection criteria7 buffer size can be increased or decreased. select M from ItableLnameF up to E% rows. F:33< +:FFER19* , +ased on the size category specified7 a buffer is created in AS for the table. TABLES CLASSI8ICATION BASED ON CLIENT: !31E9",-EPE9-E9" "A+3E , 1f a first field of a table is 4;A9-"47 this table is called client,dependent table. "his type of table datas can be accessed from only within the same client. !31E9",19-EPE9-E9" "A+3E , 1f the first field is not 4;A9-"47 then this table is called as !31E9",19-EPE9-E9" table.

17

:se the following code to access records from the e8isting database table> tables zstudtable. select M from zstudtable. write > zstudtable,studid7 zstudtable,studname7 zstudtable,studmarks. endselect. Aere7 "A+3ES statement will create a temporary table memory area in AS.

CREATING TABLE USING DATA ELE*ENTS AND DO*AINS: DO*AIN : "his data dictionary ob)ect is used to assign data type and length for a field to be created in a table. DATA T/PE OR DATA ELE*ENT : "his data dictionary ob)ect acts as a label for the domain. N 3i4 ti!n$ f!% c%e tin4 #!m in:

SEEE ,F Select -omain radiobutton ,F Specify name of the domain starting with G or < ,F !reate ,F Enter short description ,F Select data type ,F Enter length ,F Save ,F Activate. N 3i4 ti!n$ f!% c%e tin4 # t element:

SEEE ,F Select -ata "ype radiobutton ,F Specify name of the data element starting with G or < ,F !reate ,F Enter short description ,F Select 4-omain4 radiobutton ,F Specify name of the domain you created previously ,F Press Enter ,F Save ,F Activate ,F !ome back. !reate a table with the same navigations. Select 4-A"A E3E;E9"4 P:SA+:""69 from the Fields tab button. Enter field name ,F Select the checkbo8 of initial field to declare it as a primary key ,F Specify data element name ,F Press Enter.

18

VIE-S: =iew is a data dictionary ob)ect. 1t e8ists logically inside the data dictionary. 1t is used to fetch datas from more than one database table. 1n views7 we specify the tables and SAP will automatically generate a )oin condition code in the background. 3ieC:

N 3i4 ti!n$ t! c%e te

SEEE ,F Select 4=1E@4 radiobutton ,F Specify view name starting with G or < ,F !reate ,F Select as 4-A"A+ASE =1E@4 ,F !lick on !opy ,F Enter short description ,F Specify name of the tables from which you want to fetch records ,F !lick on Relationships pushbutton ,F 6pens an interface ,F Select the condition based on primary key relationship ,F !lick on !opy ,F A )oin condition is created ,F !lick on 4=iew Fields4 tab button ,F !lick on "able fields pushbutton ,F 6pens an interface with specified table names ,F !lick on first table ,F !lick on !hoose ,F Select re5uired fields ,F !lick on !opy ,F -o the same thing for choosing fields from second table ,F Save ,F Activate ,F -iscard the warning message. "o implement the view created7 use SE&D editor and write the following code> "A+3ES G;<=1E@E. SE3E!" M FR6; G;<=1E@E. @R1"E > G;<=1E@E,;A"9R7 G;<=1E@E,;"AR"7 G;<=1E@E,;+RSA7 G;<=1E@E,;E19S7 G;<=1E@E,@ERBS7 G;<=1E@E,3=6R;7 G;<=1E@E,;;S"A. E9-SE3E!". Save ,F Activate ,F E8ecute. 1n the above code7 "A+3ES statement is used to create a temporary table space area to hold the records of view.

19

TABLE T/PES: TRANSPARENT TABLES: "hese type of tables have one to one relationship with the underlying database table. "he structure of this table will be in the form of rows and columns. ;AS"ER A9- "RA9SA!"169 -A"AS. POOLED TABLE: Several pooled tables in data dictionary are stored under one table pool in the database. CLUSTER TABLE: Several cluster tables in data dictionary are stored under one table cluster in the database. "he difference between pooled table and cluster table is in the form of storage of datas. Several pooled table records are stored in one table pool in the database in continuous format using a row separator. @hereas in the case of table cluster7 the records are stored in continuous format without any row separator. TABLES CLASSI8ICATION BASED ON CLIENT: !31E9",-EPE9-E9" "A+3E !31E9",19-EPE9-E9" "A+3E.

TABLES CLASSI8ICATION BASED ON BU88ERING: S19*3E RE!6R- +:FFER19* *E9ER1! +:FFER19*

20 F:33< +:FFERE-.

ADDING SEARC) )ELP 8UNCTIONALIT/ (8() TO T)E PARA*ETERS STATE*ENT: SEEE ,F Select SEAR!A AE3P RA-16+:""69 ,F Specify search help name starting with G or < ,F !lick on !reate ,F Select 4Elementary Search Aelp4 radiobutton ,F !lick on !ontinue ,F 6pens an interface ,F Enter Short description ,F Specify table name in 4SE3E!"169 "E?"4 field ,F Enter field name in the first tabular column $:nder search help parameter( ,F Save ,F Activate. "o implement F2 functionality for parameters statement> SE&D ,F !reate a program ,F Enter the following code> PARA;E"ERS ;A"9:;$#%( ;A"!A!6-E 6+CE!" G;<SEAR!A#. @R1"E ;A"9:;. 1n the above code7 4;A"!A!6-E 6+CE!"4 addition for parameters statement is used to assign search help functionality for the parameter variable. ,F Save ,F Activate ,F E8ecute. T/PE GROUP: "ype group is a data dictionary ob)ect used to store user,defined data types and constants. -A"A statement is used to declare variables for pre,defined data types. "<PES statement is used to declare user,defined data types. N 3i4 ti!n$ t! c%e te T/PE GROUP: SEEE ,F Select "ype group radiobutton ,F Specify type group name starting with G or < ,F !lick on !reate ,F Enter short description ,F !ontinue ,F 6pens "ype *roup interface ,F @rite the following code inside editor> "<PE,P663 <;<"< . "<PES > +E*19 6F <;<"<LS"A3197 9A;E$#%(7 !6:RSE$E%(7 A*E "<PE 17

21 E9- 6F <;<"<LS"A319. Save ,F Activate. 1n the SE&D editor7 write the following code> "<PE,P663S <;<"<. -A"A A "<PE <;<"<LS"A319. A,9A;E J 4CE*A94. A,!6:RSE J 4A+AP4. A,A*E J 4#24. @R1"E > A,9A;E7 A,!6:RSE7 A,A*E. Save ,F Activate ,F E8ecute. 1n the above e8ample7 "<PE,P663S statement is used to access user, defined data types created in a type group. :ser,defined data types can be made globally accessed if saved under a type group. *ESSAGE CLASSES: ;essage !lasses are container of user,defined messages. @e can create our own messages to be displayed in the screen and we can create these messages in a message pool inside the message class. SEOE is the "code to create a message class. "he created messages can be called from programs using the statement 4;ESSA*E4. S<9"A?> MESSAGE <type_of_message><message id>(message_class). T/PES O8 *ESSAGES: S , Status message. 1 , 1nformation message. E , Error message. @ , @arning message. A , Abort message. " , "erminate message.

22 <ou can create up to E%%% messages in a single message class. "he message id ranges from % , OOO. N 3i4 ti!n$ t! c%e te *ESSAGE CLASS: SEOE ,F 6pens ;essage ;aintenance 1nitial screen ,F Specify 9ame of message class starting with G or < ,F !lick on !reate ,F Enter short description ,F !lick on ;Essages "ab button ,F Save message class under a package and assign re5uest number ,F -efine your own messages ,F Save Again ,F !ome back. From SE&D editor7 use the following code> selection,screen pushbutton E%$EK( lbE user,command pbE. initialization. lbE J 4press this4. at selection,screen. case sy,ucomm. when 4P+E4. ;ESSA*E "%%%$G;<;ESSA*E(. E9-!ASE. VARIANTS: "his concept is used to create default values for the input fields. =ariants are helpful for the SAP end users and data entry operators. 1n SE&D editor7 create the following code> parameters > a$E%(7 b$E%(7 c$E%(7 d$E%(. Save ,F Activate ,F !ome back ,F !lick on =ariants radiobutton ,F !lick on !hange ,F 6pens =ariants 1nitial Screen ,F Specify name of the variant starting with G or < ,F !lick on !reate ,F 6pens an interface with the input fields ,F !lick on Attributes pushbutton from Application toolbar ,F Enter short description for variant ,F Save ,F Enter variant values in the input fields ,F Save again ,F !ome back ,F !ome back ,F !lick on Source code radiobutton ,F !lick on change ,F E8ecute the program ,F <ou will see 4*et =ariant4 pushbutton option in the application toolbar ,F !lick on pushbutton to get variant values.

23

1nternal table is a user,defined temporary work area to store the database table records. 1f you want to make any changes to the table records7 make the changes in internal table and then update the records back into the database table. synta8> data IinternalLtableLnameF like IdatabaseLtableLnameF occurs IsizeF with header line. -A"A CE*A9 31BE ;ARA 6!!:RS % @1"A AEA-ER 319E. data stalin like knaE occurs % with header line. Aere7 6!!:RS % specifies that internal table should initially take D B+ of memory area in AS. E kb J E%#2 bytes 6ccurs % J D M E%#2 bytes Inte%n l t <le$ %e ;$e# in:

INTERNAL TABLES

+A"!A -A"A !6;;:91!A"169S , ;igrate data from legacy system to SAP database. SAPS!R1P"S A9- S;AR"F6R;S , "o redirect SAP data into e8ternal devices like printer7 fa87 e,mail7 etc. ;6-:3E P663 PR6*RA;S , -ialog programming to make use of screens. S:+R6:"19ES A9- F:9!"169 ;6-:3ES. , ;odularization techni5ue $module programming(. PURPOSE O8 INTERNAL TABLES: M "o avoid unnecessary traffic in the network while retrieving records from database.

24

S/NTAD O8 inte%n l t <le: -A"A > +E*19 6F Iinternal table nameF occurs %7 . . attributes .. . E9- 6F Iinternal table nameF. DE8INING A STRUCTURE: eg. -A"A > +E*19 6F @A7 9A;E$E%(7 !6:RSE$E%(7 E9- 6F @A. @A,9A;E J 4PRA=194. @A,!6:RSE J 4S.3SER=ER4. @A,9A;E J 4-EEPA4. @A,!6:RSE J 46RA!3E4. @A,9A;E J 4S<E-4. @A,!6:RSE J 4A+AP4. @R1"E > @A,9A;E7 @A,!6:RSE. A structure can hold only one record. "o make the structure hold more than one record7 declare an internal table. -A"A > +E*19 6F IinternalLtableF occurs %7 . . attributes . end of IinternalLtableF. eg. code data > begin of itab occurs %7

25 name$E%(7 course$E%(7 end of itab. itab,name J 4karthik4. itab,course J 4abap4. append itab. itab,name J 4pravin4. itab,course J 4s5l4. append itab. loop at itab. write > itab,name7 itab,course. endloop. 1n the above code7 when e8ecuted7 an internal table in the name of 1"A+ is created without header line. APPEND statement is used to insert the values into body area of the internal table even if the record already e8ists. COLLECT statement is also used to insert the values into body area of the internal table7 but will check for inde8 value. 1f the record already e8ists7 it wont insert the same value. LOOP-ENDLOOP statement is used to view the contents of internal table body area. :sing this statement7 we can view the entire contents of internal table. "o view a single line from body area of internal table7 use READ statement. eg. code using REA- S"A"E;E9"> data itab like mara occurs % with header line. select M from mara into table itab. loop at itab. write > sy,tabi87 itab,matnr7 itab,mbrsh7 itab,mtart7 itab,meins. endloop. read table itab inde8 N%. write > sy,tabi8 color K7 itab,matnr7 itab,mbrsh7 itab,mtart7 itab,meins.

26 A structure can hold only record by default. "o allocate e8tra memory space for a structure to hold more values7 use the statement 6!!:RS %. :sing this statement7 an internal table structure is created with D B+ memory of body area without header line. eg. -A"A > +egin of syed occurs %7 name$E%(7 course$E%(7 End of syed. "o create an internal table with AEA-ER 319E7 use 4@1"A AEA-ER 319E4 statement. eg. -A"A -EEPA 31BE Idatabase table nameF 6!!:RS % @1"A AEA-ER 319E. 9ow7 an internal table is created with header line and body area. )EADER LINE : "his is a structure to hold field attributes of a table. "he size is by default created to hold E record. BOD/ AREA : "his is a storage area for holding records fetched from database table. STATE*ENTS TO -RITE OUT T)E CONTENTS O8 INTERNAL TABLE: 366P,E9-366P , :sed to view or write out the entire contents of internal table body area. REA- , :sed to view or write out a single record we specify using inde8 value from the internal table body area. 1f we use REA- statement7 SAP performs binary search by default to fetch the inde8 value. Eg. code to insert user,defined values into database table using internal table structure>

27 -A"A 1"A+E 31BE ;ARA 6!!:RS % @1"A AEA-ER 319E. 1"A+E,;A"9R J 4;A"9:;+ER%E4. 1"A+E,;+RSA J 4P4. 1"A+E,;"AR" J 4!6:P4. 1"A+E,;E19S J 4B*4. APPE9- 1"A+E. 1"A+E,;A"9R J 4;A"9:;+ER%#4. 1"A+E,;+RSA J 4P4. 1"A+E,;"AR" J 4!6:P4. 1"A+E,;E19S J 4B*4. APPE9- 1"A+E. 1"A+E,;A"9R J 4;A"9:;+ER%&4. 1"A+E,;+RSA J 4P4. 1"A+E,;"AR" J 4!6:P4. 1"A+E,;E19S J 4B*4. APPE9- 1"A+E. 366P A" 1"A+E. 19SER" 19"6 ;ARA =A3:ES 1"A+E. 1F S<,S:+R! J %. ;ESSA*E S%%K$G;S*(. M@R1"E > 4=A3:ES ARE 19SER"E-4. E3SE1F S<,S:+R! J 2. ;ESSA*E E%%P$G;S*(. M@R1"E > 4=A3:ES A3REA-< E?1S"4. E9-1F. E9-366P. 1n the above e8ample7 S<,S:+R! system variable is used to check whether the action has been successfully completed or not. "his system variable is predefined by SAP with some default values such as % and 2. 1F S<,S:+R! J %7 the specified action has been completed successfully7 1F S<,S:+R! J 27 the specified action has not taken place.

28

T/PES O8 INTERNAL TABLE: 1nternal table is basically divided into two types> E. 19-E?E- 19"ER9A3 "A+3ES , S"R:!":RE- 19"ER9A3 "A+3E , S"A9-AR- 19"ER9A3 "A+3E , S6R"E- 19"ER9A3 "A+3E #. 969,19-E?E- 19"ER9A3 "A+3ES , AASAE- 19"ER9A3 "A+3E STRUCTURED INTERNAL TABLE: Any internal table declared or created using +E*19 6F , E9- 6F statement is called as structured internal table. eg. -A"A > +E*19 6F Iinternal table nameF7 ..attributes... E9- 6F Iinternal table nameF. STANDARD INTERNAL TABLE: "his type of internal table performs the search for a record in the body area using 319EAR SEAR!A "E!A91.:E. S/NTAD: -A"A IinternalLtableLnameF 31BE S"A9-AR- "A+3E 6F IdatabaseLtableLnameF . @1"A -EFA:3" 969,:91.:E BE< @1"A AEA-ER 319E 191"1A3 S1GE IsizeF eg. code

29 -A"A 1"A+ 31BE S"A9-AR- "A+3E 6F ;ARA @1"A 969,:91.:E BE< ;"AR" @1"A AEA-ER 319E 191"1A3 S1GE %. SE3E!" M FR6; ;ARA 19"6 "A+3E 1"A+. 366P A" 1"A+. @R1"E > 1"A+,;A"9R7 1"A+,;+RSA7 1"A+,;"AR"7 1"A+,;E19S. E9-366P. 1f we try to read a single value from the above internal table body area7 a linear search will be performed. @hereas7 for normal internal table7 the default search is binary search. SORTED INTERNAL TABLE: "his internal table will hold the records from the database table in a sorted manner. S<9"A?> -A"A IinternalLtableLnameF 31BE S6R"E- "A+3E 6F IdatabaseLtableLnameF @1"A -EFA:3" 969,:91.:E BE< @1"A AEA-ER 319E 191"1A3 S1GE IsizeF. Eg. -A"A 1"A+ 31BE S6R"E- "A+3E 6F ;ARA @1"A 969,:91.:E BE< ;+RSA @1"A AEA-ER 319E 191"1A3 S1GE %. SE3E!" M FR6; ;ARA 19"6 "A+3E 1"A+. 366P A" 1"A+. @R1"E > 1"A+,;A"9R7 1"A+,;+RSA7 1"A+,;"AR"7 1"A+,;E19S. E9-366P. NON-INDEDED )AS)ED INTERNAL TABLE: S<9"A?> -A"A IinternalLtableLnameF 31BE AASAE- "A+3E 6F IdatabaseLtableLnameF @1"A -EFA:3" 969,:91.:E BE< @1"A AEA-ER 319E 191"1A3 S1GE IsizeF.

30

"his internal table is not assigned any inde8 value. "he retrieval of records from internal body area is based on key field or a row. Eg. code -A"A 1"A+ 31BE AASAE- "A+3E 6F ;ARA @1"A :91.:E BE< ;"AR" @1"A AEA-ER 319E 191"1A3 S1GE %. SE3E!" M FR6; ;ARA 19"6 "A+3E 1"A+. 366P A" 1"A+. @R1"E > 1"A+,;A"9R7 1"A+,;+RSA7 1"A+,;"AR"7 1"A+,;E19S. E9-366P. For this type of internal table7 we have to specify only the primary key for a retrieval function. S/STE* VARIABLES USED IN INTERNAL TABLE: S/-T8ILL , "his system variable is used to describe number of records fetched and inserted into body area of internal table. +efore using this statement7 we have to use 4-ES!R1+E "A+3E4 statement. S/-TABID , "his system variable is used to create a loop iteration counter for internal table body area. S/-DBCNT , "his system variable is used to describe number of records fetched from database table. Eg. code -A"A 1"A+ 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; B9AE 19"6 "A+3E 1"A+. @R1"E > S<,-+!9" !636R 2. -ES!R1+E "A+3E 1"A+. @R1"E > S<,"F133 !636R P. 366P A" 1"A+. @R1"E > S<,"A+1?7 1"A+,B:99R7 1"A+,3A9-E7 1"A+,9A;EE7 1"A+,6R"%E. E9-366P.

31

SORTING T)E INTERNAL TABLE A8TER 8ETC)ING VALUES: S<9"A?> S6R" IinternalLtableLnameF +< IfieldLnamesF. e8ample code> -A"A 1"A+ 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; B9AE 19"6 "A+3E 1"A+. @R1"E > S<,-+!9" !636R 2. -ES!R1+E "A+3E 1"A+. @R1"E > S<,"F133 !636R P. S6R" 1"A+ +< 3A9-E 6R"%E 9A;EE B:99R. 366P A" 1"A+. @R1"E > sy,tabi87 1"A+,B:99R7 1"A+,3A9-E7 1"A+,9A;EE7 1"A+,6R"%E. E9-366P. A S6R"E- 19"ER9A3 "A+3E cannot be resorted. i.e7 we cannot use S6R" statement to the sorted internal table.

32

SUBROUTINES
8OR* - END8OR* statement is used to create subroutines. PER8OR* statement is used to invoke the subroutine created. Subroutines are used to call a piece of code fre5uently within the program or e8ternally from other program. LOCAL SUBROUTINES: "he subroutine is called locally from the same program using PERF6R; statement. eg. code of local subroutine without any value> PERF6R; S"A319. F6R; S"A319. -6 K "1;ES. @R1"E > 4@E3!6;E "6 A+AP4. E9--6. E9-F6R;. eg. code of e8ternal subroutine without any value> create an e8ecutable program and write the following code> REP6R" GS:+R6:"19ES# PERF6R; S"A319. F6R; S"A319. -6 K "1;ES. @R1"E > 4@E3!6;E "6 A+AP4. E9--6. E9-F6R;. Save ,F Activate. .

33 !reate another e8ecutable program and write the following code> REP6R" GS:+R6:"19ESE. PERF6R; S"A319$GS:+R6:"19ES#(. Save ,F Activate ,F E8ecute. @e have to specify name of the program where subroutine is created within the bracket whenever we try to invoke the subroutine e8ternally. PASS B/ RE8ERENCE: -A"A > A$E%( =A3:E 419-1A47 + "<PE 1 =A3:E 4#%4. PERF6R; S"A319 :S19* A +. F6R; S"A319 :S19* ? <. @R1"E > ? 7 <. E9-F6R;. PASS B/ VALUE: -A"A > A$E%( =A3:E 419-1A47 + "<PE 1 =A3:E 4#%4. PERF6R; S"A319 :S19* A +. F6R; S"A319 :S19* ? <. ? J 4A;ER1!A4. < J 4E%%4. @R1"E > ? 7 <. E9-F6R;. PASSING INTERNAL TABLE AS AN ARGU*ENT: -A"A 1"A+ 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; B9AE 19"6 "A+3E 1"A+.

34 PERF6R; -1SP3A< "A+3ES 1"A+ . F6R; -1SP3A< "A+3ES 1"A+ S"R:!":RE B9AE. 366P A" 1"A+. @R1"E > 1"A+,B:99R7 1"A+,9A;EE7 1"A+,3A9-E7 1"A+,6R"%E. E9-366P. E9-F6R;.

35

Fetching re5uired data from the database and redirecting to the output devices or displaying the data in 3PS screen as per client4s re5uirements is the concept behind report generation. T/PES O8 REPORTS: E. #. &. 2. K. *RAPA1!A3 REP6R"S A3= REP6R"S $A+AP 31S" =1E@ER(. *R6:P REP6R"S 19"ERA!"1=E REP6R"S !3ASS1!A3 REP6R"S $F6R;A""E- / :9 F6R;A""E-(.

Rep!%t$

order of e8ecution of classical report> 191"1A31GA"169. A" SE3E!"169,S!REE9. S"AR",6F,SE3E!"169. "6P,6F,PA*E. E9-,6F,PA*E. E9- 6F SE3E!"169. 6R-ER 6F E?E!:"169 6F 19"ERA!"1=E REP6R"> 191"1A31GA"169. A" :SER,!6;;A9-. S"AR",6F,SE3E!"169. "6P,6F,PA*E. "6P,6F,PA*E -:R19* 319E SE3E!"169. E9- 6F PA*E. E9- 6F SE3E!"169.

Cl $$ic l %ep!%t"
REP6R" <!3ASSRP" . tables> spfli. include IlistF. -A"A> +E*19 6F it occurs %7 carrid like spfli,carrid7 connid like spfli,connid7 no standard page heading line,count E%$#(

36 cityfrom like spfli,cityfrom7 cityto like spfli,cityto7 fltime like spfli,fltime7 E9- 6F it. select,options> carrid for spfli,carrid7 connid for spfli,connid7 cityfrom for spfli,cityfrom. start,of,selection. select M from spfli into corresponding fields of table it where carrid in carrid and connid in connid and cityfrom in cityfrom. loop at it. write> it,carrid7 it,connid7 it,cityfrom7 it,cityto 7 it,fltime input on. endloop. top,of,page. write> EK 4flight details4 color !63LAEA-19*7 iconLgreenLlight AS 1!69 . . write> EK 4,,,,,,,,,,,,,,4. end,of,page. GRAP)ICAL REPORTS: "hese type of reports are used display the database table in a graphical format either in two,dimensional or three,dimensional format. 8UNCTION *ODULES USED IN GRAP)ICAL REPORTS: GRAPH_2D GRAPH_3D eg. code to generate graphical report for annual company sales> -A"A > +E*19 6F 1"A+ 6!!:RS %7

37 !6;P9A;E$#%(7 !6;PSA3ES "<PE 17 E9- 6F 1"A+. 1"A+,!6;P9A;E J 4;RF4. 1"A+,!6;PSA3ES J 4#%%%%%%4. APPE9- 1"A+. 1"A+,!6;P9A;E J 4FE99ER 19-1A 3"-4. 1"A+,!6;PSA3ES J 42%%%%%%4. APPE9- 1"A+. 1"A+,!6;P9A;E J 4SA9;AR4. 1"A+,!6;PSA3ES J 4N%%%%%%4. APPE9- 1"A+. 1"A+,!6;P9A;E J 4E1!AER4. 1"A+,!6;PSA3ES J 4&K%%%%%4. APPE9- 1"A+. M!A33 F:9!"169 4*RAPAL#-4 !A33 F:9!"169 4*RAPAL&-4 $!"R3HFP( E?P6R"19* "1"3 J 4!6;PA9< SA3ES REP6R"4 "A+3ES data J 1"A+. ALV REPORTS (ABAP LIST VIE-ER): "he function modules used in this kind of report are> REUSE_ALV_GRID_DISPLAY REUSE_ALV_LIST_DISPLAY eg. code> -A"A 1"A+ 31BE ;ARA 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; ;ARA 19"6 "A+3E 1"A+. M!A33 F:9!"169 4RE:SELA3=L31S"L-1SP3A<4

38 !A33 F:9!"169 4RE:SELA3=L*R1-L-1SP3A<4 E?P6R"19* 1LS"R:!":REL9A;E J 4;ARA4 "A+3ES tLouttab J 1"A+. GROUP REPORTS: "hese reports are also called as !3ASS1!A3 REP6R"S which is divided into> !3ASS1!A3 :9F6R;A""E- REP6R"S CLASSICAL 8OR*ATTED REPORTS" "6P,6F,PA*E , :sed to create header area for the report. E9-,6F,PA*E , :sed to create footer area for the report. eg. code> -A"A +ASBAR 31BE ;ARA 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; ;ARA 19"6 "A+3E +ASBAR. @R1"E > K$N%( S<,:319E. 366P A" +ASBAR. @R1"E > S<,=319E7 K$#%( +ASBAR,;A"9R7 S<,=319E7 #N$EK( +ASBAR, ;+RSA7 S<,=319E7 2K$EK( +ASBAR,;"AR"7 S<,=319E7 P#$E%( +ASBAR, ;E19S7 S<,=319E. @R1"E> $N%( S<,:319E. E9-366P. @R1"E > K$N%( S<,:319E. top,of,page. M@R1"E > 2%$K%( 4"A1S 1S AEA-ER AREA F6R "AE REP6R"4 !636R 2 !E9"ERE-.

39 @R1"E > K$#%( 4;A"ER1A3 9:;+ER47 #N$EK( 419-:S"R< SE!"6R47 2K$EK( 4;A"ER1A3 "<PE47 P#$E%( 4;EAS:RE;E9"4. SB1P #. E9-,6F,PA*E. @R1"E > 2%$K%( 4"A1S 1S F66"ER AREA F6R "AE REP6R"4 !636R N !E9"ERE-. @R1"E > 4!:RRE9" PA*E 9:;+ER 1S47 S<,PA*96 !636R P. 1n the above e8ample7 "6P,6F,PA*E event is used to create header area and E9-,6F,PA*E event is used to create footer area. "he header area can be used to create subheadings or report headings and the footer area can be used to specify page numbers7 totals7 etc. ALV REPORTS: A3= stands for A+AP 3ist =iewer. :sing A3= reports7 we can generate the list in 31S" and *R1- formats. "he function modules used for A3= reports are> E. RE:SELA3=L31S"L-1SP3A< #. RE:SELA3=L*R1-L-1SP3A< Eg. !ode> -A"A 1"A+ 31BE B9!E 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; B9!E 19"6 "A+3E 1"A+. !A33 F:9!"169 4RE:SELA3=L*R1-L-1SP3A<4 M!A33 F:9!"169 4RE:SELA3=L31S"L-1SP3A<4 E?P6R"19* 1LS"R:!":REL9A;E J 4B9!E4 "A+3ES "L6:""A+ J 1"A+.

GROUP REPORTS:
!69"R63 +REAB S"A"E;E9"S , "hese statements are used to control the flow of e8ecution of program within the loop. "he following statements are used within 366P,E9-366P statement as control break statements> E. 69 !AA9*E 6F E9-69.

40

#. A" F1RS". E9-A". &. A" 3AS". E9-A". 2. A" 9E@. E9-A". K. A" E9- 6F. E9-A". ON C)ANGE O8-ENDON: "his processing block gets e8ecuted whenever there is a change in the field name of internal table. eg. code> -A"A 1"A+ 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; B9AE 19"6 "A+3E 1"A+. S6R" 1"A+ +< 3A9-E. 366P A" 1"A+. 69 !AA9*E 6F 1"A+,3A9-E. SB1P E. @R1"E > 4!:S"6;ER ;AS"ER -E"A13S F6R4 !636R 27 1"A+,3A9-E !636R 2. SB1P E. E9-69. @R1"E > 1"A+,B:99R7 1"A+,9A;EE7 1"A+,3A9-E7 1"A+,6R"%E. E9-366P. "6P,6F,PA*E. @R1"E > 2%$2%( 4"A1S 1S !:S"6;ER ;AS"ER -A"A4 !636R K. AT 8IRST-ENDAT: "his processing block gets triggered at the first pass of internal table loop. eg. code> -A"A 1"A+ 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; B9AE 19"6 "A+3E 1"A+.

41 S6R" 1"A+ +< 3A9-E. 366P A" 1"A+. A" F1RS". @R1"E > 4"A1S 1S !:S"6;ER ;AS"ER -A"A4. SB1P E. E9-A". @R1"E > 1"A+,B:99R7 1"A+,9A;EE7 1"A+,3A9-E7 1"A+,6R"%E. E9-366P. "6P,6F,PA*E. @R1"E > 2%$2%( 4"A1S 1S !:S"6;ER ;AS"ER -A"A4 !636R K. AT LAST - ENDAT: "his processing block gets e8ecuted at the last pass of the internal table loop. eg. code> -A"A 1"A+ 31BE B9!E 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; B9!E 19"6 "A+3E 1"A+. S6R" 1"A+ +< *CAAR. 366P A" 1"A+. A" 3AS". S:;. Maggregate function @R1"E > 4"AE *RA9-"6"A3 6F SA3ES 1S47 1"A+,:;%E:. E9-A". @R1"E > 1"A+,B:99R7 1"A+,*CAAR7 1"A+,:;%E:. E9-366P. AT NE--ENDAT: @henever we use this control break statement7 make use of only the re5uired fields in the internal table. -A"A > +E*19 6F 1"A+ 6!!:RS %7 *CAAR 31BE B9!E,*CAAR7 :;%E: 31BE B9!E,:;%E:7 E9- 6F 1"A+. SE3E!" *CAAR :;%E: FR6; B9!E 19"6 "A+3E 1"A+. S6R" 1"A+ +< *CAAR. 366P A" 1"A+.

42 A" 9E@ *CAAR. SB1P E. @R1"E > 4SA3ES -69E 19 "AE F1S!A3 <EAR47 1"A+,*CAAR. SB1P E. E9-A". @R1"E > 1"A+,*CAAR7 1"A+,:;%E:. E9-366P. AT END O8-ENDAT" "his processing block gets e8ecuted at the end of each field inside the internal table. eg. code> -A"A > +E*19 6F 1"A+ 6!!:RS %7 *CAAR 31BE B9!E,*CAAR7 :;%E: 31BE B9!E,:;%E:7 E9- 6F 1"A+. SE3E!" *CAAR :;%E: FR6; B9!E 19"6 "A+3E 1"A+. S6R" 1"A+ +< *CAAR. 366P A" 1"A+. A" E9- 6F *CAAR. S:;. @R1"E > 4"6"A3 SA3ES -69E 19 "AE F1S!A3 <EAR47 1"A+,:;%E:. SB1P E. E9-A". @R1"E > 1"A+,*CAAR7 1"A+,:;%E:. E9-366P. INTERACTIVE REPORTS: ;aking the lists to communicate with each other is called as interactive report. @hen we e8ecute the reporting program7 the initial list we are getting as output is called as PR1;AR< 31S". :sing interactive report concept7 we can create secondary lists. "otally7 we can create #E lists using interactive reports. Each list is assigned an inde8 value ranging from %,#%.

43 "he list inde8 assigned for the primary list is %. "he list inde8 assigned for the first secondary list is E. "he secondary list inde8 ranges from E,#%. "he system variables used in interactive reports> S/-LSIND , Aolds the current list inde8. S/-LILLI , Aolds the line number in the list. S/-LISEL , Aolds the contents of the line selected. Eg. code> -A"A F3-9A;E$&%(. -A"A 1"A+ 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; B9AE 19"6 "A+3E 1"A+. S6R" 1"A+ +< 3A9-E. 366P A" 1"A+. @R1"E > 1"A+,B:99R7 1"A+,9A;EE7 1"A+,3A9-E7 1"A+,6R"%E. E9-366P. A" 319E,SE3E!"169. *E" !:RS6R F1E3- F3-9A;E. 1F F3-9A;E J 41"A+,B:99R4. @R1"E > 4"AE !:RRE9" 31S" 19-E? 1S47 S<,3S19-. SB1P E. @R1"E > S<,31SE3. E9-1F. *E" !:RS6R F1E3- statement is used to specify the cursor position on the list. 4A6"SP6" 694 statement is used to provide single click functionality on any field value in the list. STRING 8UNCTIONS: SP31" , "his function is used to split the given string value based an any separator and save in separate string variables. eg. code> -A"A S"R$&%( =A3:E 4SAP 1S A9 ERP4. -A"A> SE$K(7 S#$K(7 S&$K(7 S2$K(. SP31" S"R A" 4 4 19"6 SE S# S& S2.

44 @R1"E > SE7 S#7 S&7 S2.

SEAR!A , "his string function is used to search for the specified value in a given string. eg. code> -A"A S"R$&%( =A3:E 4SAP 1S A9 ERP4. -A"A SE$&( =A3:E 4A94. SEAR!A S"R F6R SE. @R1"E > S<,F-P6S. $y-f#p!$ is the system variable used to hold the position of an alphabet in the string. CONCATENATE , "his string function is used to add the different character type variables into one string. eg. code> -A"A S"R$&%(. -A"A> SE$K( =A3:E 419-1A47 S#$K( =A3:E 41S47 S&$K( =A3:E 4*REA"4. !69!A"E9A"E SE S# S& 19"6 S"R SEPARA"E- +< 4 4. @R1"E > S"R. S)I8T , "his string function is used to move the string to the specified position $3EF"7 R1*A"7 !1R!:3AR( based on the number of places specified. eg. code> M-A"A S"R$#%( =A3:E 4A+AP 1S 19 SAP4. MSA1F" S"R +< K P3A!ES. M@R1"E S"R !636R K. M-A"A S"R$#%( =A3:E 4A+AP 1S 19 SAP4. MSA1F" S"R R1*A" +< K P3A!ES. M@R1"E S"R !636R K. M-A"A S"R$#%( =A3:E 4A+AP 1S 19 SAP4. MSA1F" S"R !1R!:3AR +< K P3A!ES. M@R1"E S"R !636R K. TRANSLATE , "his string function is used to change the case of the given string value.

45

eg. code> -A"A S"R$E%( =A3:E 4!AE99A14. "RA9S3A"E S"R "6 36@ER !ASE. @R1"E S"R. CONDENSE , "his string function is used to remove the blank spaces in the given string. eg. code> data str$&%( value 4 !69-E9SE S"R. @R1"E S"R. 19-1A 1S *REA"4.

REPLACE , "his string function is used to replace the given string with specified string value. eg. code> data str$&%( value 419-1A 1S *REA"4. -A"A SE$E%( =A3:E 4@R1"E4. REP3A!E 41S4 19 S"R @1"A SE. @R1"E S"R. STRLEN , "his string function is used to identify the length of the given string. Eg. code> data str$&%( value 419-1A 1S *REA"4. data len type i. len J S"R3E9$ S"R (. write len. OVERLA/ 8IND

46

L!4ic l D t

< $e$>

1t is a tool used to increase the report efficiency. 1t is a collection of nodes7 where each node is created for one table from the database. "he first node created in the logical database is called as root node. :nder the root node7 we create any number of child nodes for the table. 3ogical database is not an -ata -ictionary ob)ect. 1t is a repository ob)ect. S3-+ is the t,code to create the logical database or SE&P.

N 3i4 ti!n$: SE&P ,F specify logical database name starting with G or y ,F create ,F enter a short description ,F save under a pack ,F specify root node name ,F enter short description for root node ,F enter the database table name ,F click on create ,Fopens an interface with root node ,F select node ,F click on selection push button from application toolbar ,F click on yes to generate from structure ,Fclick on no to search help ,F select two checkbo8es for field selections and free selections ,F click on transfer ,F opens an include file ,F specify range variable as followsQ. Select,options > Replace R for knaE,kunnr

R with cusnum.

save ,F activte ,F come back ,F select node ,Fclick on source code pushbutton from application toolbar ,Fclick on yes to generate program from structure and selections ,Fopens two include file ,F double click on the header file ,F declare an internal table as followsQ tables knaE. -ata itab like knaE occurs % with header line. Save ,Factivate ,F comeback ,Fdouble click on 9888 $sys routine file( ,Fdouble click on the node knaE include file ,F write the following code between the F6R; and E9-F6R; . Select M from kanE into table itab where kunnr in cusnum. Put knaE. $M autogen code(.

47

3oop at itab. @rite > itab,kunnr7itab,nameE7itab,landE7itab,ort%E. Endloop. Save ,F activate. Put statement is used to fetch records from the specified database table and insert into node created from that table in the logical database. "o invoke the logical database from SE&D7create an e8ecutable program ,F specify logical database name in the attribute selection while creating the program ,F write the following code. 9odes knaE. $!reates link b w node and 3-+ and invoke pgm( *et knaE. $to get the record from node in 3-+(. Save ,F activate ,F e8ecute.

48

*ODULE POOL PROGRA**ING:


M "hese are type ; programs in SAP. M Screen painter is a tool used to create *:1 in A+AP. M ;PP provides screen painter to create a screen for the program. M "hese programs cannot be e8ecuted directly. M !ustomer,specified "ransaction code $starting with G or <( should be created for each ;PP program to e8ecute. M @e can create any number of screens for a program and we can call these screens very easily. M ;PP programs should start with the naming convention SAP;G or SAP;<. M SED% is the "code to create ;PP programs. EVENTS IN *PP: PR6!ESS +EF6RE 6:"P:" $P+6( PR6!ESS AF"ER 19P:" $PA1( PR6!ESS 69 =A3:E RE.:ES" , "o provide F2 functionality to ;PP program screen i p fields. PR6!ESS 69 AE3P RE.:ES" , "o provide FE functionality to ;PP program screen components. N 3i4 ti!n$ t! c%e te $imple *PP p%!4% m:

SED% ,F Select Program from drop,down list ,F Specify program name starting with SAP;G or SAP;< ,F Press Enter ,F !lick on <es to create ob)ect ,F !reate "op 1nclude File by clicking on !ontinue icon in pop,up screens ,F Save under a package ,F Assign a re5uest number ,F ;PP program with specified name is created with "op include File. "o create screen7 Right click on program name ,F Select !reate ,F Screen ,F 6pens Screen -escription page ,F Enter short description for screen ,F Select screen type as 96R;A3 ,F !lick on 3A<6:" pushbutton from application toolbar ,F 6pens Screen Painter ,F -rag and drop two input fields from toolbar ,F 3ikewise7 create two pushbuttons ,F -ouble click on each component ,F 6pens Attributes bo8 ,F Specify attributes for each screen component ,F For pushbutton7 specify F!" code ,F Save the screen ,F !lick on Flowlogic pushbutton from application toolbar ,F 6pens Flow logic editor to create event functionalities for screen components ,F -ecomment PA1 module ,F -ouble click on PA1 module name ,F !lick on <es to create PA1 module ob)ect ,F 6pens PA1 module ,F Specify the following code within module,endmodule statements>

49

!ASE S<,:!6;;. @AE9 4-1SP3A<4. 3EA=E "6 31S",PR6!ESS19*. @R1"E > 16E7 16#. @AE9 4E?1"4. 3EA=E PR6*RA;. E9-!ASE. ,F Save. 9ow double click on 41ncludes4 Folder $"6P 19!3:-E F13E( ,F -eclare variables for input fields as follows> -A"A > 16E$E%(7 16#$E%(. Save ,F Activate. 9ow "o create "ransaction !ode7 right click on ;ain Program 9ame ,F !reate ,F "ransaction ,F 6pens an interface ,F Enter "code name starting with G or < ,F Enter short description ,F !ontinue ,F 6pens interface ,F Enter ;ain program name and Screen number to be called first ,F Save under a package ,F Assign a re5uest number. Activate all the ob)ects of ;PP program by right clicking on ;ain program 9ame ,F !lick on Activate ,F Raises 46b)ects Activated4 message. "o e8ecute the ;PP program7 specify "code name in the !ommand Prompt area ,F Press Enter. EVENTS IN *PP: PR6!ESS +EF6RE 6:"P:" , "his event gets triggered whenever the program is e8ecuted using "code. "his event is used to assign initial default values to the screen components. PR6!ESS AF"ER 19P:" , "his event gets triggered after some user4s action in the screen $for eg7 after clicking pushbutton7 subse5uent event functionalities(.

50 PR6!ESS 69 =A3:E RE.:ES" , "his event is used to assign FE functionality for the screen components. PR6!ESS 69 AE3P RE.:ES" , "his event is used to assign F2 functionality for the input field in the screen. Eg. code to make field validations in ;PP program> :sing screen painter7 design a screen consisting of four input fields for client7 username7 password and language as we have in login screen of SAP. Assign the first two input fields to one group called *RE7 the third input field to a group *R#. !reate two pushbuttons and assign F!" codes. 1n the "6P 19!3:-E F13E7 declare following variables> PR6*RA; SAP;<S!REE9=A31-. -A"A > 16E$&(7 16#$D(7 16&$D(7 162$#(. -A"A A "<PE 1. Save ,F Activate. 1n Flow logic editor7 decomment PA1 ;6-:3E7 double click on module name7 and inside the module7 write the following code> module :SERL!6;;A9-L%#%% input. case sy,ucomm. @AE9 436*194. !A33 "RA9SA!"169 4SE&D4. @AE9 4E?1"4. 3EA=E PR6*RA;. E9-!ASE. endmodule. Save ,F Activate. 1n P+6 module7 write the following code to assign default input field attributes> module S"A":SL%#%% output. S :SERL!6;;A9-L%#%% 19P:"

51 M SE" PF,S"A":S 4888888884. M SE" "1"3E+AR 48884. 1F A J %. ;ESSA*E S%E%$G;S*(. 366P A" S!REE9. 1F S!REE9,*R6:PE J 4*RE4. S!REE9,RE.:1RE- J 4E4. E9-1F. 1F S!REE9,*R6:PE J 4*R#4. S!REE9,19=1S1+3E J 4E4. E9-1F. ;6-1F< S!REE9. E9-366P. A J E. E9-1F. endmodule. S S"A":SL%#%% 6:"P:" Save ,F Activate. !reate a "ransaction !ode ,F E8ecute the program. *PP SCREEN VALIDATIONS: Eg. code to make field validations in ;PP program> :sing screen painter7 design a screen consisting of four input fields for client7 username7 password and language as we have in login screen of SAP. Assign the first two input fields to one group called *RE7 the third input field to a group *R#. !reate two pushbuttons and assign F!" codes. 1n the "6P 19!3:-E F13E7 declare following variables> PR6*RA; SAP;<S!REE9=A31-. -A"A > 16E$&(7 16#$D(7 16&$D(7 162$#(. -A"A A "<PE 1. Save ,F Activate. 1n Flow logic editor7 decomment PA1 ;6-:3E7 double click on module name7 and inside the module7 write the following code>

52

module :SERL!6;;A9-L%#%% input. case sy,ucomm. @AE9 436*194. !A33 "RA9SA!"169 4SE&D4. @AE9 4E?1"4. 3EA=E PR6*RA;. E9-!ASE. endmodule. Save ,F Activate. 1n P+6 module7 write the following code to assign default input field attributes> module S"A":SL%#%% output. M SE" PF,S"A":S 4888888884. M SE" "1"3E+AR 48884. 1F A J %. ;ESSA*E S%E%$G;S*(. 366P A" S!REE9. 1F S!REE9,*R6:PE J 4*RE4. S!REE9,RE.:1RE- J 4E4. E9-1F. 1F S!REE9,*R6:PE J 4*R#4. S!REE9,19=1S1+3E J 4E4. E9-1F. ;6-1F< S!REE9. E9-366P. A J E. E9-1F. endmodule. S S"A":SL%#%% 6:"P:" Save ,F Activate. !reate a "ransaction !ode ,F E8ecute the program. S :SERL!6;;A9-L%#%% 19P:"

53

*en; P inte%
ADDING USER-DE8IND *ENUS TO T)E INTERACTIVE REPORTS: ;enu Painter is a tool used to create user,defined menus7 application toolbar and function keys. SE" PF,S"A":S 4ImenuLnameF4 is the synta8 used in reports to access ;enu Painter directly to create user,defined menus. A menu bar consists of set of menus. ;enu contains set of menu items. Each menu item may have its own sub menu items. Another way of accessing ;enu Painter is using SE2E "code. Eg. code> @R1"E > 4SE3E!" 69E FR6; "AE ;E9:4. SE" PF,S"A":S 4;<;E9:4. A" :SER,!6;;A9-. !ASE S<,:!6;;. @AE9 4 SA;PA"A E4. ;ESSA*E S%%%$GSAA+;S*(. @AE9 4 SA;PA"A #4. ;ESSA*E S%%E$GSAA+;S*(. @AE9 4SA;PA"A&4. 3EA=E PR6*RA;. @AE9 4S:+;E9:EE4. !A33 "RA9SA!"169 4SE&D4. @AE9 4S:+;E9:E#4. !A33 "RA9SA!"169 4SE&N4. E9-!ASE. ,F Save ,F Activate ,F E8ecute.

54

INSERTING RECORDS INTO DATABASE TABLE USING *PP SCREEN 8IELDS: :sing -ictionary Program Fields $FP( pushbutton from the application toolbar of *raphical Screen Painter7 we can create input fields for the database table field structures. N 3i4 ti!n$: E. !reate ;PP program. #. 1n "op 1nclude File7 declare the following structure> -A"A SAA+A9A 31BE B9AE. Save ,F Activate. &. !reate Screen ,F !lick on 4-ictionary Program Fields $FP(4 pushbutton from the application toolbar ,F 6pens an interface ,F Specify structure name $SAA+A9A( ,F !lick on *et From Program pushbutton ,F 6pens interface ,F Select re5uired fields ,F Place on Screen painter ,F specify labels ,F !reate two pushbuttons $19SER"7 E?1"( ,F Save ,F Flowlogic. 2. 1n PA1 module7 specify following code> !ASE S<,:!6;;. @AE9 419SER"4. 19SER" 19"6 B9AE =A3:ES SAA+A9A. 1F S<,S:+R! J %. ;ESSA*E S%%&$GSAA+;S*(. E3SE1F S<,S:+R! J 2. ;ESSA*E E%%2$GSAA+;S*(. E9-1F. @AE9 4E?1"4. 3EA=E PR6*RA;. E9-!ASE. K. !reate a "code ,F Activate all ,F E8ecute.

55 TABLE CONTROL CO*PONENTS: "able !ontrol component is used to view the table records and if needed7 we can directly modify table records and update the database table using table control. Aere7 the records can be viewed in rows and columns format separated by horizontal and vertical lines. SYNTAX: CONTROLS <table_Cont ol_na!e" TYPE TA#LEVIE$ USING SCREEN <%PP_&' een_n(!be " !69"R63S statement is used to create a memory space area for table control component in AS. "A+3E=1E@ is a data type for table control component. S!REE9 9:;+ER should be specified to make the system know where the table control was physically created. 9avigations to create "A+3E !69"R63 !6;P69E9"> !reate ;PP program ,F 1n "6P 19!3:-E F13E7 write the following code> -A"A 1"A+ 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. !69"R63S "A+!"R3 "<PE "A+3E=1E@ :S19* S!REE9 4E#&4. -A"A !:R "<PE 1. Save ,F Activate. !reate a 9ormal screen $E#&( ,F -rag and drop "A+3E !69"R63 component from application toolbar ,F Specify its name in attributes bo8 ,F Specify title if necessary ,F Select A6R1G69"A3 and =ER"1!A3 SEPARA"6RS checkbo8 ,F 1f needed7 select !63:;9 and R6@ selection radiobuttons ,F !lick on -ictionary Program Fields from Appn. "oolbar ,F Specify internal table name specified in top include file ,F !lick on 4*E" FR6; PR6*RA;4 pushbutton ,F !hoose re5uired fields ,F !lick on continue ,F Place the fields in table control component ,F Add labels for each fields ,F !reate two pushbuttons $FE"!A7 E?1"( ,F Save ,F Flow 3ogic. 1n PA1 module7 write following code>

56 !ASE S<,:!6;;. @AE9 4FE"!A4. SE3E!" M FR6; B9AE 19"6 "A+3E 1"A+. "A+!"R3,319ES J S<,-+!9". @AE9 4E?1"4. 3EA=E PR6*RA;. E9-!ASE. 1n Flow 3ogic editor7 write following code> PR6!ESS +EF6RE 6:"P:". ;6-:3E S"A":SL%E#&. 366P A" 1"A+ !:RS6R !:R @1"A !69"R63 "A+!"R3. E9-366P. PR6!ESS AF"ER 19P:". ;6-:3E :SERL!6;;A9-L%E#&. 366P A" 1"A+. E9-366P. Aere7 366P A" 1"A+,E9-366P statement in P+6 event is used to fetch the records and insert into table control component. !:RS6R statement is used to make use of the cursor in table control component whenever we try to select a particular field and modify it. 366P A" 1"A+,E9-366P statement in PA1 event is used to make necessary modifications to the database table from table control component. !reate "code ,F E8ecute. TABSTRIP CONTROLS: :sing normal screen7 we can add only 2% components to the screen. "o add more than 2% components7 make use of tabstrip control. <ou can specify any number of tab fields for a tabstrip control and create subscreen for each tab field created.

57 N 3i4 ti!n$ t! c%e te t <$t%ip c!nt%!l: !reate an ;PP program ,F !reate a screen ,F -rag and drop tabstrip control from toolbar ,F Specify name for the tabstrip created $BAR"A1B( ,F Specify re5uired number of tab fields $#( ,F -rag and drop subscreen area for each tab field ,F 9ame the subscreen areas $S:+E7 S:+#( ,F Specify attributes for each tab field $9A;E7 "E?"7 F!"!6-E7 REFLF1E3-( ,F !reate two pushbuttons $-1SP3A<7 E?1"( Save the screen painter ,F !lick on Flow logic editor. 9ow create two subscreens $E%7 #%( for each tab field subscreen areas. !reate re5uired screen components for each subscreen $input fields namely 16E7 16#7 16&7 162( ,F Save ,F !ome back to Flow logic editor. 1n "6P 19!3:-E F13E7 specify following code> -A"A > 16E$E%(7 16#$E%(7 16&$E%(7 162$E%(. !69"R63S BAR"A1B "<PE "A+S"R1P. -A"A S!REE9 31BE S<,-<99R . !69"R63S statement is used to create a memory for tabstrip component in AS. S<,-<99R is a system variable to hold screen number. Save ,F Activate. 1n the F36@ 36*1! E-1"6R7 Specify following code for P+6 and PA1 modules> PR6!ESS +EF6RE 6:"P:". ;6-:3E S"A":SL%E%%. !A33 S:+S!REE9 S:+# 19!3:-19* 4SAP;<69!E;6RE4 4#%4. !A33 S:+S!REE9 S:+E 19!3:-19* 4SAP;<69!E;6RE4 4E%4. PR6!ESS AF"ER 19P:". ;6-:3E :SERL!6;;A9-L%E%%. !A33 S:+S!REE9 S:+E. !A33 S:+S!REE9 S:+#. Save ,F Activate. Specify following code in PA1 event between module,endmodule statements>

58 !ASE S<,:!6;;. @AE9 4-1SP3A<4. 3EA=E "6 31S",PR6!ESS19*. @R1"E > 16E7 16#7 16&7 1627 16K. @AE9 4E?1"4. 3EA=E PR6*RA;. @AE9 4"A+E4. S!REE9 J 4E%4. BAR"A1B,A!"1=E"A+ J 4"A+E4. @AE9 4"A+#4. S!REE9 J 4#%4. BAR"A1B,A!"1=E"A+ J 4"A+#4. E9-!ASE. !reate "code ,F Activate all components ,F E8ecute the program. LIST O8 VALUES: "his concept is used to provide drop,down facility for the input fields created using screen painter. Aere7 a type group called =R; is used in which we have following structure and internal table> VR%_VALUE is a structure with following fields7 BE< , !ode for the display value "E?" , !ontent of the display value =R;L=A3:ES is an internal table created for the above structure without header line. -eclare an internal table $1"A+( of type =R;L=A3:ES and also declare an e8plicit structure $@A( to append values into internal table using 31BE 319E 6F statement. =R;LSE"L=A3:ES is the function module used to fetch records from internal table 1"A+ to input field 16E.

59 TABLE CONTROL: "his component is used to view the internal table records in ;PP screen. "able control modification> 366P A" 1"A+,E9-366P statement in P+6 is used to fetch the records into internal table from db table. 366P A" 1"A+,E9-366P statement in PA1 is used to view the current data in internal table through table control. "o make modification7 create one more internal table for the same dbtable structure used in top include file. "o move first internal table records to the newly created one7 create a separate module to specify a statement for this purpose b w 366P,E9-366P in PA1. eg. PR6!ESS AF"ER 19P:". ;6-:3E :SERL!6;;A9-L%D%%. 366P A" 1"A+. ;6-:3E 1"A+"61"A+E. M 9ew module E9-366P. -ouble click on module name to specify following move statement. eg. ;6-:3E 1"A+"61"A+E 19P:". APPE9- 1"A+ "6 1"A+E. E9-;6-:3E. 1n Screen painter7 create 4;6-1F<4 pushbutton and specify event functionality in PA1 as follows> @AE9 4;6-1F<4. 366P A" 1"A+E. ;6-1F< B9AE FR6; 1"A+E. 1F S<,S:+R! J %. ;ESSA*E S%%P$GSAA+;S*(. E3SE1F S<,S:+R! J 2. ;ESSA*E E%%2$GSAA+;S*(.

60 E9-1F. E9-366P. SE3E!" M FR6; B9AE 19"6 "A+3E 1"A+. "+!3,319ES J S<,-+!9". E9-!ASE.

61

BATC) DATA CO**UNICATION


"o perform data migration from legacy database to SAP database7 we use batch data communications $+-!(. "o perform data migration7 following methods are available in +-!> +" DIRECT INPUT *ET)OD ," CALL TRANSACTION *ET)OD '" SESSION *ET)OD" "he above three methods re5uire source code to perform data migration. "here are predefined tools available to perform data migration with only minimal source code. "hey are> +" LEGAC/ S/STE* *IGRATION -OR.BENC) (LS*-)" ," RECORDING *ET)OD DIRECT INPUT *ET)OD: A#3 nt 4e$: :sing this method7 we can perform bulk data transfer. 9o manual intervention is re5uired for direct input method. -ata migration time is very less.

Di$ #3 nt 4e$: Since no manual intervention is re5uired7 we cannot correct the error record during runtime. "his method can be used only during SAP implementation7 not for support pro)ects. Eg. code> -A"A > +E*19 6F 1"A+ 6!!:RS %7 S"R$#KK(7 E9- 6F 1"A+. -A"A 1"A+E 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. !A33 F:9!"169 4:P36A-4 E?P6R"19* F13E9A;E J 4!>T-1R."?"4

62 F13E"<PE "A+3ES -A"AL"A+ J 4AS!4 J 1"A+.

366P A" 1"A+. SP31" 1"A+,S"R A" 4 4 19"6 1"A+E,B:99R 1"A+E,9A;EE 1"A+E,6R"%E 1"A+E,3A9-E. APPE9- 1"A+E. E9-366P. 366P A" 1"A+E. 19SER" 19"6 B9AE =A3:ES 1"A+E. 1F S<,S:+R! J %. @R1"E > 4RE!6R-S ARE 19SER"E- 19"6 B9AE4. E3SE1F S<,S:+R! J 2. @R1"E > 4RE!6R-S A3REA-< E?1S"S4. E9-1F. E9-366P. BATC) DATA CO**UNICATIONS: "his concept deals with data migration from legacy system database into SAP database. @henever a company moves into SAP from legacy system7 +-! is used to populate the new SAP database with their old re5uired records. *et7!#$ in BDC: E. DIRECT INPUT *ET)OD , :sing this method7 records from the flat file are uploaded first into an internal table created for the flat file structure. :sing a string function $SP31" functionality(7 the records are splitted based on the separators and then inserted into a new internal table which is created for a table where the datas are to be inserted. eg. code> -A"A > +E*19 6F 1"A+ 6!!:RS %7 S"R$#KK(7 E9- 6F 1"A+. -A"A 1"A+E 31BE B9AE 6!!:RS % @1"A AEA-ER 319E.

63 !A33 F:9!"169 4:P36A-4 E?P6R"19* F13E9A;E J 4!>T+ASB."?"4 F13E"<PE J 4AS!4 "A+3ES dataLtab J 1"A+. 366P A" 1"A+. SP31" 1"A+,S"R A" 4 4 19"6 1"A+E,B:99R 1"A+E,9A;EE 1"A+E,3A9-E 1"A+E,6R"%E. APPE9- 1"A+E. E9-366P. 366P A" 1"A+E. 19SER" 19"6 B9AE =A3:ES 1"A+E. 1F S<,S:+R! J %. @R1"E > 4RE!6R-S ARE 19SER"E-4. E3SE1F S<,S:+R! J 2. @R1"E > 4RE!6R-S A3REA-< E?1S"4. E9-1F. E9-366P. 1n the above program7 4:P36A-4 function module is used to fetch the flat file records and then insert into internal table created for flat file structure $1"A+(. ," CALL TRANSACTION *ET)OD" !6-E> -A"A > +E*19 6F 1"A+ 6!!:RS %7 S"R$#KK(7 E9- 6F 1"A+. !A33 F:9!"169 4:P36A-4 E?P6R"19* F13E9A;E J 4!>TS"A3."?"4 F13E"<PE J 4AS!4 "A+3ES dataLtab J 1"A+. -A"A 1"A+E 31BE B9AE 6!!:RS % @1"A AEA-ER 319E.

64 366P A" 1"A+. SP31" 1"A+,S"R A" 474 19"6 1"A+E,B:99R 1"A+E,9A;EE 1"A+E,6R"%E 1"A+E,3A9-E. APPE9- 1"A+E. E9-366P. -A"A C"A+ 31BE +-!-A"A 6!!:RS % @1"A AEA-ER 319E. -A"A B"A+ 31BE +-!;S*!633 6!!:RS % @1"A AEA-ER 319E. 366P A" 1"A+E. PERF6R; PR6*19F6 :S19* 4SAP;GS"A319!"4 4E%%4. PERF6R; PERF6R; PERF6R; PERF6R; F3-19F6 F3-19F6 F3-19F6 F3-19F6 :S19* :S19* :S19* :S19* 4@A,B:99R4 1"A+E,B:99R. 4@A,9A;EE4 1"A+E,9A;EE. 4@A,3A9-E4 1"A+E,3A9-E. 4@A,6R"%E4 1"A+E,6R"%E.

!A33 "RA9SA!"169 4GS"A319!"4 :S19* C"A+ ;6-E 494 ;ESSA*ES 19"6 B"A+. E9-366P. 366P A" B"A+. @R1"E > B"A+,"!6-E7 B"A+,-<9A;E7 B"A+,-<9:;+7 B"A+,;S*"<P7 B"A+,;S*9R7 S<,S:+R!. E9-366P. F6R; PR6*19F6 :S19* PR6*9A;E S!R9:;. !3EAR C"A+. REFRESA C"A+. C"A+,PR6*RA; J PR6*9A;E. C"A+,-<9PR6 J S!R9:;. C"A+,-<9+E*19 J 4?4. APPE9- C"A+. E9-F6R;.

65 F6R; F3-19F6 :S19* F3-9A;E F3-=A3. !3EAR C"A+. C"A+,F9A; J F3-9A;E. C"A+,F=A3 J F3-=A3. APPE9- C"A+. &. +-! SESS169 ;E"A6-. TOOLS USED IN BDC: 3E*A!< S<S"E; ;1*RA"169 @6RB+E9!A $3S;@( +-! RE!6R-19* ;E"A6BDC CALL TRANSACTION *ET)OD: Since we cannot modify the error record using direct input method7 we go for call transaction method. Aere7 we create a screen to populate error records in input fields and from the screen7 we can modify the error records and then insert into database table. Step$ t! <e f!ll!Ce# in C ll T% n$ cti!n *Et7!#: E. Analyze the flat file. #. !reate a screen for database table fields using ;PP. !reate a "ransaction code for the screen. &. @rite the following code in SE&D editor> -A"A > +E*19 6F 1"A+ 6!!:RS %7 S"R$#KK(7 E9- 6F 1"A+. !A33 F:9!"169 4:P36A-4 E?P6R"19* F13E9A;E J 4!>TB9A."?"4 F13E"<PE J 4AS!4 "A+3ES -A"AL"A+ J 1"A+. -A"A 1"A+E 31BE B9AE 6!!:RS % @1"A AEA-ER 319E.

66 -A"A C"A+ 31BE +-!-A"A 6!!:RS % @1"A AEA-ER 319E. 366P A" 1"A+. SP31" 1"A+,S"R A" 474 19"6 1"A+E,B:99R 1"A+E,9A;EE 1"A+E,6R"%E 1"A+E,3A9-E. APPE9- 1"A+E. E9-366P. 366P A" 1"A+E. PERF6R; PR6*19F6 :S19* 4SAP;G!A33"RA9SA!"1694 4E%%4. PERF6R; PERF6R; PERF6R; PERF6R; F3-19F6 F3-19F6 F3-19F6 F3-19F6 :S19* :S19* :S19* :S19* 4BAR"A1B,B:99R4 1"A+E,B:99R. 4BAR"A1B,9A;EE4 1"A+E,9A;EE. 4BAR"A1B,6R"%E4 1"A+E,6R"%E. 4BAR"A1B,3A9-E4 1"A+E,3A9-E.

!A33 "RA9SA!"169 4G!A33"RA9S4 :S19* C"A+. E9-366P. F6R; PR6*19F6 :S19* PR6*9A;E S!R9:;. !3EAR C"A+. REFRESA C"A+. C"A+,PR6*RA; J PR6*9A;E. C"A+,-<9PR6 J S!R9:;. C"A+,-<9+E*19 J 4?4. APPE9- C"A+. E9-F6R;. F6R; F3-19F6 :S19* F3-9A;E F3-=A3:E. !3EAR C"A+. C"A+,F9A; J F3-9A;E. C"A+,F=A3 J F3-=A3:E. APPE9- C"A+.

67

E9-F6R;. Save ,F Activate ,F E8ecute. 1n the above code7 BDCDATA is a structure used to populate the internal table records into the screen fields. "he +-!-A"A structure has following components> PROGRA* , Aolds the name of ;PP program where the screen is created. D/NPRO , Aolds the screen number where the internal fields to be populated. D/NBEGIN , :sed to initiate the screen when the program is e8ecuted. "he default value to be specified is 4?4. 8NA* , Specifies input field name in the screen where the data is to be populated. 8VAL , Specifies from which internal table field7 the data should be passed to the screen field. ECALL TRANSACTIONE statement is used to call the screen created to populate error records. S<9"A?> CALL TRANSACTION <T'o)e" USING <#DCDATA_*tab" %ODE <!o)e" UPDATE <(+)ate", ;6-E> "his is used to specify which mode to be followed when calling transaction. "he types of mode are> A , -isplay the screen. E , -isplay only error records from the flat file. 9 , +ackground processing. :P-A"E> "his is used to specify the update task of records in the database table. "he types of update tasks are> A , Asynchronous update S , Synchronous update 3 , 3ocal update A#3 nt 4e$ !f CALL TRANSACTION: M Error records can be modified.

68 M "his method can be used in support pro)ects. BDC CALL TRANSACTION: -A"A > +E*19 6F 1"A+ 6!!:RS %7 S"R$#KK(7 E9- 6F 1"A+. -A"A 1"A+E 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. -A"A C"A+ 31BE +-!-A"A 6!!:RS % @1"A AEA-ER 319E. !A33 F:9!"169 4:P36A-4 E?P6R"19* F13E9A;E J 4!>TBAR"A1B."?"4 F13E"<PE J 4AS!4 "A+3ES -A"AL"A+ J 1"A+. 366P A" 1"A+. SP31" 1"A+,S"R A" 474 19"6 1"A+E,B:99R 1"A+E,9A;EE 1"A+E,6R"%E 1"A+E,3A9-E. APPE9- 1"A+E. E9-366P. 366P A" 1"A+E. PERF6R; PR6*19F6 :S19* 4SAP;<!A33"RA9SA!"1694 42%%4. PERF6R; PERF6R; PERF6R; PERF6R; F3-19F6 F3-19F6 F3-19F6 F3-19F6 :S19* :S19* :S19* :S19* 4@A,B:99R4 1"A+E,B:99R. 4@A,9A;EE4 1"A+E,9A;EE. 4@A,6R"%E4 1"A+E,6R"%E. 4@A,3A9-E4 1"A+E,3A9-E.

!A33 "RA9SA!"169 4<!A33"RA9S4 :S19* C"A+. E9-366P. F6R; PR6*19F6 :S19* PR6*9A;E S!R9:;. !3EAR C"A+. REFRESA C"A+. C"A+,PR6*RA; J PR6*9A;E. C"A+,-<9PR6 J S!R9:;. C"A+,-<9+E*19 J 4?4. APPE9- C"A+.

69 E9-F6R;. F6R; F3-19F6 :S19* F3-9A;E F3-=A3:E. !3EAR C"A+. C"A+,F9A; J F3-9A;E. C"A+,F=A3 J F3-=A3:E. APPE9- C"A+. E9-F6R;. CLEAR statement is used to delete the contents of the header line of internal table. RE8RES) statement is used to delete the contents of the body area of internal table. 8REE statement is used to delete the internal table after the program is closed. DELETE statement is used to delete some particular contents of the internal table. S<9"A?> !A33 "RA9SA!"169 I"codeF :S19* IbdcdataLitabF ;6-E ImodeF :P-A"E ItaskF. "code is the name of the transaction code which contains screen to display error records. bdcdataLitab is an internal table which is created for +-!-A"A structure. mode specifies the type of mode for processing. "here are three types as follows> A , Foreground processing E , Errors only 9 , +ackground processing @hen 494 is used7 a predefined structure called +-!;S*!633 should be used to collect the messages triggered during background processing. Synta8> -A"A B"A+ 31BE +-!;S*!633 6!!:RS % @1"A AEA-ER 319E. !A33 "RA9SA!"169 4<!A33"RA9S4 :S19* C"A+ ;6-E 494 ;ESSA*ES 19"6 B"A+.

70 :pdate specifies the task of updating records into database table. A , Asynchronous update , A return value is generated only after updating all the records in related tables. S , Synchronous update , A return value is generated for each record updation in related tables inside the database. BDC SESSION *ET)OD: Since -irect 1nput and !all "ransaction methods cannot be used for support pro)ects due to the database availability and networking constraints7 SAP suggests to use Session ;ethod for data migration in support pro)ects. 1n this method7 a session is created in the Application Server. A session has a session memory used to hold the internal table records. @e can process the session later whenever database is available with free network traffic. 8UNCTION *ODULES USED IN BDC SESSION *ET)OD: E. +-!L6PE9L*R6:P , "his F; is used to create a session in Appn. Server. #. +-!L19SER" , "his F; is used to insert the internal table records into session memory. &. +-!L!36SEL*R6:P , "his F; is used to save the records in session memory and close it to process later. Eg. code> -A"A > +E*19 6F 1"A+ 6!!:RS %7 S"R$#KK(7 E9- 6F 1"A+. -A"A 1"A+E 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. -A"A C"A+ 31BE +-!-A"A 6!!:RS % @1"A AEA-ER 319E. !A33 F:9!"169 4:P36A-4 E?P6R"19* F13E9A;E J 4!>TBAR"A1B."?"4 F13E"<PE J 4AS!4 "A+3ES -A"AL"A+ J 1"A+. 366P A" 1"A+. SP31" 1"A+,S"R A" 474 19"6 1"A+E,B:99R 1"A+E,9A;EE 1"A+E,6R"%E

71 1"A+E,3A9-E. APPE9- 1"A+E. E9-366P. !A33 F:9!"169 4+-!L6PE9L*R6:P4 E?P6R"19* !31E9" J S<,;A9-" *R6:P J 4SAA+A9A4 BEEP J 4?4 :SER J S<,:9A;E. 366P A" 1"A+E. PERF6R; PR6*19F6 :S19* 4SAP;<!A33"RA9SA!"1694 42%%4. PERF6R; PERF6R; PERF6R; PERF6R; F3-19F6 F3-19F6 F3-19F6 F3-19F6 :S19* :S19* :S19* :S19* 4@A,B:99R4 1"A+E,B:99R. 4@A,9A;EE4 1"A+E,9A;EE. 4@A,6R"%E4 1"A+E,6R"%E. 4@A,3A9-E4 1"A+E,3A9-E.

!A33 F:9!"169 4+-!L19SER"4 E?P6R"19* "!6-E J 4<!A33"RA9S4 "A+3ES -<9PR6"A+ J C"A+. E9-366P. !A33 F:9!"169 4+-!L!36SEL*R6:P4. F6R; PR6*19F6 :S19* PR6*9A;E S!R9:;. !3EAR C"A+. REFRESA C"A+. C"A+,PR6*RA; J PR6*9A;E. C"A+,-<9PR6 J S!R9:;. C"A+,-<9+E*19 J 4?4. APPE9- C"A+. E9-F6R;. F6R; F3-19F6 :S19* F3-9A;E F3-=A3:E.

72

!3EAR C"A+. C"A+,F9A; J F3-9A;E. C"A+,F=A3 J F3-=A3:E. APPE9- C"A+. E9-F6R;. Save ,F Activate ,F E8ecute ,F A session is created. "o process the session7 *6"6 S;&K "code. N 3i4 ti!n$ t! p%!ce$$ t7e $e$$i!n: S;&K ,F Select the session ,F click on PR6!ESS pushbutton from appn. toolbar ,F 6pens an interface ,F Select -1SP3A< ERR6RS 693< radiobutton ,F Process ,F 6pens the user,defined screen ,F ;odify and 1nsert the records ,F Finally opens a message ,F !lick on Session 6verview pushbutton ,F !omes back to S;&K screen ,F Select the session ,F !lick on 3og Pushbutton from appn. toolbar ,F "o view the detailed log7 select session from here ,F !lick Analyze 3og pushbutton from appn. toolbar ,F 6pens an interface ,F !lick on 3og !reated on...date... tab button ,F @e can view the detailed log of transaction. 1f +ackground mode is selected7 *6"6 S;&P "code. S;&P ,F !lick on 6wn Cobs pushbutton from appn. toolbar ,F Select session from the list ,F !lick on Cob 3og pushbutton from appn. toolbar ,F *ives you detailed log of background processing.

73

LS*- ( Le4 cy Sy$tem *i4% ti!n -!%5<enc7) 1s a E2 step 9avigation to Perfrom +-!7 here A+APer is not writing a single !ode to transfer Flat file data. 3S;@ is a collection of Pro)ects. Pro)ect is a collection of Sub Pro)ects. Sub pro)ect is a collection of 6b)ects7 here 6b)ect represents transactions. 3S;@ ,F 9ame the Pro)ect $ GN&%3S;@ ( ,F 9ame the Sub Pro)ect $ ;; ( ,F 9ame the 6b)ect $ ;;%E ( ,F !lick on !reate From application toolbar ,F 6pens an interface ,F Enter the -escription for pro)ect 7 sub pro)ect and 6b)ect ,F !lick on E8ecute from Application toolbar . 6pens an interface with list of 3S;@ navigations. Step F+. ;aintain 6b)ect Attributes 1n this step we need to specify a recording ob)ect to be assigned for 3S;@ to process the +-! data. select the radiobutton ,F !lick on E8ecute from Application toolbar ,F 6pens Another 1nterface ,F !lick% on Pushbutton Recording 6verviews 7 to create a new recording 6b)ect ,F 6pens 3PS ,F Select the data from screen ,F !lick on !reate Recording from application toolbar ,F 9ame the recording 6b)ect $ zrecE ( ,F Enter description $ any ( ,F !lick on continue ,F Specify "code $ mm%E ( ,F Accept the SA;P3E data ,F Save the Record ,F by default sap displays list of fields information where data is accepted in the form SC"A+S 1nternal table data ,F ;ove this fields into Recording 6b)ect fields by clicking on S-efault allS pushbutton from application toolbar ,F save the Entries ,F !ome back ,F come back ,F !hange mode of the screen into !hange mode ,F Select the radiobutton called as +atch 1nput Recording ,F 9ame the recording 6b)ect $ GRE!E ( ,F Save the Entries ,F !ome back . Step F, ;aintain Source Structures 1n this step we have to define 9ame of the 1nternal table where data to be populated from Flat files. Select ,F E8ecute from Application ,F 6pens an interface ,F !hange the mode into !hange mode ,F !lick on !reate Structure From Application toolbar ,F 9ame the 1nternal table $ 1"A+E ( ,F Enter -escription $ -atabase format internal table ( ,F !lick on !ontinue ,F save the Entries ,F !ome back. Step F'" ;aintain Source Fields

74 1n this step we are adding fields to the 1nternal table created in Second step. Select the radiobutton ,F !lick on E8ecute ,F 6pens an interface ,F !hange ;ode of the screen ,F select the 1nternal table from the 3ist ,F !lick on !reate field from application toolbar ,F 9ame the Field $ ;A"9R ( ,F Enter -escription $any( ,F Set the Size $ ED( ,F Specify -ata type $ ! ( ,F !lick on !ontinue. :sing the same step add 6ther Fields ;+RSA $ 1ndustry ( E $!( ;"AR" $;at type( 2 $!( ;AB"? $;at -esc( 2% $!( ;E19S $;at measure( & $!( ,F save the Entries ,F !ome back. Step F(. ;aintain Structure Relations 1n this step we need to *enerate Relation between 1"A+E and Recording 6b)ect. select ,F E8ecute ,F 6pens an interface ,F Relation ship 7 by defult generated by SAP ,F !hange mode of the screen ,F save the Entries ,F !ome back. $tep F0. ;aintain Field ;apping and !onversion Rules ;apping the Fields of 1tabE with Recording 6b)ect is the step to be processed. select ,F E8ecute ,F !hange ;ode of Screen ,F Select the Field From 3ist of recording ob)ect ,F !lick on Source Field From Application toolbar ,F -isplays the 3ist of 1nternal table fields ,F -ouble click on Proper Field. 1n the same way map all Fields of Recording 6b)ect with All Fields of 1nternal table ,F Save the Entries ,F !ome back. Step UP. ;aintain Fi8ed =alues7 "ranslations7 :ser,-efined Routines "his is optional Step 1n +-! of 3S;@ E8ecute ,F !ome back. Step F?" Specify Files Select ,F E8ecute ,F 6pens an interface ,F !hange ;ode of Screen ,F select legacy data on P! ,F !lick on !reate From Application toolbar ,F 9ame the File $ ->TN&%A;Tmatdata.t8t ( ,F Enter -escription $ any ( ,F

75 Sepecify Separator as S!ommaS ,F !lick on !ontinue ,F Save the Entries ,F !ome back. Step F6" Assign Files 1n this step we need to assign the Flat fiel 1nto 1nternal table created in Second step. select ,F E8ecute ,F !hange ;ode of the screen ,F Save the Entries ,F !ome back. Step FA" 1mport -ata 1n this step SAP Reads the Flat File data and stores in the form of S.lsmw.readS file. Select ,F E8ecute ,F 6pens an interface ,F !lick on E8ecute ,F Sap *enerates a report as Flat file is converted into S.readS file with 9umber of transactions ,F !ome back ,F !ome back. Step F+B" -isplay 1mported -ata Select ,FE8ecute ,F 6pen an 1nterface ,F !lick on !ontinue ,F displays the data in 1nternal table $itabE( ,F !ome back. Step F++. !onvert -ata 1n this step -ata will be converted into S.lsmw.convS file to make data is ready for populating into Session ob)ect. select ,F e8ecute ,F E8ecute ,F Sap *enerates a report as file is converted into !onv ,F !ome back ,F come back. Setp F+," -isplay !onverted -ata select ,F E8ecute ,F6pens an interface ,F !lick on continue,F *enerates a report with *reen !olor ,F !ome back. Setp F+'" !reate +atch 1nput Session Select ,FE8ecute ,F 6pens an interface ,F Select the checkbo8 ,F !lick on E8ecute ,F Prompts a message. Step F+(" Run +atch 1nput Session 6pens S;&K tcode to process +-! data.

76

select ,F E8ecute ,F Select session ob)ect name ,F !lick on Process ,F !lick on continue ,F SAP trasnfers all file data into R & applications. RECORDING *ET)OD: (S)DB). +-! recording method is a SAP tool used to perform data migration. :sing this method7 a recording ob)ect is created for any one of the predefined screens $;;%E7 ?B%E7 and ?-%E( the sample values entered in the screen input fields are taken to create a +-!-A"A structure. +ased on the structure created7 the source code is automatically generated by the system. 1n this method we cannot use user,defined screens to populate the error records. N 3i4 ti!n$ t! pe%f!%m # t mi4% ti!n ;$in4 %ec!%#in4 met7!#.

SA-+,F click on new recording push button from the application tool bar,F opens an interface,Fname the recording ob)ect,Fspecify "!6-E$ mm%E( for which the recording is done$mm%E( ,Fcontinue,Fopens specified screen $mm%E( ,Fenter sample values V ;aterial no7 ;aterial type7 industry sector$matnr7mtart7mbrsh( ,Fclick on select view pushbutton from the application tool bar,Fselect basic dataE from interface,Fcontinue,Fopens second screen,F enter description$makt8( and measurement$meins( ,F click on save ,F opens an interface with +-!-A"A structure filled with the sample values ,F save the recording ,F comeback ,F select the recording ob)ect ,F click on program pushbutton from the application tool bar ,F opens an interface ,F enter the program name ,F select transfer from recording radio button ,F continue ,F enter a short description ,F clickon source code push button ,F opens SE&D editor with auto generated code. After the include statement7 specify the following code. M 1nclude bdcrec8E.$include stmt(. -ata > begin of itab occurs %7 Str$#KK(7 End of itab. -ata itabE like mara occurs % with header line. After the start of selection event7 specify the following code. Start,of,selection. !all function WuploadX7

77 E8porting File name J Wc>Tmara.t8tX File type J WascX "ables -ataLtab J itab. 3oop at itab. Split itab at W7X into itabE,matnr itabE,mtart itabE,mbrsh itabE,meins. Append itabE. Endloop. After the perform open,group 3oop at itabE. Replace all the sample values for the fields with the internal table name. itabE,matnr itabE,mtart itabE,mbrsh itabE,meins endloop. Perform closeLgroup. Save it ,F activate ,F e8ecute. :sing recording method7 we can perform data migration in the following # ways. 1. Session method. 2. !all transaction method. @hen session method is selected7 specify session name ,F checkbo87keep batch input session ,F e8ecute. "o process the session7 go to sm&K and process.

78

SAPSCRIPTS
"his is a tool used to redirect SAP data to output devices. SENE is the "code to create SAPScript. !omponents of a SAPScript tool are> +" BASIC SETTINGS" Paragraph format7 character format. ," AD*INISTRATIVE SETTINGS" 9ame of the form7 short description. 3ayout is used to create a form in SAPScript. 3ayout is a collection of pages. Page is a collection of @indows. Type$ !f -in#!C$: E. ;ain @indow , "his is a common window for all pages. "his is a default window. #. !onstant @indow , "his window is used to create footer space7 header space for a particular page. &. =ariable @indow , "his is a subwindow. 2. *raphical @indow , "his is an optional window7 which is used to create logos or some other graphics for the page. NAVIGATIONS 8OR CREATING A SAPSCRIPT: SENE ,F Specify Form name starting with G or < $GSAA+F6R;( ,F !lick on !reate ,F 6pens an interface ,F Enter short description ,F !lick on 4Paragraph Format4 from Appn. toolbar ,F Specify Paragraph 9ame $PE(,F Press Enter ,F Enter short description ,F !lick on 4-efinitions4 pushbutton from application toolbar ,F Specify -efault Paragraph $PE( created ,F !lick on 3ayout pushbutton from appn. toolbar ,F 6pens a layout with a default window 4;A194 ,F Right click on ;ain @indow ,F Select 4Edit "e8t4 ,F 6pens a 3ine Editor ,F Specify a statement ,F !ome back ,F Save ,F Activate the form ,F A SAPscript is created. "o invoke the form created7 we have to create a print program. !reate an E8ecutable Program and specify the following>

79 !A33 F:9!"169 46PE9LF6R;4 E?P6R"19* F6R; J 4GSAA+F6R;4 3A9*:A*E J S<,3A9*:. !A33 F:9!"169 4@R1"ELF6R;4 E?P6R"19* E3E;E9" J 4E3E;E9"4 @19-6@ J 4;A194. !A33 F:9!"169 4!36SELF6R;4. ,F Save ,F Activate ,F E8ecute ,F 6pens an interface ,F Specify output device as 3P%E ,F !lick on Print Preview $FD( pushbutton ,F E8ecutes the form. "he F; 46PE9LF6R;4 is used to call the sapscript form. Aere7 we have to specify the name of the form as an argument. 4@R1"ELF6R;4 is used to specify the name of the te8t elements and window types. 4!36SELF6R;4 is used to save and close the form attributes. "he function modules 6PE9LF6R; and !36SELF6R; are mandatory ones. PASSING ARGU*ENTS TO T)E 8OR*: 1n 3ine editor7 specify an argument enclosed by an ampersand symbol $/(. eg. /BAR"A1B/. Save ,F Activate the form. "o pass a value from the print program to the form7 declare the variable as follows in Print PRogram> -A"A BAR"A1B$E%( =A3:E 4!AE99A14. ....6PE9LF6R; ... ....!36SELF6R; Save ,F Activate ,F E8ecute.

80 PASSING TABLE VALUES AS AN ARGU*ENT TO SAPSCRIPT: 1n the line editor7 specify the table field arguments enclosed by 4/4 symbol as follows> E E3E;E9" /B9AE,B:99R/ 77 /B9AE,9A;EE/ 77 /B9AE,3A9-E/ Save ,F Activate. 1n the Print Program7 specify following code> "A+3ES B9AE. !A33 F:9!"169 46PE9LF6R;4 E?P6R"19* F6R; J 4GSAA+F6R;E4 3A9*:A*E J S<,3A9*:. SE3E!" M FR6; B9AE. !A33 F:9!"169 4@R1"ELF6R;4 E?P6R"19* E3E;E9" J 4E3E;E9"4 @19-6@ J 4;A194. E9-SE3E!". !A33 F:9!"169 4!36SELF6R;4. Save ,F Activate ,F E8ecute. PASSING INTERNAL TABLE AS AN ARGU*ENT TO T)E 8OR*: 1n line editor7 specify following arguments> E E3E;E9" /1"A+,B:99R/ Save ,F Activate. 1n Print Program7 specify following code> -A"A 1"A+ 31BE B9AE 6!!:RS % @1"A AEA-ER 319E. /1"A+,9A;EE/ /1"A+,3A9-E/

81 SE3E!" M FR6; B9AE 19"6 "A+3E 1"A+. !A33 F:9!"169 46PE9LF6R;4 E?P6R"19* F6R; J 4GSAA+F6R;E4 3A9*:A*E J S<,3A9*:. 366P A" 1"A+. !A33 F:9!"169 4@R1"ELF6R;4 E?P6R"19* E3E;E9" J 4E3E;E9"4 @19-6@ J 4;A194. E9-366P. !A33 F:9!"169 4!36SELF6R;4. ,F Save ,F Activate ,F E8ecute. ADDING I*AGES TO T)E 8OR*: !reate a .bmp file and save it in a directory ,F *oto SEND "code ,F -ouble click +;AP +itmap images ,F !lick on 1mport icon from appn. toolbar ,F 6pens an interface ,F Specify the path of .bmp file from the 6S ,F Specify the name for the image ,F Select !olor bitmap image radiobutton ,F !lick on !ontinue ,F 1mage is imported. "o add the imported image into the form7 right click on the form layout ,F Select !reate *raphic ,F 6pens an interface ,F Select image from the form directory ,F Select !olor bitmap image radiobutton ,F Specify resolution as E%% ,F !ontinue ,F An image is added to the script. Simply call the form from the print program. "o upload ."1FF files into the SAPscript directory7 make use of a predefined e8ecutable program called as RS"?3-;!. 1n SE&D "code7 specify the above name7 click on e8ecute pushbutton from application toolbar ,F 6pens an interface ,F Specify the file path ,F E8ecute. "e8t Elements in the line editor are used to avoid data duplication.

82

S*ART8OR*S
ADVANTAGES O8 S*ART8OR*S: E. Smartforms does not re5uire paragraph formats as a mandatory one. #. Smartforms does not duplicate the data. &. Smartforms are !lient,independent and language,independent. 2. @e can apply styles for the te8ts using Smartforms. K. Print programs does not contain any function modules to call the form. S;AR"F6R;S is the "code to create smartforms in A+AP. Sm %tf!%m$ 7 $ t7%ee c!mp!nent$> Gl!< l Settin4$: E. Form Attributes , Aolds the description about the smartform. #. Form 1nterface , Aolds the import and e8port parameters for the smartforms. &. *lobal -efinitions , :sed to declare variables for the smartform that can be accessed by any component within the smartform. P 4e$ n# -in#!C$: "his area is used to create new pages7 windows $header7 footer7 constant window7 main window7 variable window7 graphic window(. N 3i4 ti!n$ t! c%e te Sm %tf!%m$: S;AR"F6R;S ,F Specify form name starting with G or < ,F !lick on !reate ,F 6pens an interface ,F Enter short description ,F -ouble click on Form 1nterface ,F Specify following parameter in 1;P6R" tab button> S"R "<PE ! ,F E8pand Pages and @indows ,F +y default7 a ;ain @indow is present ,F Right click on ;ain @indow ,F !reate ,F "e8t ,F 6pens Form Editor ,F "o go to line editor7 !lick on 4"8t Editor4 pushbutton on the upper left corner of the form editor ,F Specify the variable $/S"R/( in the first line of line editor ,F !ome back ,F Save ,F Activate ,F E8ecute ,F 6pens Form +uilder with autogenerated function module for the smartform $4 E+!-@+ SF%%%%%%2#4( ,F !opy the function module generated. "o invoke the smartform from SE&D editor7 !all the Function module and paste the F; copied from smart form function builder screen as follows> -A"A 9A;E$E%( =A3:E 419-1A4. !A33 F:9!"169 4 E+!-@+ SF%%%%%%2#4 E?P6R"19*

83 S"R J 9A;E. ,F Save ,F Activate ,F E8ecute in the same way as Sapscript. N 3i4 ti!n$ t! p $$ inte%n l t <le $ n %4;ment t! Sm %tf!%m$: !reate a smartform ,F 1n the Form interface ,F !lick on "ables tab button ,F Specify the following internal table> 1"A+ 31BE ;ARA. ,F -ouble click on *lobal -efinitions ,F Specify the global variable as follows> 1"A+E 31BE ;ARA. ,F E8pand Pages and @indows ,F Right click on ;ain @indow ,F !reate ,F "able ,F !lick on -ata tab button ,F 1n the 366P section7 for the operand fields7 specify the following> 1"A+ 19"6 1"A+E. ,F Right click on ;ain Area ,F !reate ,F "able 3ine ,F 1n the 3ine "ype input field7 a line type called '3"<PEE is automatically generated ,F Select it. "o create internal table fields7 right click on "e8t cell ,F !reate ,F "e8t ,F Select *eneral Attributes tab button ,F 6pens Form Editor ,F *oto 3ine editor by clicking on 4"8t Editor4 pushbutton ,F Specify the following in the first line> /1"A+E,;A"9R/77/1"A+E,;"AR"/77/1"A+E,;+RSA/77/1"A+E,;E19S/ ,F !ome back ,F Save ,F Activate ,F E8ecute ,F !opy the autogenerated F;. 1n SE&D program7 specify the following> -A"A 1"A+E 31BE ;ARA 6!!:RS % @1"A AEA-ER 319E. SE3E!" M FR6; ;ARA 19"6 "A+3E 1"A+E. !A33 F:9!"169 4 E+!-@+ SF%%%%%%2&4 "A+3ES 1"A+ J 1"A+E. Save ,F Activate ,F E8ecute in the same way as above.

You might also like