ABAP Programming.ppt
《ABAP Programming.ppt》由会员分享,可在线阅读,更多相关《ABAP Programming.ppt(135页珍藏版)》请在三一办公上搜索。
1、ABAP Training,ABAP ProgrammingDavid Sun,ABAP Programming Language,Advanced Business Application Programming,ABAP,Reporting,Programs can be written interactively using the capabilities of the R/3 system.Programs can be executed both online or in the background.Background jobs can also be scheduled to
2、 run at specific intervals.,Non-SAPLegacySystem,General Programming,Module Pool Programming,Batch Input Processing,Inter-System Communication,Sequential Dataset Processing,Terms to Remember,Report:An ABAP program whose output is a list,Module Pool:A dialog program which is a collection of screens,Li
3、st:The output generated by an ABAP report program,ProgramA series of ABAP statements,ABAP Editor,ABAP Editor,Reporting,ABAPDevelopment,Reporting and ABAP Development,Programming Environment-The ABAP Editor,Programming EnvironmentOnline Debugging,Basic Functions of the ABAP Editor,Program source entr
4、y area,Find andRepeat Find,Toggles fromdisplay to change mode,Undo,ABAP Help,Syntax Check,Standard toolbar,Cut,copy and paste to and from a buffer,The PROGRAM Menu Option,The EDIT Menu Option,The GOTO Menu Option,The UTILITIES Menu Option,The BLOCK/BUFFER Menu Option,The SETTINGS Menu Option,To set
5、Editor mode,use the menu pathSettings-Editor modePreferred settings:PC mode with line numbering With compression logic Key word large,DATA COUNT TYPE I.DATA TITLE(25).MOVE 1 TO COUNT.MOVE President TO TITLE.WRITE TITLE.WRITE COUNT.,Basic ABAP Program Syntax,ABAP Program,Statement.,Word 1,Word 2,Word
6、 3,Word 4,Key word,Parameter,field,or constant,Chaining Statements in ABAP,DATA COUNT TYPE I.DATA TITLE(25).MOVE 1 TO COUNT.MOVE President TO TITLE.WRITE TITLE.WRITE COUNT.,WRITE:TITLE,COUNT.,DATA:COUNT TYPE I,TITLE(25).,MOVE:1 TO COUNT,President TO TITLE.,Comments in ABAP,A double quotation mark(“)
7、anywhere on a line makes everything that follows a comment.,An asterisk(*)in column1 makes the entire linea comment line.,ABAP Program Structure,Program Name AreaUse REPORT for listing programsUse PROGRAM for online programs,Declaration SectionUsed for defining tables,variablesand constants,Statemen
8、t SectionUsed for coding executableABAP statement,ABAP Program Attributes,Type:1-Executable ProgramI-Include ProgramM-Module PoolF-Function GroupS-Subroutine Pool,Program title is required,Application:S-BasisU-EDM(Enterprise Data Model)V-Sales and DistributionY-Customer Head OfficeZ-Customer Branch*
9、-For all Applications,Running an ABAP Program,From the ABAP Editor:With the program displayed,ProgramExecute,An Alternative Method:From the System Menu,choose Services Reporting to launch the program,One Final Method:From the ABAP Editor:Initial Screen,type the program name,then click on the Execute
10、 push-button,The ABAP“WRITE”Statement,WRITE*.SKIP 2.WRITE:The date today is:,SY-DATUM,The current time is:,SY-UZEIT.SKIP 2.WRITE*.,1-*The date today is:12/30/1996 The current time is:12:32:06*,Notice that there is an automatic space between the fields written to the list.,ABAP Format Specifications,
11、WRITE 10*City of Philadelphia*.SKIP 2.WRITE:10 Ticket Date,SY-DATUM.WRITE:/10 Ticket Time,SY-UZEIT.ULINE/10(60).SKIP 2.WRITE 10*Department of Public Safety*.,*City of Philadelphia*Ticket Date 01/01/1997 Ticket Time 18:01:00-*Department of Public Safety*,ABAP Format Options,WRITE 10*City of Philadelp
12、hia*.SKIP 2.WRITE:10 Ticket Date,25 SY-DATUM,/10 Ticket Time,SY-UZEIT UNDER SY-DATUM.ULINE/10(60).SKIP 2.WRITE 10*Department of Public Safety*.,*City of Philadelphia*Ticket Date 01/01/1997 Ticket Time 18:01:00-*Department of Public Safety*,“WRITE”Statement Extended Syntax,WRITE.,/p(I)/=Line Feedp=Co
13、lumn PositionI=Output Length,Program Field orText Literal,Format Options,WRITE*City of Philadelphia*.SKIP.WRITE:/Ticket Date,15 SY-DATUM.WRITE:/Ticket Time,15 SY-UZEIT.SKIP.WRITE*Department of Public Safety*.NEW-PAGE.WRITE:Comments:.,1-*City of Philadelphia*Ticket Date 01/01/1997 Ticket Time 18:01:0
14、0*Department of Public Safety*2-Comments:,“NEW-PAGE”Statement,Writing Icons and Symbols,INCLUDE.INCLUDE.WRITE:/10 ICON_DATE AS ICON,SY-DATUM,SYM_LEFT_HAND AS SYMBOL.,Execute programs“SHOWICON”and“SHOWSYMB”to display the systems icons and symbols.,Maintaining Page Headers,The title comes from the pro
15、grams attributes.,List header will replace title on first line of standard header.,Up to four lines of column headings can be maintained for the list.,Numbered Texts(Text Symbols),Text symbols are referenced by a unique three-character code.,WRITE:/TEXT-001,BIRTHDAY,/TEXT-002,SY-DATUM.,C:Character T
16、ext,I:Integer,P:Packed#,F:Floating Point#,N:Numeric Text,D:Date,T:Time,X:Hexadecimal#,ABAP Elementary Data Types,DATA:PLAYER(35)TYPE C,NICKNAME(35),POINTSTYPE I,GAMESTYPE IVALUE 10,AVERAGE(5)TYPE P,STARTER,ACQUIREDTYPE D.,Declaring Variables,C:(blank),I:zero,P:zero,F:zeroes,N:zeroes,D:00000000,T:000
17、000,X:00,The“CLEAR”statement sets a field back to its initial value,not its default value.,Initial Values,DATA:PLAYER(35)TYPE C,NICKNAME(35)VALUE Dr.J,POINTSTYPE IVALUE 255,GAMESTYPE IVALUE 10,AVERAGE(5)TYPE PVALUE 25.5,STARTERVALUE Yes,ACQUIREDTYPE DVALUE 19760610.,Assigning Default Values,DATA:PLA
18、YER(35)TYPE CVALUE Julius Erving,NICKNAME(35),ACQUIREDTYPE D.,DATA:PLAYER(35)TYPE CVALUE Julius Erving,NICKNAMELIKE PLAYER,ACQUIREDLIKE SY-DATUM.,Use the“LIKE”addition to declare fields with the same format(i.e.,data type and length),Declaring“Like”Fields,CONSTANTS:TEAM1(20)TYPE CVALUE 76ers,TEAM2LI
19、KE TEAM1 VALUE Celtics,TOT_GAMESTYPE IVALUE 82.,If you attempt to change the value of a constant,a syntax error will occur.,The“VALUE”additionis required.,Declaring Constants,TYPES:NAME(35)TYPE C,TEAMS(20)TYPE C.DATA:PLAYERTYPE NAMEVALUE Troy Aikman,NICKNAMELIKE PLAYER.CONSTANTS:TEAM1TYPE TEAMSVALUE
20、 Cowboys,TEAM2LIKE TEAM1 VALUE Packers.,A user-defined data type created with the“TYPES”statement is used to specify a fields data type in the“TYPE”addition of the“DATA”or“CONSTANTS”statements.,User-Defined Data Types,Standard LengthC=defined lengthI=12P=(2*defined length)+1F=22N=defined lengthD=10T
21、=8X=(2*defined length),JustificationC=left-justifiedI=right-justifiedP=right-justifiedF=right-justifiedN=left-justifiedD=left-justifiedT=left-justifiedX=left-justified,Output Characteristic for Data Types,DATA:FLOAT TYPE FVALUE 98.7654321E2,PACKTYPE PVALUE 12,INTTYPE I VALUE 32.WRITE:/FLOAT,/FLOAT E
22、XPONENT 1 DECIMALS 3,/FLOAT EXPONENT 0 DECIMALS 2,/PACK,/PACK DECIMALS 1,/INT DECIMALS 2.,9.876543210000000E+03987.654E+019876.5412 12.0 32.00,These fields are not aligned because of the different standard output lengths of the numeric type fields.,Output for Numeric Fields,DATA:TITLE(25),SALARY TYP
23、E P,CNVSALARY LIKE SALARY,MOVE President TO TITLE.COMPUTE SALARY=5000000.CNVSALARY=SALARY*3.ADD 1000 TO SALARY.,MOVE TO.,COMPUTE=.,ADD TO.SUBTRACT FROM.MULTIPLY BY.DIVIDE BY.,Assigning Values to Fields,COUNTER=COUNTER+1.SALARY=BASE*BONUS_PERCENT.LENGTH=STRLEN(NAME).ANSWER=(10+SQRT(NUM1)/(NUM2-10).,S
24、pacing is very important when using arithmetic expressions!,FunctionsSQRT,EXP,LOG,SIN,COS,STRLEN,.,Operators+-*/*DIV and MOD,Arithmetic Expressions,90 xx 1996123456ABCD-06/01/1996,Use an offset and length to display or change portions of a field.,Sub-Fields in ABAP,You are 12410 days old.,Date field
25、s store values as“YYYYMMDD”.,Date Calculations in ABAP,PARAMETERS:NUM TYPE I,NAME(20)DEFAULT AARON.ADD 10 TO NUM.WRITE:/NUM,-,NAME.,32-AARON,“Selection Screen”,Declaring Fields with PARAMETERS,These selection texts will be used on the selection screen instead of the parameter names.,Selection Texts,
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- ABAP Programming

链接地址:https://www.31ppt.com/p-2205686.html