ABAP语法完整版
abap at语法
abap at语法ABAP(Advanced Business Application Programming)是一种在SAP系统中使用的专用编程语言,用于开发和定制企业应用程序。
下面是ABAP语法的一些常见特征:1. ABAP程序以关键词 "REPORT" 或者 "PROGRAM" 开始,并以句点(.)结尾。
例如:REPORT Z_MY_REPORT.或PROGRAM Z_MY_PROGRAM.2. ABAP程序由不同的块组成,包括 "DATA"、"TYPES"、"BEGIN OF"、"LOOP"、"SELECT"、"IF"、"CASE" 等。
例如:DATA: lv_variable TYPE i. "定义变量TYPES: BEGIN OF ty_structure. "定义结构INCLUDE TYPE standard table of sflight. "包含标准表END OF ty_structure.LOOP AT it_table INTO lv_variable. "遍历表...ENDLOOP.SELECT * FROM sflight INTO TABLE it_table. "从数据库中选择数据IF lv_variable > 10. "条件判断...ENDIF.CASE lv_variable. "多重条件判断WHEN 1....WHEN 2....OTHERWISE....ENDCASE.3. ABAP语句以关键词和句点结尾,如 "DATA"、"WRITE"、"IF"、"ENDIF"等。
ABAP基本语法学习关键语句的写法[精品]
ABAP基本语法学习关键语句的写法内表建立过程:1、声明一个结构体2、用声明好的结构体作为工作区,声明一个内表内表名称like standard table of 结构体名称,内表名称like sorted table of 结构体名称,内表名称like harshed table of 结构体名称。
后面可以用到with 选项来进行关键字的声明。
基本语法如下:DATA itab { {TYPE tabkind OF [REF TO] type}| {LIKE tabkind OF dobj} }[WITH key] [INITIAL SIZE n][WITH HEADER LINE][VALUE IS INITIAL][READ-ONLY].DATA rtab {TYPE RANGE OF type}|{LIKE RANGE OF dobj}[INITIAL SIZE n][WITH HEADER LINE][VALUE IS INITIAL][READ-ONLY].此语句可以定义一个范围表,在操作数据库时可以用来作为判断数据选择的条件描述。
3、向内表中插入数据,插入数据可以用insert数据into内表语句或者是append数据to内表语句。
可以插入整个内表到另一内表insert lines of 内表名称into table 另一内表名称。
亦可以进行累加插入:collect 数据into 内表名称。
相同的数据进行累积。
4、修改内表数据,利用modify 关键字,modify 内表名称from 数据(用结构体表示的数据)。
可以修改多行,modify 内表名称from 数据transporting 关键字where 条件。
5、读内表数据的几种操作方法:用Include来构造一个结构体INCLUDE { {TYPE struc_type} | {STRUCTURE struc} }[AS name [RENAMING WITH SUFFIX suffix]].TYPES: BEGIN OF t_day,work TYPE c LENGTH 8,free TYPE c LENGTH 16,END OF t_day.DATA BEGIN OF week.INCLUDE TYPE t_day AS monday RENAMING WITH SUFFIX _mon.INCLUDE TYPE t_day AS tuesday RENAMING WITH SUFFIX _tue.INCLUDE TYPE t_day AS wednesday RENAMING WITH SUFFIX _wed. DATA END OF week.可以用两种方式来访问结构体的内容:1、直接用结构体的名称来访问:week-monday-work, week-monday-free, week-tuesday-work2、用重新命名的后缀名字来访问:week-work_mon, week-free_mon, week-work_tue类对象的定义方式:CLASS class DEFINITION [class_options].[PUBLIC SECTION.[components]][PROTECTED SECTION.[components]][PRIVATE SECTION.[components]]ENDCLASS.类对象的实现方式:CLASS class IMPLEMENTATION....METHOD ......ENDMETHOD....ENDCLASS.类对象的继承:CLASS class DEFINITIONLOCAL FRIENDS class1 class2 ...intf1 intf2 ...CLASS class DEFINITION { {DEFERRED [PUBLIC]} | LOAD }.[PUBLIC][INHERITING FROM superclass][ABSTRACT][FINAL][CREATE {PUBLIC|PROTECTED|PRIVATE}][SHARED MEMORY ENABLED][FOR TESTING][[GLOBAL] FRIENDS class1 class2 ...intf1 intf2 ...].Deferred 关键字可以预先声明一个未被定义的类。
ABAP语法
ABAP语法一、格式。
作用:设置或更改有效的输出格式。
注意:由Format设置的格式会影响到清淡的下一个输出操作,下一个输出命令或下一个新行。
附加ON对于转换贴切的输出格式变得更随意。
你也能设置静态的附加ON,OFF和n(对于颜色)。
1、颜色。
Format Color n [ON] or Format Color n[OFF]作用:行背景颜色。
N能有如下的价值。
OFF or COL_BACKGROUND Background (GUI-specific)1 or COL_HEADING Headers (grayish blue)2 or COL_NORMAL List body (bright gray)3 or COL_TOTAL Totals (yellow)4 or COL_KEY Key columns (bluish green)5 or COL_POSITIVE Positive threshold value (green)6 or COL_NEGATIVE Negative threshold value (red)7 or COL_GROUP Control levels (violet)清单颜色注意:每次一个新的事件(START-OF-SELECTION, TOP-OF-PAGE, ...)开始,这个系统的设置回复到COLOR 0。
附加.. INTENSIFIED和... INVERSE影响颜色的显示属性...COLOR对于线不起作用。
WRITE --- OUTPUT AS lineInclude<Line>(或更多广泛的Include<List>)对于行包含关系识别作为永恒,例如:LINE_TOP_LEFT_CORNER, LINE_BOTTOM_MIDDLE_CORNER。
Line不能有其他的显示属性。
如果像颜色(COLOR),背面VIDEO(INVERSE)或变强(INTENSIFIED)被设置,这些忽略输出。
abap find语法
abap find语法
ABAP 的 FIND 语法用于在字符串中查找子字符串,并返回子字
符串的位置。
以下是使用中文编写的 FIND 语法的示例:
FIND 子字符串 IN 目标字符串.
在上述语句中,"子字符串"是要查找的字符串,"目标字符串"是
要在其中进行查找的字符串。
如果找到了子字符串,则系统返回子字
符串在目标字符串中的位置。
示例代码:
DATA: 目标字符串 TYPE STRING,
子字符串 TYPE STRING,
位置 TYPE I.
目标字符串 = 'ABAP 是一种编程语言,用于开发企业级应用程序。
'.
子字符串 = '编程语言'.
FIND 子字符串 IN 目标字符串.
IF sy-subrc = 0.
位置 = sy-fdpos.
WRITE: '子字符串在目标字符串中的位置:', 位置.
ELSE.
WRITE: '未找到子字符串'.
ENDIF.
上述代码中,我们定义了一个目标字符串和一个子字符串,并使
用 FIND 语句在目标字符串中查找子字符串。
如果找到了子字符串,
则将子字符串在目标字符串中的位置存储在位置变量中,并输出结果。
如果没有找到子字符串,则输出 "未找到子字符串"。
这是一个简单的使用 ABAP 的 FIND 语法在字符串中查找子字符
串的示例。
在实际应用中,您可以根据具体需求进行相应的调整和扩展。
ABAP4语法
©2008 HAND Enterprise Solutions Co., Ltd. Confidential Not For Public.
9 COLLECT LINE
COLLECT 指令也是将元素加入 指令也是将元素加入Internal table中,与APPEND 的区别是 COLLECT指令在非数值 的区别是: 中与 指令在非数值 字段相同的情况下,将数值字段汇总 字段相同的情况下 将数值字段汇总. 将数值字段汇总 格式: 格式 COLLECT [<work area> INTO ] <itab>
DATA: BEGIN OF ITAB OCCURS 3, COL1(3) TYPE C, COL2 TYPE I, END OF ITAB. ITAB-COL1 = ‘ABC’. ITAB-COL2 = 10. COLLECT ITAB. ITAB-COL1 = ‘XYZ’. ITAB-COL2 = 20. COLLECT ITAB. ITAB-COL1 = ‘ABC’. ITAB-COL2 = 80. COLLECT ITAB. 此时, 中放的是2笔数据 此时 internal table中放的是 笔数据 分别为 中放的是 笔数据, 分别为: ITAB-COL1 ITAB-COL2 ‘ABC’ 90 ‘XYZ’ 20
©2008 HAND Enterprise Solutions Co., Ltd. Confidential Not For Public.
5
3 .系统专用变量说明 系统专用变量说明
1 SY-SUBRC : 系统执行某指令后 表示执行成功与否的变量 表示成 系统执行某指令后,表示执行成功与否的变量 表示执行成功与否的变量,’0’
SY-TCODE: 当前执行程序的T_ code 当前执行程序的
abap基本语法汇总
一数据类型和对象在ABAP中,可以使用与标准数据声明相似的语法处理数据类型,而与数据对象无关。
在程序中必须声明要使用的全部数据对象。
声明过程中,必须给数据对象分配属性,其中最重要的属性就是数据类型。
对算术运算的非整型结果(如分数)进行四舍五入,而不是截断。
类型 P 数据允许在小数点后有数字。
有效大小可以是从 1 到 16 字节的任何值。
将两个十进制数字压缩到一个字节,而最后一个字节包含一个数字和符号。
在小数点后最多允许 14 个数字。
1.3 确定数据对象的属性如果要查明数据对象的数据类型,或者要在程序的运行期间使用其属性,可使用DESCRI BE 语句。
语法如下:DESCRI BE FIELD<f> [LENGTH <l>] [TYPE <t> [COMPON ENTS<n>]][OUTPUT-LENGTH <o>] [DECIMA LS <d>][EDIT MASK <m>].将由语句的参数指定的数据对象<f>的属性写入参数后的变量。
DESCRI1.3.1 确定字段长度要确定数据对象的长度,利用DESCRIBEFIELD语句使用 LENGTH参数,如下所示:DESCRI BE FIELD<f> LENGTH <l>.系统读取字段<f>的长度,并将值写入字段<l>。
1.3.2确定数据类型要确定字段的数据类型,利用DESCRIBEFIELD语句使用 TYPE 参数,如下所示:DESCRI BE FIELD<f> TYPE <t> [COMPON ENTS<n>].系统读取字段<f>的数据类型,然后将值写入字段<t>。
abap 语法手册
abap 语法手册ABAP语法手册ABAP(Advanced Business Application Programming)是一种用于SAP软件开发的编程语言。
这份手册将介绍ABAP语言的基本语法和常用用法,为开发人员提供一个参考指南。
1. 数据类型和变量声明:ABAP支持多种数据类型,例如整数(INT),浮点数(FLOAT),字符串(STRING)和日期(DATE)。
变量声明可以通过关键字DATA进行,例如:DATA: my_integer TYPE i.DATA: my_string TYPE string.2. 控制结构:ABAP支持常见的控制结构,如条件语句(IF...ELSE...ENDIF)和循环语句(DO...ENDDO,WHILE...ENDWHILE)。
例如:IF my_integer > 10.WRITE: 'The value is greater than 10'.ELSE.WRITE: 'The value is less than or equal to 10'.ENDIF.3. 函数和方法:ABAP允许定义函数和方法来实现特定的功能。
函数可以通过关键字FUNCTION和ENDFUNCTION来定义,而方法可以通过关键字METHOD和ENDMETHOD来定义。
例如:FUNCTION my_function.WRITE: 'Hello, world!'.ENDFUNCTION.4. 数据表和内表:ABAP中的数据表可以通过关键字DATA和TABLE来声明,内表可以通过关键字INTERNAL TABLE和TYPES来声明。
例如:DATA: my_table TYPE TABLE OF my_structure.DATA: my_internal_table TYPE TABLE OF my_structure.5. 数据访问:ABAP提供了方便的数据访问方法,例如通过SELECT语句从数据库中检索数据,或者通过READ TABLE语句从内表中检索数据。
ABAP基本语法
ABAP基本语法目录1.表声明12.定义变量13.常用算术操作符:14.常用比较操作:15.赋值语句26.IF语句27.CASE语句28.DO语句29.WHILE语句210.从数据库中取数据集211.取出单行记录212.WRITE语句213.ULINE语句314.SKIP语句315.定义常量316.定义结构317.TYPES语句418.LIKE语句419.输入参数520.分块语句521.定义内表522.往内表中添加记录623.用LOOP读取内表数据624.用READ读取内表数据625.把数据库的记录读入内表626.CLEAR清空表头和表记录627.DELETE删除内表记录628.REFRESH删除内表记录629.FREE删除内表记录730.在内表中插入记录731.修改内表记录732.对内表进行排序733.内表的控制语句734.循环跳转语句735.常用系统变量836.子程序的定义837.子程序的调用838.子程序的参数传递839.常用事件840.跳出事件的方法9ABAP/4:Advanced Business Application Programming1.表声明Tables: 表名[,表名]. 声明多个表时可用逗号分隔当你声明了一个数据表的同时,系统也同时自动生成了一个和数据表同名的结构,结构的变量集等于数据表里面的字段。
2.定义变量Data: v1[(l)] [type t] [decimals d] [value 'xxx'].v1 是变量名。
(l) 是变量的长度。
t 是数据类型。
d 是小数位。
'xxx'是缺省值。
如:data num(10) type p decimals 3 value '1.12'.3.常用算术操作符:5.赋值语句total = 10.mess = 'this is a test!'.如果字符串中包括 ' 号,用 '' 进行付值,如:mess = 'this is a ''test''! '.6.IF语句if i = 2.write 'i 等于 2'.[else.write 'i 不等于 2'.]endif.7.CASE语句case i. 类似于VFP中的DO CASE语句when 1. write 'i = 1'.when 2. write 'i = 2'.[when others. write 'i <> 1 and i <> 2'.]endcase.8.DO语句do [n] times. 类似于VFP中的FOR语句[执行代码]enddo.9.WHILE语句while [条件]. 类似于VFP中的DO WHILE语句[执行语句]endwhile.10.从数据库中取数据集select * from 数据表 [where 条件].[操作语句]endselect.如:select * from t000 [where mandt < 200].write: / t000-mandt,t000-mtext.endselect.11.取出单行记录select single * from 数据表 [where 条件]. 注:仅取出符合条件的第一行记录select single 字段 from 数据表 into 变量 [where 条件].12.WRITE语句write: [/][定位][数据1][,[定位] [数据2]]……[/] 为插入一行空行,注意单独write一个[/]和在其它数据之前加 [/] 的效果是不一样的,单独的write[/]在插入空行后光标定位在空行的下面,在其它数据前加[/]在插入空行后光标定位于所插的空行。
ABAP 语法
Line-size 130Line-count 60NO STANDARD PAGE HEADING.Under 格式化输出Write: /wa-carrid under ‘航线承运人’。
WRITE AT (10)8 STR1 替换字符串data:str1(10) type c value 'AABBCCDDEE'. WRITE:'11223344556677____________889900.'. WRITE AT 15(8) STR1.输出'11223344556677AABBCCDD____889900创建表SE11OR ME55Se16CreateSelect * into table intab from spfli package size 5. 每次输入5行LSKEY00Client 不同,登陆获得的数据不同单栏位检索&单选框SELECTION-SCREEN <option>Parameters: <p> [default<d>默认值][lower case大小写][obligatory必输][as checkbox以复选框形式] [radiobutton group<RG>以单选框形式]at SELECTION-SCREEN ON VALUE-REQUEST FOR <P>. F4help.Parameters: a type P DECIMALS 2.范围检索Select-options: <P> for <wa>.Manual barStandard bar:command fieldTitle barApplication barStatus bar现在SAP SE80里创建一个package:Z14PACKAGE创建新的program:Z4XXXXXXText Elements:设置head listUnline /10(60)从左到右第11起画长度为60的线Write: 变量 X(Y),变量去掉X位取Y位Field-symbols(?)类似指针CHECK在循环中,是在整个循环中。
ABAP语句整理
ABAP语句整理ADD:ADD v1 FROM v2 TO v3 GIVING v4ADD v1 THEN v2 UNTIL v3 GIVING mADD v1 THEN v2 UNTIL v3 TO mADD v1 THEN v2 UNTIL v3ADD v1 TO v2ADD-CORRESPONDING rec1 TO rec2APPEND:APPEND tablaAPPEND area1 TO tabla2APPEND INITIAL LINE TO tabla1APPEND tabla SORTED BY v3APPEND area1 TO tabla2 SORTED BY v3APPEND LINES OF tabla1 TO tabla 2APPEND LINES OF tabla1 FROM ix1 TO tabla2APPEND LINES OF tabla1 FROM ix1 TO ix2 TO tabla2ASSIGN:ASSIGN v1 TO DECIMALS dec TYPE tipoASSIGN f+off(len) TO DECIMALS dec TYPE tipoASSIGN (f) TO TYPE tipo DECIMALS decASSIGN +off(len) TO DECIMALS dec TYPE tipoASSIGN TABLE FIELD v1 TOASSIGN TABLE FIELD (f) TOASSIGN COMPONENT n OF STRUCTURE rec TO DECIMALS dec TYPE tipo ASSIGN COMPONENT name OF STRUCTURE rec TO DECIMALS dec TYPE tipo ASSIGN LOCAL COPY OF v1 TO ASSIGN LOCAL COPY OF MAIN TABLE FIELD (f) TOASSIGN LOCAL COPY OF INITAL LINE tabla TO*--------------------------------------------------------------------------AT:AT END OF v1AT NEW v1AT FIRSTAT LASTAT fg WITH fg1AT LINE-SELECTIONAT USER-COMMANDAT PFxAT SELECTION-SCREENON ps1ON END OF s1ON VALUE-REQUEST FOR ps1ON HELP-REQUEST FOR ps1ON RADIOBUTTON GROUP radi1ON BLOCK blk1OUTPUT*-------------------------------------------------------------------------- AUTHORITY-CHECK:AUTHORITY-CHECK OBJECT object ID name1 FIELD f1*-------------------------------------------------------------------------- BACK:BACK*-------------------------------------------------------------------------- BREAK-POINT:BREAK-POINT lit1*-------------------------------------------------------------------------- CALL:CALL FUNCTION {AutoInsertFunctionCall}CALL FUNCTION fnc1EXPORTING p1 = v1IMPORTING p1 = v1TABLES p1 = tabla1CHANGING p1 = v1EXCEPTIONS exc1 = retc1CALL FUNCTION fnc1 STARTING NEW TASK tskname2 DESTINATION dest1DESTINATION IN GROUP grp1DESTINATION IN GROUP DEFAULT PERFORMING form1 ON END OF TASK EXPORTING p1 = v1TABLES p1 = tabla1EXCEPTIONS exc1 = retc2 MESSAGE msg2CALL FUNCTION fnc1 IN UPDATE TASK EXPORTING p1 = v1TABLES p1 = tabla1CALL FUNCTION fnc1 DESTINATION dest1 EXPORTING p1 = v1IMPORTING p1 = v1TABLES p1 = tabla1CHANGING p1 = v1EXCEPTIONS exc1 = retc2EXCEPTIONS exc1 = retc2 MESSAGE messCALL FUNCTION fnc1 IN BACKGROUND TASKAS SEPARATE UNITDESTINATION desti1EXPORTING p1 = v1TABLES p1 = tabla1CALL CUSTOMER-FUNCTION fnc1 EXPORTING p1 = v2 IMPORTING p1 = v2TABLES p1 = tabla1 CHANGING p1 = v2 EXCEPTIONS exc2 = retc1CALL SCREEN scr1STARTING AT x1 y1ENDING AT x2 y2CALL TRANSACTION tran1AND SKIP FIRST SCREEN USING tabla1MODE m1UPDATE upd1MESSAGES INTO msg1CALL DIALOG dlog1USING tablaMODE mode1AND SKIP FIRST SCREEN EXPORTING v1 FROM v2 IMPORTING v1 TO v2CALL METHOD met1 ( EXPORTING p1 = v1 IMPORTING p1 = v1 CHANGING p1 = v1 )CALL METHOD met1 EXPORTING p1 = v1 IMPORTING p1 = v1 CHANGING p1 = v1 RECEIVING p1 = v1EXCEPTIONS ex = idxCALL cfunc1ID id1 FIELD v1 ... ID id1 FIELD v2*-------------------------------------------------------------------------- CASE:CASE v1WHEN bed1stm1WHEN bed2stm2WHEN bedxWHEN OTHERSstm3ENDCASE*-------------------------------------------------------------------------- CHECK:CHECK SELECT-OPTIONSCHECK logexp1CHECK s1*-------------------------------------------------------------------------- CLEAR:CLEAR v1WITH lit1WITH NULLCLOSE:CLOSE CURSOR curs1CLOSE DATASET dsn1COLLECT:COLLECT tabla1COLLECT wrk1 INTO tabla2*-------------------------------------------------------------------------- COMMIT:COMMIT WORKAND WAIT*-------------------------------------------------------------------------- COMMUNICATION:COMMUNICATION INIT DESTINATION desti1 ID ident1 COMMUNICATION ALLOCATE ID iden1COMMUNICATION ACCEPT ID ident1COMMUNICATION SEND ID ident 1 BUFFER b1COMMUNICATION RECEIVE ID ident1BUFFER b1DATAINFO datn1STATUSINFO stat1COMMUNICATION DEALLOCATE ID ident1*-------------------------------------------------------------------------- CONCATENATE:CONCATENATE v1 v2 ... vx INTO f2SEPARATED BY f3*-------------------------------------------------------------------------- COMPUTE:COMPUTE v1 = arithexp*-------------------------------------------------------------------------- CONDENSE:CONDENSE r1NO-GAPSCONDENSE v1*-------------------------------------------------------------------------- CONSTANTS:CONSTANTS con1 ... VALUE valu1CONSTANTS con1 ... VALUE IS INITIALCONSTANTS con1(len2) ... VALUE valu1CONSTANTS con1(len2) ... VALUE IS INITIALCONSTANTS: BEGIN OF conr1,CONSTANTS: END OF conr1*--------------------------------------------------------------------------CONTINUE:CONTINUECONTROLS:CONTROLS contrl TYPE TABLEVIEW USING SCREEN*-------------------------------------------------------------------------- CONVERT:CONVERT DATE v1 INTO INVERTED-DATE v2CONVERT INVERTED-DATE v1 INTO DATE v2CONVERT TEXT text1 INTO SORTABLE CODE cod2*-------------------------------------------------------------------------- CREATE:CREATE OBJECT obj1 class2LANGUAGE lang1*--------------------------------------------------------------------------DATA:DATA: BEGIN OF tabla1INCLUDE STRUCTURE struc1DATA: END OF tabla1DATA: BEGIN OF COMMON PART cp1DATA: END OF COMMON PARTDATA: BEGIN OF tabla1 OCCURS n2VALID BETWEEN v1 AND v2DATA: END OF tabla1DATA: BEGIN OF rec1DATA: END OF rec1DATA: v1TYPE typ1LIKE v1TYPE typ1 OCCURS n2LIKE v1 OCCURS n2TYPE LINE OF ityp1LIKE LINE OF tabla1VALUE lit1DECIMALS n1WITH HEADER LINEDATA: v1(len1)TYPE tipoTYPE typ1 OCCURS n2TYPE LINE OF ityp1VALUE lit1DECIMALS n1WITH HEADER LINE*-------------------------------------------------------------------------- DEFINE:DEFINE name1stm1stm2END-OF-DEFINITION*-------------------------------------------------------------------------- DELETE:DELETE tabla1DELETE tabla1 INDEX ix2DELETE tabla1 FROM ix2 TO ix3DELETE tabla1 WHERE cond2FROM ix1TO ix2DELETE ADJACENT DUPLICATES FROM tabla1COMPARING v1 v2 ...COMPARING ALL FIELDSDELETE etab1DELETE *etab1DELETE FROM etab1 WHERE cond2CLIENT SPECIFIEDDELETE FROM (name_etab1) WHERE cond2CLIENT SPECIFIEDDELETE (name_etab1)FROM area1CLIENT SPECIFIEDDELETE etab FROM TABLE tabla2DELETE (name_etab1) FROM TABLE tablaCLIENT SPECIFIEDDELETE etab1 VERSION ver2DELETE *etab1 VERSION ver2DELETE DATASET name1DELETE FROM DATABASE etab1(ar) ID key2CLIENT v1DELETE REPORT name1DELETE TEXTPOOL name1 LANGUAGE lan2DELETE DYNPRO v1DELETE FROM SHARED BUFFER etab1(ar) ... ID*-------------------------------------------------------------------------- DESCRIBE:DESCRIBE DISTANCE BETWEEN v1 AND v2 INTO v2DESCRIBE FIELD v1DECIMALS n1EDIT MASK msk1LENGTH n1OUTPUT-LENGTH n1TYPE t1 COMPONENTS n2TYPE t1DESCRIBE LISTNUMBER OF LINES ln1INDEX ix1NUMBER OF PAGES n1INDEX ix1LINE lin PAGE pn1INDEX ix1DESCRIBE LIST PAGE pag1INDEX ix1LINE-SIZE col1LINE-COUNT lin1LINES lin1FIRST-LINE lin1TOP-LINES lin1TITLE-LINES lin1HEAD-LINES lin1END-LINES lin1DESCRIBE TABLE tabla1LINES n1OCCURS n1*-------------------------------------------------------------------------- DETAIL:DETAILDIVIDE:DIVIDE v1 BY v2DIVIDE-CORRESPONDING r1 BY r2*-------------------------------------------------------------------------- DO:DODO v1 TIMESDO n1 TIMESVARYING v1 FROM v2 NEXT v3DO n1 TIMESVARYING v1 FROM v2 NEXT v3ENDDODO 254 TIMES.MOVE '#' TO SY-ULINE+SY-INDEX(1).ENDDO*-------------------------------------------------------------------------- EDITOR-CALL:EDITOR-CALL FOR tablaTITLE textDISPLAY-MODEEDITOR-CALL FOR REPORT nameDISPLAY-MODE*-------------------------------------------------------------------------- ELSE:ELSEELSEIF logop1*-------------------------------------------------------------------------- END:END-OF-DEFINITIONEND-OF-PAGEEND-OF-SELECTIONENDATENDCASEENDDOENDEXECENDFORMENDFUNCTIONENDIFENDLOOPENDMODULEENDONENDPROVIDEENDSELECTENDWHILEEXEC SQL:EXEC SQLPERFORMING formENDEXEC*-------------------------------------------------------------------------- EXIT:EXITEXIT FROM SQLEXIT FROM STEP-LOOP*-------------------------------------------------------------------------- EXPORT:EXPORT objn1 ... objn2 TO MEMORYFROM v1 ...ID key1EXPORT objn1 ... objn2 TO DATABASE etab3(ar4) ID key5FROM v1CLIENT c1USING form_nameEXPORT obj1 ... objn2 TO DATASET dsn3(ar4) ID key5EXPORT obj1 ... objn2 TO SHARED BUFFER etab3(ar4) ID key5 FROM v1 ...CLIENT c1EXPORT DYNPRO head1 fields2 order3 match4 ID id4 EXPORT NAMETAB h f ID idEXTRACT:EXTRACT r1FETCH:FETCH NEXT CURSOR c1 INTO work2FIELD-GROUPS:FIELD-GROUPS: fgr1, fgr2 ...FIELD-SYMBOLS:FIELD-SYMBOLSSTRUCTURE stru1 DEFAULT work2TYPE typ1TYPE LINE OF typ1LIKE s1LIKE LINE OF s1FIELDS:FIELDS v1FORM:FORM pp1USING p2 p3 ...ENDFORM.FORM form_name1USING p1 p2 ...USING VALUE(p1) VALUE(p2) ... CHANGING p1 p2 ... CHANGING VALUE(p1) VALUE(p2) ... TABLES tabla1 tabla2 ... STRUCTURE name1FORMAT:FORMATCOLOR n1INTENSIFIEDINVERSEHOTSPOTINPUTRESETFREE:FREE v1FREE MEMORYID key1FREE OBJECT objname1FREE tabla1FROM:FROM etab1CLIENT SPECIFIEDBYPASSING BUFFERUP TO n ROWSFROM (etab_name1) FUNCTION:FUNCTION name1 ENDFUNCTIONFUNCTION-POOLMESSAGE-ID id1GENERATE:GENERATE REPORT progMESSAGE v1INCLUDE v1LINE v1WORD v1OFFSET v1TRACE-FILE v1DIRECTORY ENTRY v1WITHOUT SELECTION-SCREENGENERATE SUBROUTINE POOL tabla1 NAME name2 MESSAGE v1INCLUDE v2LINE v3WORD v4OFFSET v5TRACE-FILE v6GENERATE DYNPRO head1 fields2 order3 match4 ID id4 OFFSET v1TRACE-FILE v1GET:GET etab1LATEFIELDS v1 ...GET CURSOR FIELD fOFFSET v1LINE v1VALUE v1LENGTH v1GET CURSOR LINE linOFFSET v1VALUE v1LENGTH v1GET TIMEGET RUN TIMEGET RUN TIME FIELD v1GET PARAMETER ID key1 FIELD v1 GET PROPERTY OF name1 attrib2 = v3 NO FLUSHGROUP-BY:GROUP BY v1 v2 ...GROUP BY (tabla1)HIDE:HIDE lin_v1IF:IF v1 EQ v2stm1ELSEstm2ENDIFIF v1 EQ v2IF v1 LT v2IF v1 GT v2IF v1 IS INITIALIF v1 IS REQUESTEDIF v1 logexp1IF v1 logexp2IF exp1 AND exp2 ...IF exp1 OR exp2 ...IF exp1 NOT exp2 ...IF v1 CA v2IF v1 NA v2IF v1 CO v2IF v1 CN v2IF v1 CP v2IF v1 NP v2IF v1 CS v2IF v1 NS v2IF v1 MIF v1 OIF v1 ZIMPORT:IMPORT v1 tabla2 ... FROM DATABASE etab3(ar4) ID key5TO v6 ...MAJOR-ID maj1 ...MAJOR-ID maj1 MINOR-ID min2CLIENT hUSING form_name1IMPORT DIRECTORY INTO tabla1 FROM DATABASE etab2(ar3) ID key4 CLIENT cl1IMPORT v1 tabla2 ... FROM LOGFILE ID key3TO v4IMPORT DYNPRO head1 tabla2 logik3 matchc4 ID id5IMPORT v1 tabla2 ... FROM MEMORYTO v3 ...ID keyIMPORT v1 tabla2 ... FROM SHARED BUFFER etab3(ar4) ID key5TO v6CLIENT cl6INCLUDE:INCLUDE STRUCTURE rec1 INCLUDE TYPE typename1 INCLUDE pname1 INFOTYPES:INFOTYPES: n1NAME v1OCCURS n1MODE m1VALID FROM begdt1 TO enddt2 INITIALIZATION: INITIALIZATIONINPUTINSERT etab1CLIENT SPECIFIEDINSERT etab1 FROM work2 INSERT etab1 FROM TABLE tabla1 ACCEPTING DUPLICATE KEYS INSERT INTO etab1CLIENT SPECIFIEDVALUES wb2INSERT (etab)CLIENT SPECIFIEDINSERT (etab) FROM work2 INSERT (etab) FROM TABLE tabla1 ACCEPTING DUPLICATE KEYS INSERT INTO (etab1)CLIENT SPECIFIEDVALUES wb2INSERT tabla1INSERT tabla1 INDEX ix2INSERT work1 INTO tabla2INSERT work1 INTO tabla2 INDEX ix3INSERT INITIAL LINE INTO tabla2INSERT LINES OF tabla1 INTO tabla2INSERT LINES OF tabla1 FROM ix1 INTO tabla2INSERT LINES OF tabla1 FROM ix1 TO ix2 INTO tabla2INSERT LINES OF tabla1 FROM ix1 TO ix2 INTO tabla2 INDEX ix3 INSERT REPORT name FROM tablaINSERT TEXTPOOL name FROM tabla LANGUAGE l1INSERT Field groupsINSERT v1 v2 ... INTO fgroup3INTO:INTO area1INTO CORRESPONDING FIELDS OF area1INTO (v1, v2, ...)INTO TABLE tabla1PACKAGE SIZE n1INTO CORRESPONDING FIELDS OF TABLE tabla1PACKAGE SIZE n1APPENDING TABLE tabla1PACKAGE SIZE n1APPENDING CORRESPONDING FIELDS OF TABLE tabla1PACKAGE SIZE n1LEAVELEAVE PROGRAMLEAVE TO TRANSACTION tac1AND SKIP FIRST SCREENLEAVE TO SCREEN dynp1LEAVE SCREENLEAVE TO LIST-PROCESSINGAND RETURN TO SCREEN dynp1LEAVE LIST-PROCESSINGLOAD:LOAD REPORT pnam1 PART 'HEAD' INTO tabla2 LOAD REPORT pnam1 PART 'TRIG' INTO tabla2LOAD REPORT pnam1 PART 'CONT' INTO tabla2 LOAD REPORT pnam1 PART 'DATA' INTO tabla2LOAD REPORT pnam1 PART 'DDNM' INTO tabla2 LOAD REPORT pnam1 PART 'DATV' INTO tabla2 LOAD REPORT pnam1 PART 'SELC' INTO tabla2LOAD REPORT pnam1 PART 'STOR' INTO tabla2 LOAD REPORT pnam1 PART 'LITL' INTO tabla2LOAD REPORT pnam1 PART 'SYMB' INTO tabla2 LOAD REPORT pnam1 PART 'LREF' INTO tabla2LOAD REPORT pnam1 PART 'SSCR' INTO tabla2LOAD REPORT pnam1 PART 'BASE' INTO tabla2LOAD REPORT pnam1 PART 'INIT' INTO tabla2LOAD REPORT pnam1 PART 'DATP' INTO tabla2LOAD REPORT pnam1 PART 'TXID' INTO tabla2LOAD REPORT pnam1 PART 'COMP' INTO tabla2LOCAL:LOCAL v1LOOP:LOOP AT tabla1WRITE: /1 tabla1-f1ENDLOOPLOOP AT tablaFROM n1TO n2WHERE logexp1TRANSPORTING NO FIELDSLOOP AT tabla INTO waFROM n1TO n2WHERE logexp1TRANSPORTING NO FIELDSLOOP AT SCREENMESSAGE:MESSAGE msgnr1WITH v1 v2 ...RAISING exc1MESSAGE ID id1 TYPE mtyp2 NUMBER mnr3 WITH v1 v2 ...MODIFY:MODIFY etabMODIFY *etabMODIFY (etab_name1)FROM area1CLIENT SPECIFIEDMODIFY etab1 FROM TABLEMODIFY etab1 FROM TABLE tabla2 MODIFY (etab-name1) FROM TABLE tabla2 CLIENT SPECIFIEDMODIFY tabla1INDEX ix3TRANSPORTING v4 v5 ...WHERE logexp6MODIFY tabla1 FROM wk2MODIFY LINE n1INDEX ix1LINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY LINE n1 OF CURRENT PAGELINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY LINE n1 OF PAGE m2LINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY CURRENT LINELINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY SCREENMODULE:MODULE mname1stm1ENDMODULEMODULE mname1OUTPUTINPUTMOVE:MOVE v1 TO v2MOVE v1+off1(len1) TO v2+off2(len2) MOVE v1 TO v2 PERCENTAGE v3RIGHTLEFTRIGHTMOVE-CORRESPONDING rec1 TO rec2 MULTIPLY:MULTIPLY v1 BY v2MULTIPLY-CORRESPONDING r1 BY r2 NEW-LINE:NEW-LINENO-SCROLLINGSCROLLINGNEW-PAGE:NEW-PAGE PRINT ONARCHIVE MODE armodeARCHIVE PARAMETERS arparams ARCHIVE PARAMETERS arparams COPIES n1COVER TEXT litDATASET EXPIRATION days DEPARTMENT name1 DESTINATION dest1 IMMEDIATELY flagKEEP IN SPOOL flagLAYOUT layer1LINE-COUNT l1LINE-SIZE c1LIST AUTHORITY auth1LIST DATASET dsnameLIST NAME nameNEW LIST IDENTIFICATION flag NEW-SECTIONNEW-SECTIONNO DIALOGNO DIALOG PARAMETERS para1 RECEIVER r1SAP COVER PAGE m1 NEW-PAGELINE-COUNT lin1 LINE-SIZE c1NO-HEADINGNO-TITLEWITH-HEADING WITH-TITLEPRINT ON ...PRINT OFFON:ON CHANGE OF v1 stm1ENDONON CHANGE OF v1 OR v1 ...OPEN DATASET: OPEN DATASET name1 AT POSITION pos1 FILTER bsFOR APPENDING FOR INPUTFOR OUTPUTIN BINARY MODEIN TEXT MODE MESSAGE msg1TYPE t1OPEN CURSOR:OPEN CURSOR c1 FOR SELECT WITH HOLDORDER-BY:ORDER BY PRIMARY KEY ORDER BY v1 v2 ...ORDER BY (tabla) OVERLAY:OVERLAY v1 WITH v2ONLY v3PACK:PACK v1 TO v2 PARAMETERS: PARAMETERS p1AS CHECKBOXDEFAULT valueFOR TABLE etab1LIKE v1LOWER CASE MATCHCODE OBJECT objname1 MEMORY ID mid1MODIF ID key1NO-DISPLAY OBLIGATORYTYPE typ1DECIMALS n1 RADIOBUTTON GROUP radbut1 FOR TABLE etab1AS MATCHCODE STRUCTUREVALUE-REQUESTHELP-REQUESTPERFORM:PERFORM form IN PROGRAM prog CHANGING p1 p2 p3 ...IF FOUNDTABLES tabla1 tabla2 ...。
abap 面向对象 语法
abap 面向对象语法ABAP(Advanced Business Application Programming)是一种面向对象的编程语言,是SAP系统中最常用的编程语言之一。
ABAP面向对象(OO ABAP)是ABAP的一种编程范式,它基于面向对象的编程思想,在开发SAP应用程序时提供了更高的灵活性和可维护性。
ABAP面向对象语法包括类、对象、方法、接口和继承等基本概念,下面将逐一介绍。
首先是类(Class),类是对象的蓝图,它定义了对象的属性和行为。
在ABAP中,类由关键字“CLASS”定义,后面跟着类名和可选的继承关系。
类中定义了各种属性和方法,用于描述对象的特征和功能。
接下来是对象(Object),对象是类的实例化结果,它具有类所定义的属性和行为。
在ABAP中,可以使用关键字“CREATE OBJECT”来创建对象,并为对象的属性赋值。
通过对象,我们可以访问和操作类中定义的方法和属性。
方法(Method)是类中定义的一段可执行代码,用于实现类的行为。
在ABAP中,方法由关键字“METHODS”定义,后面跟着方法名和可选的参数列表。
通过调用方法,我们可以实现对对象的操作和控制。
接口(Interface)是一种规范,它定义了对象应该具有的方法和属性。
在ABAP中,接口由关键字“INTERFACE”定义,后面跟着接口名和可选的方法列表。
一个类可以实现一个或多个接口,从而继承接口中定义的方法和属性。
继承(Inheritance)是一种机制,它允许一个类继承另一个类的属性和行为。
在ABAP中,可以使用关键字“INHERITING FROM”来实现继承关系。
子类(派生类)可以继承父类(基类)的方法和属性,并可以在此基础上进行扩展和修改。
除了上述基本概念外,ABAP面向对象还提供了其他一些特性,如封装、多态和事件等。
封装(Encapsulation)是一种将数据和方法组合在一起的机制,用于保护数据的安全性和完整性。
ABAP语句整理
ADD:ADD v1 FROM v2 TO v3 GIVING v4ADD v1 THEN v2 UNTIL v3 GIVING mADD v1 THEN v2 UNTIL v3 TO mADD v1 THEN v2 UNTIL v3ADD v1 TO v2ADD-CORRESPONDING rec1 TO rec2APPEND:APPEND tablaAPPEND area1 TO tabla2APPEND INITIAL LINE TO tabla1APPEND tabla SORTED BY v3APPEND area1 TO tabla2 SORTED BY v3APPEND LINES OF tabla1 TO tabla 2APPEND LINES OF tabla1 FROM ix1 TO tabla2APPEND LINES OF tabla1 FROM ix1 TO ix2 TO tabla2ASSIGN:ASSIGN v1 TO <fs1> DECIMALS dec TYPE tipoASSIGN f+off(len) TO <fs> DECIMALS dec TYPE tipoASSIGN (f) TO <fs> TYPE tipo DECIMALS decASSIGN <fs1>+off(len) TO <fs2> DECIMALS dec TYPE tipoASSIGN TABLE FIELD v1 TO <fs>ASSIGN TABLE FIELD (f) TO <fs>ASSIGN COMPONENT n OF STRUCTURE rec TO <fs> DECIMALS dec TYPE tipo ASSIGN COMPONENT name OF STRUCTURE rec TO <fs> DECIMALS dec TYPE tipo ASSIGN LOCAL COPY OF v1 TO <f>ASSIGN LOCAL COPY OF MAIN TABLE FIELD (f) TO <f>ASSIGN LOCAL COPY OF INITAL LINE tabla TO <f>*--------------------------------------------------------------------------AT:AT END OF v1AT NEW v1AT FIRSTAT LASTAT fg WITH fg1AT LINE-SELECTIONAT USER-COMMANDAT PFxAT SELECTION-SCREENON ps1ON END OF s1ON VALUE-REQUEST FOR ps1ON HELP-REQUEST FOR ps1ON RADIOBUTTON GROUP radi1ON BLOCK blk1OUTPUT*-------------------------------------------------------------------------- AUTHORITY-CHECK:AUTHORITY-CHECK OBJECT object ID name1 FIELD f1*-------------------------------------------------------------------------- BACK:BACK*-------------------------------------------------------------------------- BREAK-POINT:BREAK-POINT lit1*-------------------------------------------------------------------------- CALL:CALL FUNCTION {AutoInsertFunctionCall}CALL FUNCTION fnc1EXPORTING p1 = v1IMPORTING p1 = v1TABLES p1 = tabla1CHANGING p1 = v1EXCEPTIONS exc1 = retc1CALL FUNCTION fnc1 STARTING NEW TASK tskname2DESTINATION dest1DESTINATION IN GROUP grp1DESTINATION IN GROUP DEFAULTPERFORMING form1 ON END OF TASKEXPORTING p1 = v1TABLES p1 = tabla1EXCEPTIONS exc1 = retc2 MESSAGE msg2CALL FUNCTION fnc1 IN UPDATE TASKEXPORTING p1 = v1TABLES p1 = tabla1CALL FUNCTION fnc1 DESTINATION dest1EXPORTING p1 = v1IMPORTING p1 = v1TABLES p1 = tabla1CHANGING p1 = v1EXCEPTIONS exc1 = retc2EXCEPTIONS exc1 = retc2 MESSAGE messCALL FUNCTION fnc1 IN BACKGROUND TASKAS SEPARATE UNITDESTINATION desti1EXPORTING p1 = v1TABLES p1 = tabla1CALL CUSTOMER-FUNCTION fnc1EXPORTING p1 = v2IMPORTING p1 = v2TABLES p1 = tabla1CHANGING p1 = v2EXCEPTIONS exc2 = retc1CALL SCREEN scr1STARTING AT x1 y1ENDING AT x2 y2CALL TRANSACTION tran1AND SKIP FIRST SCREENUSING tabla1MODE m1UPDATE upd1MESSAGES INTO msg1CALL DIALOG dlog1USING tablaMODE mode1AND SKIP FIRST SCREENEXPORTING v1 FROM v2IMPORTING v1 TO v2CALL METHOD met1 (EXPORTING p1 = v1IMPORTING p1 = v1CHANGING p1 = v1 )CALL METHOD met1EXPORTING p1 = v1IMPORTING p1 = v1CHANGING p1 = v1RECEIVING p1 = v1EXCEPTIONS ex = idxCALL cfunc1ID id1 FIELD v1 ... ID id1 FIELD v2*-------------------------------------------------------------------------- CASE:CASE v1WHEN bed1stm1WHEN bed2stm2WHEN bedxWHEN OTHERSstm3ENDCASE*-------------------------------------------------------------------------- CHECK:CHECK SELECT-OPTIONSCHECK logexp1CHECK s1*-------------------------------------------------------------------------- CLEAR:CLEAR v1WITH lit1WITH NULLCLOSE:CLOSE CURSOR curs1CLOSE DATASET dsn1COLLECT:COLLECT tabla1COLLECT wrk1 INTO tabla2*-------------------------------------------------------------------------- COMMIT:COMMIT WORKAND WAIT*-------------------------------------------------------------------------- COMMUNICATION:COMMUNICATION INIT DESTINATION desti1 ID ident1 COMMUNICATION ALLOCATE ID iden1COMMUNICATION ACCEPT ID ident1COMMUNICATION SEND ID ident 1 BUFFER b1COMMUNICATION RECEIVE ID ident1BUFFER b1DATAINFO datn1STATUSINFO stat1COMMUNICATION DEALLOCATE ID ident1*-------------------------------------------------------------------------- CONCATENATE:CONCATENATE v1 v2 ... vx INTO f2SEPARATED BY f3*-------------------------------------------------------------------------- COMPUTE:COMPUTE v1 = arithexp*-------------------------------------------------------------------------- CONDENSE:CONDENSE r1NO-GAPSCONDENSE v1*-------------------------------------------------------------------------- CONSTANTS:CONSTANTS con1 ... VALUE valu1CONSTANTS con1 ... VALUE IS INITIALCONSTANTS con1(len2) ... VALUE valu1CONSTANTS con1(len2) ... VALUE IS INITIALCONSTANTS: BEGIN OF conr1,CONSTANTS: END OF conr1*--------------------------------------------------------------------------CONTINUE:CONTINUECONTROLS:CONTROLS contrl TYPE TABLEVIEW USING SCREEN*-------------------------------------------------------------------------- CONVERT:CONVERT DATE v1 INTO INVERTED-DATE v2CONVERT INVERTED-DATE v1 INTO DATE v2CONVERT TEXT text1 INTO SORTABLE CODE cod2*-------------------------------------------------------------------------- CREATE:CREATE OBJECT obj1 class2LANGUAGE lang1*--------------------------------------------------------------------------DATA:DATA: BEGIN OF tabla1INCLUDE STRUCTURE struc1DATA: END OF tabla1DATA: BEGIN OF COMMON PART cp1DATA: END OF COMMON PARTDATA: BEGIN OF tabla1 OCCURS n2VALID BETWEEN v1 AND v2DATA: END OF tabla1DATA: BEGIN OF rec1DATA: END OF rec1DATA: v1TYPE typ1LIKE v1TYPE typ1 OCCURS n2LIKE v1 OCCURS n2TYPE LINE OF ityp1LIKE LINE OF tabla1VALUE lit1DECIMALS n1WITH HEADER LINEDATA: v1(len1)TYPE tipoTYPE typ1 OCCURS n2TYPE LINE OF ityp1VALUE lit1DECIMALS n1WITH HEADER LINE*-------------------------------------------------------------------------- DEFINE:DEFINE name1stm1stm2END-OF-DEFINITION*-------------------------------------------------------------------------- DELETE:DELETE tabla1DELETE tabla1 INDEX ix2DELETE tabla1 FROM ix2 TO ix3DELETE tabla1 WHERE cond2FROM ix1TO ix2DELETE ADJACENT DUPLICATES FROM tabla1COMPARING v1 v2 ...COMPARING ALL FIELDSDELETE etab1DELETE *etab1DELETE FROM etab1 WHERE cond2CLIENT SPECIFIEDDELETE FROM (name_etab1) WHERE cond2CLIENT SPECIFIEDDELETE (name_etab1)FROM area1CLIENT SPECIFIEDDELETE etab FROM TABLE tabla2DELETE (name_etab1) FROM TABLE tablaCLIENT SPECIFIEDDELETE etab1 VERSION ver2DELETE *etab1 VERSION ver2DELETE DATASET name1DELETE FROM DATABASE etab1(ar) ID key2CLIENT v1DELETE REPORT name1DELETE TEXTPOOL name1 LANGUAGE lan2DELETE DYNPRO v1DELETE FROM SHARED BUFFER etab1(ar) ... ID*-------------------------------------------------------------------------- DESCRIBE:DESCRIBE DISTANCE BETWEEN v1 AND v2 INTO v2DESCRIBE FIELD v1DECIMALS n1EDIT MASK msk1LENGTH n1OUTPUT-LENGTH n1TYPE t1 COMPONENTS n2TYPE t1DESCRIBE LISTNUMBER OF LINES ln1INDEX ix1NUMBER OF PAGES n1INDEX ix1LINE lin PAGE pn1INDEX ix1DESCRIBE LIST PAGE pag1INDEX ix1LINE-SIZE col1LINE-COUNT lin1LINES lin1FIRST-LINE lin1TOP-LINES lin1TITLE-LINES lin1HEAD-LINES lin1END-LINES lin1DESCRIBE TABLE tabla1LINES n1OCCURS n1*-------------------------------------------------------------------------- DETAIL:DETAILDIVIDE:DIVIDE v1 BY v2DIVIDE-CORRESPONDING r1 BY r2*-------------------------------------------------------------------------- DO:DODO v1 TIMESDO n1 TIMESVARYING v1 FROM v2 NEXT v3DO n1 TIMESVARYING v1 FROM v2 NEXT v3ENDDODO 254 TIMES.MOVE '#' TO SY-ULINE+SY-INDEX(1).ENDDO*-------------------------------------------------------------------------- EDITOR-CALL:EDITOR-CALL FOR tablaTITLE textDISPLAY-MODEEDITOR-CALL FOR REPORT nameDISPLAY-MODE*-------------------------------------------------------------------------- ELSE:ELSEELSEIF logop1*-------------------------------------------------------------------------- END:END-OF-DEFINITIONEND-OF-PAGEEND-OF-SELECTIONENDATENDCASEENDDOENDEXECENDFORMENDFUNCTIONENDIFENDLOOPENDMODULEENDONENDPROVIDEENDSELECTENDWHILEEXEC SQL:EXEC SQLPERFORMING formENDEXEC*-------------------------------------------------------------------------- EXIT:EXITEXIT FROM SQLEXIT FROM STEP-LOOP*-------------------------------------------------------------------------- EXPORT:EXPORT objn1 ... objn2 TO MEMORYFROM v1 ...ID key1EXPORT objn1 ... objn2 TO DATABASE etab3(ar4) ID key5FROM v1CLIENT c1USING form_nameEXPORT obj1 ... objn2 TO DATASET dsn3(ar4) ID key5EXPORT obj1 ... objn2 TO SHARED BUFFER etab3(ar4) ID key5 FROM v1 ...CLIENT c1EXPORT DYNPRO head1 fields2 order3 match4 ID id4 EXPORT NAMETAB h f ID idEXTRACT:EXTRACT r1FETCH:FETCH NEXT CURSOR c1 INTO work2FIELD-GROUPS:FIELD-GROUPS: fgr1, fgr2 ...FIELD-SYMBOLS:FIELD-SYMBOLS <fs1>STRUCTURE stru1 DEFAULT work2TYPE typ1TYPE LINE OF typ1LIKE s1LIKE LINE OF s1FIELDS:FIELDS v1FORM:FORM pp1USING p2 p3 ...ENDFORM.FORM form_name1USING p1 p2 ...USING VALUE(p1) VALUE(p2) ...CHANGING p1 p2 ...CHANGING VALUE(p1) VALUE(p2) ...TABLES tabla1 tabla2 ...STRUCTURE name1FORMAT:FORMATCOLOR n1INTENSIFIEDINVERSEHOTSPOTINPUTRESETFREE:FREE v1FREE MEMORYID key1FREE OBJECT objname1FREE tabla1FROM:FROM etab1CLIENT SPECIFIEDBYPASSING BUFFERUP TO n ROWSFROM (etab_name1)FUNCTION:FUNCTION name1ENDFUNCTIONFUNCTION-POOLMESSAGE-ID id1GENERATE:GENERATE REPORT progMESSAGE v1INCLUDE v1LINE v1WORD v1OFFSET v1TRACE-FILE v1DIRECTORY ENTRY v1WITHOUT SELECTION-SCREENGENERATE SUBROUTINE POOL tabla1 NAME name2MESSAGE v1INCLUDE v2LINE v3WORD v4OFFSET v5TRACE-FILE v6GENERATE DYNPRO head1 fields2 order3 match4 ID id4OFFSET v1TRACE-FILE v1GET:GET etab1LATEFIELDS v1 ...GET CURSOR FIELD fOFFSET v1LINE v1VALUE v1LENGTH v1GET CURSOR LINE linOFFSET v1VALUE v1LENGTH v1GET TIMEGET RUN TIMEGET RUN TIME FIELD v1GET PARAMETER ID key1 FIELD v1GET PROPERTY OF name1 attrib2 = v3NO FLUSHGROUP-BY:GROUP BY v1 v2 ...GROUP BY (tabla1)HIDE:HIDE lin_v1IF:IF v1 EQ v2stm1ELSEstm2ENDIFIF v1 EQ v2IF v1 LT v2IF v1 GT v2IF v1 IS INITIALIF v1 IS REQUESTEDIF v1 logexp1IF v1 logexp2IF exp1 AND exp2 ...IF exp1 OR exp2 ...IF exp1 NOT exp2 ...IF v1 CA v2IF v1 NA v2IF v1 CO v2IF v1 CN v2IF v1 CP v2IF v1 NP v2IF v1 CS v2IF v1 NS v2IF v1 MIF v1 OIF v1 ZIMPORT:IMPORT v1 tabla2 ... FROM DATABASE etab3(ar4) ID key5TO v6 ...MAJOR-ID maj1 ...MAJOR-ID maj1 MINOR-ID min2CLIENT hUSING form_name1IMPORT DIRECTORY INTO tabla1 FROM DATABASE etab2(ar3) ID key4 CLIENT cl1IMPORT v1 tabla2 ... FROM LOGFILE ID key3TO v4IMPORT DYNPRO head1 tabla2 logik3 matchc4 ID id5IMPORT v1 tabla2 ... FROM MEMORYTO v3 ...ID keyIMPORT v1 tabla2 ... FROM SHARED BUFFER etab3(ar4) ID key5TO v6CLIENT cl6INCLUDE:INCLUDE STRUCTURE rec1INCLUDE TYPE typename1INCLUDE pname1INFOTYPES:INFOTYPES: n1NAME v1OCCURS n1MODE m1VALID FROM begdt1 TO enddt2INITIALIZATION:INITIALIZATIONINPUTINSERT etab1CLIENT SPECIFIEDINSERT etab1 FROM work2INSERT etab1 FROM TABLE tabla1ACCEPTING DUPLICATE KEYSINSERT INTO etab1CLIENT SPECIFIEDVALUES wb2INSERT (etab)CLIENT SPECIFIEDINSERT (etab) FROM work2INSERT (etab) FROM TABLE tabla1ACCEPTING DUPLICATE KEYSINSERT INTO (etab1)CLIENT SPECIFIEDVALUES wb2INSERT tabla1INSERT tabla1 INDEX ix2INSERT work1 INTO tabla2INSERT work1 INTO tabla2 INDEX ix3INSERT INITIAL LINE INTO tabla2INSERT LINES OF tabla1 INTO tabla2INSERT LINES OF tabla1 FROM ix1 INTO tabla2INSERT LINES OF tabla1 FROM ix1 TO ix2 INTO tabla2INSERT LINES OF tabla1 FROM ix1 TO ix2 INTO tabla2 INDEX ix3 INSERT REPORT name FROM tablaINSERT TEXTPOOL name FROM tabla LANGUAGE l1INSERT Field groupsINSERT v1 v2 ... INTO fgroup3INTO:INTO area1INTO CORRESPONDING FIELDS OF area1INTO (v1, v2, ...)INTO TABLE tabla1PACKAGE SIZE n1INTO CORRESPONDING FIELDS OF TABLE tabla1PACKAGE SIZE n1APPENDING TABLE tabla1PACKAGE SIZE n1APPENDING CORRESPONDING FIELDS OF TABLE tabla1PACKAGE SIZE n1LEAVELEAVE PROGRAMLEAVE TO TRANSACTION tac1AND SKIP FIRST SCREENLEAVE TO SCREEN dynp1LEAVE SCREENLEAVE TO LIST-PROCESSINGAND RETURN TO SCREEN dynp1LEAVE LIST-PROCESSINGLOAD:LOAD REPORT pnam1 PART 'HEAD' INTO tabla2 LOAD REPORT pnam1 PART 'TRIG' INTO tabla2LOAD REPORT pnam1 PART 'CONT' INTO tabla2 LOAD REPORT pnam1 PART 'DATA' INTO tabla2LOAD REPORT pnam1 PART 'DDNM' INTO tabla2 LOAD REPORT pnam1 PART 'DATV' INTO tabla2 LOAD REPORT pnam1 PART 'SELC' INTO tabla2LOAD REPORT pnam1 PART 'STOR' INTO tabla2 LOAD REPORT pnam1 PART 'LITL' INTO tabla2LOAD REPORT pnam1 PART 'SYMB' INTO tabla2 LOAD REPORT pnam1 PART 'LREF' INTO tabla2LOAD REPORT pnam1 PART 'SSCR' INTO tabla2LOAD REPORT pnam1 PART 'BASE' INTO tabla2LOAD REPORT pnam1 PART 'INIT' INTO tabla2LOAD REPORT pnam1 PART 'DATP' INTO tabla2LOAD REPORT pnam1 PART 'TXID' INTO tabla2LOAD REPORT pnam1 PART 'COMP' INTO tabla2LOCAL:LOCAL v1LOOP:LOOP AT tabla1WRITE: /1 tabla1-f1ENDLOOPLOOP AT tablaFROM n1TO n2WHERE logexp1TRANSPORTING NO FIELDSLOOP AT tabla INTO waFROM n1TO n2WHERE logexp1TRANSPORTING NO FIELDSLOOP AT SCREENMESSAGE:MESSAGE msgnr1WITH v1 v2 ...RAISING exc1MESSAGE ID id1 TYPE mtyp2 NUMBER mnr3WITH v1 v2 ...MODIFY:MODIFY etabMODIFY *etabMODIFY (etab_name1)FROM area1CLIENT SPECIFIEDMODIFY etab1 FROM TABLEMODIFY etab1 FROM TABLE tabla2MODIFY (etab-name1) FROM TABLE tabla2CLIENT SPECIFIEDMODIFY tabla1INDEX ix3TRANSPORTING v4 v5 ...WHERE logexp6MODIFY tabla1 FROM wk2MODIFY LINE n1INDEX ix1LINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY LINE n1 OF CURRENT PAGELINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY LINE n1 OF PAGE m2LINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY CURRENT LINELINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY SCREENMODULE:MODULE mname1stm1ENDMODULEMODULE mname1OUTPUTINPUTMOVE:MOVE v1 TO v2MOVE v1+off1(len1) TO v2+off2(len2) MOVE v1 TO v2 PERCENTAGE v3RIGHTLEFTRIGHTMOVE-CORRESPONDING rec1 TO rec2MULTIPLY:MULTIPLY v1 BY v2MULTIPLY-CORRESPONDING r1 BY r2NEW-LINE:NEW-LINENO-SCROLLINGSCROLLINGNEW-PAGE:NEW-PAGE PRINT ONARCHIVE MODE armodeARCHIVE PARAMETERS arparamsARCHIVE PARAMETERS arparamsCOPIES n1COVER TEXT litDATASET EXPIRATION daysDEPARTMENT name1DESTINATION dest1IMMEDIATELY flagKEEP IN SPOOL flagLAYOUT layer1LINE-COUNT l1LINE-SIZE c1LIST AUTHORITY auth1LIST DATASET dsnameLIST NAME nameNEW LIST IDENTIFICATION flagNEW-SECTIONNEW-SECTIONNO DIALOGNO DIALOGPARAMETERS para1RECEIVER r1SAP COVER PAGE m1NEW-PAGELINE-COUNT lin1LINE-SIZE c1NO-HEADINGNO-TITLEWITH-HEADINGWITH-TITLEPRINT ON ...PRINT OFFON:ON CHANGE OF v1stm1ENDONON CHANGE OF v1OR v1 ...OPEN DATASET:OPEN DATASET name1AT POSITION pos1FILTER bsFOR APPENDINGFOR INPUTFOR OUTPUTIN BINARY MODEIN TEXT MODEMESSAGE msg1TYPE t1OPEN CURSOR:OPEN CURSOR c1 FOR SELECTWITH HOLDORDER-BY:ORDER BY PRIMARY KEYORDER BY v1 v2 ...ORDER BY (tabla)OVERLAY:OVERLAY v1 WITH v2ONLY v3PACK:PACK v1 TO v2PARAMETERS:PARAMETERS p1AS CHECKBOXDEFAULT valueFOR TABLE etab1LIKE v1LOWER CASEMATCHCODE OBJECT objname1MEMORY ID mid1MODIF ID key1NO-DISPLAYOBLIGATORYTYPE typ1DECIMALS n1RADIOBUTTON GROUP radbut1FOR TABLE etab1AS MATCHCODE STRUCTUREVALUE-REQUESTHELP-REQUESTPERFORM:PERFORM form IN PROGRAM progCHANGING p1 p2 p3 ...IF FOUNDTABLES tabla1 tabla2 ...USING p1 p2 p3 ...PERFORM form1(prog2)CHANGING p1 p2 p3 ...IF FOUNDTABLES tabla1 tabla2 ...USING p1 p2 p3 ...PERFORM form1USING p1 p2 p3 ...CHANGING p1 p2 p3 ...TABLES tabla1 tabla2 ...PERFORM n OF form1 form2 form3 ...PERFORM n ON COMMITLEVEL v1POSITION:POSITION colPRINT-CONTROL:PRINT-CONTROLCPI cpi1LPI lpi1SIZE size1COLORBLACKREDBLUEGREENYELLOWPINKLEFT MARGIN col1FONT font1FUNCTION v1LINE linPOSITION colPRINT-CONTROL INDEX-LINE fPROGRAM:PROGRAMPROVIDE:PROVIDE v1 v2 FROM itab3v4 v5 FROM itab6BETWEEN v7 AND v8ENDPROVIDEPUT:PUT etab1RAISE:RAISE expt1RANGES:RANGES sel FOR fOCCURS occ*-------------------------------------------------------------------------- READ:READ LINE l1FIELD VALUE v1 INTO v2INDEX ixREAD LINE lin OF CURRENT PAGEREAD LINE lin OF PAGE pagREAD CURRENT LINEREAD TABLE etab. " (-> old)READ TABLE tabla1BINARY SEARCHCOMPARING ALL FIELDSCOMPARING v1 v2 ...INDEX ix1TRANSPORTING NO FIELDSTRANSPORTING v1 v2 ...WITH KEY keyWITH KEY key BINARY SEARCHWITH KEYWITH KEY = value1READ TABLE tabla INTO area1BINARY SEARCHCOMPARING ALL FIELDSCOMPARING v1 v2 ...INDEX ix1TRANSPORTING NO FIELDSTRANSPORTING v1 v2 ...WITH KEY keyWITH KEY key BINARY SEARCHWITH KEYWITH KEY = value1READ REPORT prog INTO tabla1READ TEXTPOOL prog INTO tabla LANGUAGE l1READ DATASET dsnname1 INTO wk2LENGTH lenRECEIVE:RECEIVE RESULTS FROM FUNCTION funcIMPORTINGTABLESEXCEPTIONSREFRESH:REFRESH tabla1 FROM SELECT-OPTIONSREFRESH tabla1 FROM TABLE etab2 "-> oldREFRESH tabla1REFRESH CONTROL ctrl FROM SCREEN dynpr2REJECT:REJECT etab1REPLACE:REPLACE v1 WITH v2 INTO v3LENGTH len1*-------------------------------------------------------------------------- REPORT:REPORT repname1NO STANDARD PAGE HEADINGLINE-SIZE colLINE-COUNT lin(n)MESSAGE-ID xxDEFINING DATABASE ldb*-------------------------------------------------------------------------- RESERVE:RESERVE n LINES*-------------------------------------------------------------------------- ROLLBACK:ROLLBACK WORK*-------------------------------------------------------------------------- SCAN:SCAN ABAP-SOURCE tabla1 ... TOKENS INTO tabla2 ...FROM v1TO v1KEYWORDS FROM tabla1LEVELS INTO tabla1OVERFLOW INTO tabla1WITH ANALYSISWITH COMMENTSWITH INCLUDESWITHOUT TRMACPROGRAM FROM v1INCLUDE INTO v1MESSAGE INTO v1WORD INTO v1LINE INTO v1OFFSET INTO v1*-------------------------------------------------------------------------- SCROLL:SCROLL LIST TO FIRST PAGEINDEX ix1LINE lin1SCROLL LIST TO LAST PAGEINDEX ix1LINE lin1SCROLL LIST TO PAGE pagINDEX ix1LINE lin1SCROLL LIST TO COLUMN colINDEX ix1LINE lin1SCROLL LIST FORWARDINDEX ix1n1 PAGESSCROLL LIST BACKWARDINDEX ix1n1 PAGESSCROLL LIST LEFTINDEX ix1BY n1 PLACESSCROLL LIST RIGHTINDEX ix1BY n1 PLACESSEARCH:SEARCH v1 FOR v2ABBREVIATEDSTARTING AT n1ENDING AT n2AND MARKSEARCH tabla1 FOR v2ABBREVIATEDSTARTING AT n1ENDING AT n2AND MARK*-------------------------------------------------------------------------- SELECT:SELECT {AutoSelect}SELECT * FROM etabWHERE etab_v1 EQ v2AND etab_v3 EQ v4ENDSELECTSELECT etab_v1 etab_v2etab_v3 etab_v3FROM etabWHERE etab_v1 EQ v2AND etab_v3 EQ v4ENDSELECTSELECT * INTO wrk1FROM etabWHERE etab_v1 EQ v2AND etab_v3 EQ v4ENDSELECTSELECT * FROM etab1WHERE etab_v1 EQ v2AND etab_v3 EQ v4ORDER BY PRIMARY KEYENDSELECTSELECT * FROM etab1CLIENT SPECIFIEDBYPASSING BUFFERUP TO n5 ROWSWHERE etab_v1 EQ v2AND etab_v3 EQ v4ENDSELECTSELECT SINGLE * FROM etabWHERE etab_v1 EQ v2AND etab_v3 EQ v4SELECT *SELECT SINGLE *SELECT SINGLE FOR UPDATE *SELECT DISTINCT *SELECT etab_v1 ...SELECT SINGLE etab_v1 ...SELECT SINGLE FOR UPDATE etab_v1 ...SELECT DISTINCT etab_v1 ...SELECT (tabla1)SELECT SINGLE (tabla)SELECT SINGLE FOR UPDATE (tabla)SELECT DISTINCT (tabla)*-------------------------------------------------------------------------- INTO de SELECT:INTO wrk1INTO CORRESPONDING FIELDS OF wrk1INTO (v1, v2 ...)INTO TABLE tabla1PACKAGAE SIZEINTO CORRESPONDING FIELDS OF TABLE tablaPACKAGAE SIZEINTO APPENDING TABLE tablaPACKAGAE SIZEINTO APPENDING CORRESPONDING FIELDS OF TABLE tabla PACKAGAE SIZE*-------------------------------------------------------------------------- FROM de SELECT:FROM etab1CLIENT SPECIFIEDBYPASSING BUFFERUP TO n1 ROWSFROM (etab1)CLIENT SPECIFIEDBYPASSING BUFFERUP TO n1 ROWS*--------------------------------------------------------------------------WHERE de SELECT:WHERE where_conditionWHERE NOT where_conditionWHERE wherebedinung AND where_conditionWHERE wherebedinung OR where_conditionFOR ALL ENTRIES IN tabla1 WHERE where_conditionFOR ALL ENTRIES IN tabla1 WHERE NOT where_conditionFOR ALL ENTRIES IN tabla1 WHERE where_condition AND where_condition FOR ALL ENTRIES IN tabla1 WHERE where_condition OR where_conditionSELECT ... where_condici?FOR ALL ENTRIES IN tabla1WHERE f1 = v1WHERE f1 EQ v1WHERE f1 NE v1WHERE f1 <> v1WHERE f1 >< v1WHERE f1 LT v1WHERE f1 < v1WHERE f1 LE v1WHERE f1 <= v1WHERE f1 =< v1WHERE f1 GT v1WHERE f1 > v1WHERE f1 GE v1WHERE f1 >= v1WHERE f1 => v1WHERE f1BETWEEN v1 AND v2LIKE v1IN tabla1IN (v2, v3, ...)WHERE f1 NOTBETWEEN v1 AND v2LIKE v1IN tabla1IN (v2, v3, ...)WHERE f1 IS NULLWHERE f1 IS NOT NULLGROUP-BY de SELECT:GROUP BY v1 v2 ...HAVING wherecondGROUP BY (tabla)HAVING wherecond*-------------------------------------------------------------------------- ORDER-BY de SELECT:ORDER BY PRIMARY KEYORDER BY v1 v2 ...ORDER BY (tabla1)*-------------------------------------------------------------------------- SELECT-OPTIONS:SELECT-OPTIONS sel1 FOR v2DEFAULT lit1DEFAULT lit1 ... OPTION op2 ... SIGN ie3DEFAULT lit1 TO lit2DEFAULT lit1 TO lit1 OPTION op2 ... SIGN ie3MEMORY ID spa1MATCHCODE OBJECT mtch1MODIF ID scrg1NO-DISPLAYLOWER CASEOBLIGATORYNO-EXTENSIONNO INTERVALSNO DATABASE SELECTIONVALUE-REQUESTVALUE-REQUEST FOR LOW/HIGHHELP-REQUESTHELP-REQUEST FOR LOW/HIGH*-------------------------------------------------------------------------- SELECTION-SCREEN:SELECTION-SCREEN BEGIN OF LINESELECTION-SCREEN END OF LINESELECTION-SCREEN SKIP n1FOR TABLE etab1ID id1SELECTION-SCREEN ULINEpos1FOR TABLE etab1MODIF ID scr1ID id1SELECTION-SCREEN POSITION pos1FOR TABLE etab1SELECTION-SCREEN COMMENT fmt nameFOR TABLE etab1FOR FIELD v1MODIF ID scr1ID id1SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom FOR TABLE etab1MODIF ID scr1ID id1SELECTION-SCREEN BEGIN OF BLOCK blck1WITH FRAMETITLE titl1NO INTERVALSSELECTION-SCREEN END OF BLOCK blck1SELECTION-SCREEN FUNCTION KEY n1_5FOR TABLE etab1ID id1SELECTION-SCREEN BEGIN OF VERSION ver TEXT-xxxSELECTION-SCREEN END OF VERSION verSELECTION-SCREEN EXCLUDE ...PARAMETERS parSELECT-OPTIONS selRADIOBUTTON GROUPS radiBLOCKS blockIDS idSELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE dbtabSELECTION-SCREEN FIELD SELECTION FOR TABLE dbtab*--------------------------------------------------------------------------SET:SET BLANK LINES ONSET BLANK LINES OFFSET COUNTRY count1SET CURSOR FIELD v1OFFSET off1LINE lin1SET CURSOR LINE lin1OFFSET off1SET CURSOR col1 lin2SET EXTENDED CHECKSET LANGUAGE langu1SET LOCALE LANGUAGE lgCOUNTRY cout1MODIFIER m1SET MARGIN vcol1 vlin2SET PARAMETER ID pid1 FIELD v2SET PF-STATUS pf1EXCLUDINGIMMEDIATELYSET PROPERTY OF obj1 attrb2 = v3NO FLUSHSET RUN TIME ANALYZER ONSET RUN TIME ANALYZER OFFSET SCREEN dynnr1SET LEFT SCROLL-BOUNDARYCOLUMN col1SET TITLEBAR titl1WITH &1 &2 ...SET UPDATE TASK LOCALSET USER-COMMAND lit1*-------------------------------------------------------------------------- SHIFT:SHIFT v1CIRCULARLEFTRIGHTSHIFT r1 BY n PLACESCIRCULARLEFTRIGHTSHIFT r1 UP TO r2CIRCULARLEFTRIGHTSHIFT v1 LEFT DELETING LEADING c1SHIFT v1 RIGHT DELETING TRAILING c1*-------------------------------------------------------------------------- SKIP:SKIP TO LINE l1SKIP n*-------------------------------------------------------------------------- SORT:SORTBY v1 v2 ...ASCENDINGDESCENDINGAS TEXTSORT tabla1BY v1 v2 ...ASCENDINGDESCENDINGAS TEXT*-------------------------------------------------------------------------- SPLIT:SPLIT v1 AT v2 INTO targ1 targ2SPLIT f AT g INTO TABLE tabla*-------------------------------------------------------------------------- START-OF-SELECTION:START-OF-SELECTION*-------------------------------------------------------------------------- STATICS:STATICS v1STATICS v1(len2)STATICS: BEGIN OF rec,STATICS: END OF rec,STATICS: BEGIN OF tabla OCCURS n,STATICS: END OF tabla*-------------------------------------------------------------------------- STOP:STOP*-------------------------------------------------------------------------- SUBMIT:SUBMIT repname1SUBMIT (repname1)LINE-SIZE col1LINE-COUNT lin1VIA SELECTION-SCREENAND RETURNEXPORTING LIST TO MEMORYUSER user1 VIA JOB job2 NUMBER n3TO SAP-SPOOLDESTINATION dest1COPIES num1LIST NAME name1LIST DATASET dsname1COVER TEXT text1LIST AUTHORITY auth1IMMEDIATELY x1KEEP IN SPOOL x1NEW LIST IDENTIFICATION x1DATASET EXPIRATION days1LINE-COUNT lin1LINE-SIZE col1LAYOUT layer1SAP COVER PAGE mode1COVER PAGE x1RECEIVER rec1DEPARTMENT name1ARCHIVE MODE mode1ARCHIVE PARAMETERS para1WITHOUT SPOOL DYNPROUSING SELECTION-SETS OF PROGRAM pname1WITH SELECTION-SET v1WITH p1 logop2 v3 SIGN ie4WITH p1 BETWEEN v2 AND v3 SIGN ie4WITH p1 NOT BETWEEN v2 AND v3 SIGN ie4WITH p1 IN sel_tabla1WITH SELECTION-TABLE sel_tabla1WITH FREE SELECTIONS rsds_tabla1*-------------------------------------------------------------------------- SUBTRACT:SUBTRACT v1 FROM v2SUBTRACT-CORRESPONDING rec1 FROM rec2*-------------------------------------------------------------------------- SUM:SUM*-------------------------------------------------------------------------- SUMMARY:SUMMARY。
ABAP语法
ABAP运算
• • • • • • • • 数值运算(在ABAP中数字表达式可以任意多层嵌套) - 算术运算 - 数学函数 - 时间日期运算 逻辑表达式 - 通用逻辑运算符 EQ(=) NE(<>) LT(<) LE(<=) GT(>) GE(>=) -IS操作符 · initial 检查字段是否为初始值 IS · assigned 检查字段是否被分配 IS - between 操作符
ABAP语言的基本元素
• • • • • • • • • • 数据类型 D:日期类型,格式为YYYYMMDD,长度为8 T:时间类型,格式HHMMSS,长度为6 L:整数类型,长为4 F:浮点类型,长度为8 String:变长字符串类型 Xstring:变长字节序列类型 C:字符串类型,定义变量时指定字符个数 N:数字字符串类型,定义变量时指定数值字符个数 X:字节序列类型,定义变量时指定长度和小数点后位数
基本数据操作
• • • • • • • • • • • • • data: x_1 type i value 6,x_2 type i value 3,x_3 type i. x_3 = x_1 + x_2. write: 'x_3='. write: x_3, /. x_3 = x_1 - x_2. write: 'x_3='. write: x_3, /. x_3 = x_1 * x_2. write: 'x_3='. write: x_3, /. x_3 = x_1 / x_2. write: 'x_3='. write: x_3, /.
ABAP
• • • • • • • • 了解ABAP SAP的三层体系结构 ABAP语法概述 ABAP语言的基本元素 ABAP的语法格式 结构类型和结构体 内表 数据库操作
ABAP语句整理
1.ADD:ADD v1 FROM v2 TO v3 GIVING v4ADD v1 THEN v2 UNTIL v3 GIVING mADD v1 THEN v2 UNTIL v3 TO mADD v1 THEN v2 UNTIL v3ADD v1 TO v2ADD-CORRESPONDING rec1 TO rec2前提,仅针对工作区做运算,且指定的计算范围内应该都是同一类型的数字(series-n1 到series-n6全是数字就可以,前后中间可以有其他类型的,但运算对象为同一类型数字)主要是在循环时,再循环内部对有特定规律的数据进行合计使用。
DATA: BEGIN OF series,kk1 TYPE c VALUE 'dd',yy TYPE i VALUE 1,kk2 TYPE c VALUE 'dd',ju TYPE i VALUE 1,kk3 TYPE c VALUE 'dd',t5 TYPE i VALUE 1,kk4 TYPE c VALUE 'dd',8s TYPE i VALUE 1,kk5 TYPE c VALUE 'dd',00 TYPE i VALUE 1,kk6 TYPE c VALUE 'dd',5j TYPE i VALUE 1,END OF series.DATA sum TYPE i.ADD series-yy THEN series-ju UNTIL series-00 giving sum.write sum.结果为6。
2.APPEND:APPEND tablaAPPEND area1 TO tabla2APPEND INITIAL LINE TO tabla1APPEND tabla SORTED BY v3APPEND area1 TO tabla2 SORTED BY v3APPEND LINES OF tabla1 TO tabla 2APPEND LINES OF tabla1 FROM ix1 TO tabla2APPEND LINES OF tabla1 FROM ix1 TO ix2 TO tabla2ASSIGN:ASSIGN v1 TO <fs1> DECIMALS dec TYPE tipoASSIGN f+off(len) TO <fs> DECIMALS dec TYPE tipoASSIGN (f) TO <fs> TYPE tipo DECIMALS decASSIGN <fs1>+off(len) TO <fs2> DECIMALS dec TYPE tipoASSIGN TABLE FIELD v1 TO <fs>ASSIGN TABLE FIELD (f) TO <fs>ASSIGN COMPONENT n OF STRUCTURE rec TO <fs> DECIMALS dec TYPE tipo ASSIGN COMPONENT name OF STRUCTURE rec TO <fs> DECIMALS dec TYPE tipo ASSIGN LOCAL COPY OF v1 TO <f>ASSIGN LOCAL COPY OF MAIN TABLE FIELD (f) TO <f>ASSIGN LOCAL COPY OF INITAL LINE tabla TO <f>*--------------------------------------------------------------------------AT:AT END OF v1AT NEW v1AT FIRSTAT LASTAT fg WITH fg1AT LINE-SELECTIONAT USER-COMMANDAT PFxAT SELECTION-SCREENON ps1ON END OF s1ON VALUE-REQUEST FOR ps1ON HELP-REQUEST FOR ps1ON RADIOBUTTON GROUP radi1ON BLOCK blk1OUTPUT*--------------------------------------------------------------------------AUTHORITY-CHECK:AUTHORITY-CHECK OBJECT object ID name1 FIELD f1*--------------------------------------------------------------------------BACK:BACK*--------------------------------------------------------------------------BREAK-POINT:BREAK-POINT lit1*--------------------------------------------------------------------------CALL:CALL FUNCTION {AutoInsertFunctionCall}CALL FUNCTION fnc1EXPORTING p1 = v1IMPORTING p1 = v1TABLES p1 = tabla1CHANGING p1 = v1EXCEPTIONS exc1 = retc1CALL FUNCTION fnc1 STARTING NEW TASK tskname2 DESTINATION dest1DESTINATION IN GROUP grp1DESTINATION IN GROUP DEFAULT PERFORMING form1 ON END OF TASK EXPORTING p1 = v1TABLES p1 = tabla1EXCEPTIONS exc1 = retc2 MESSAGE msg2CALL FUNCTION fnc1 IN UPDATE TASK EXPORTING p1 = v1TABLES p1 = tabla1CALL FUNCTION fnc1 DESTINATION dest1 EXPORTING p1 = v1IMPORTING p1 = v1TABLES p1 = tabla1CHANGING p1 = v1EXCEPTIONS exc1 = retc2EXCEPTIONS exc1 = retc2 MESSAGE mess CALL FUNCTION fnc1 IN BACKGROUND TASKAS SEPARATE UNITDESTINATION desti1EXPORTING p1 = v1TABLES p1 = tabla1CALL CUSTOMER-FUNCTION fnc1EXPORTING p1 = v2IMPORTING p1 = v2TABLES p1 = tabla1CHANGING p1 = v2EXCEPTIONS exc2 = retc1CALL SCREEN scr1STARTING AT x1 y1ENDING AT x2 y2CALL TRANSACTION tran1AND SKIP FIRST SCREENUSING tabla1MODE m1UPDATE upd1MESSAGES INTO msg1CALL DIALOG dlog1USING tablaMODE mode1AND SKIP FIRST SCREENEXPORTING v1 FROM v2IMPORTING v1 TO v2CALL METHOD met1 (EXPORTING p1 = v1IMPORTING p1 = v1CHANGING p1 = v1 )CALL METHOD met1EXPORTING p1 = v1IMPORTING p1 = v1CHANGING p1 = v1RECEIVING p1 = v1EXCEPTIONS ex = idxCALL cfunc1ID id1 FIELD v1 ... ID id1 FIELD v2*-------------------------------------------------------------------------- CASE:CASE v1WHEN bed1stm1WHEN bed2stm2WHEN bedxWHEN OTHERSstm3ENDCASE*-------------------------------------------------------------------------- CHECK:CHECK SELECT-OPTIONSCHECK logexp1CHECK s1*-------------------------------------------------------------------------- CLEAR:CLEAR v1WITH lit1WITH NULLCLOSE:CLOSE CURSOR curs1CLOSE DATASET dsn1COLLECT:COLLECT tabla1COLLECT wrk1 INTO tabla2*-------------------------------------------------------------------------- COMMIT:COMMIT WORKAND WAIT*-------------------------------------------------------------------------- COMMUNICATION:COMMUNICATION INIT DESTINATION desti1 ID ident1 COMMUNICATION ALLOCATE ID iden1COMMUNICATION ACCEPT ID ident1COMMUNICATION SEND ID ident 1 BUFFER b1COMMUNICATION RECEIVE ID ident1BUFFER b1DATAINFO datn1STATUSINFO stat1COMMUNICATION DEALLOCATE ID ident1*-------------------------------------------------------------------------- CONCATENATE:CONCATENATE v1 v2 ... vx INTO f2SEPARATED BY f3*-------------------------------------------------------------------------- COMPUTE:COMPUTE v1 = arithexp*-------------------------------------------------------------------------- CONDENSE:CONDENSE r1NO-GAPSCONDENSE v1*-------------------------------------------------------------------------- CONSTANTS:CONSTANTS con1 ... VALUE valu1CONSTANTS con1 ... VALUE IS INITIALCONSTANTS con1(len2) ... VALUE valu1CONSTANTS con1(len2) ... VALUE IS INITIALCONSTANTS: BEGIN OF conr1,CONSTANTS: END OF conr1*--------------------------------------------------------------------------CONTINUE:CONTINUECONTROLS:CONTROLS contrl TYPE TABLEVIEW USING SCREEN*-------------------------------------------------------------------------- CONVERT:CONVERT DATE v1 INTO INVERTED-DATE v2CONVERT INVERTED-DATE v1 INTO DATE v2CONVERT TEXT text1 INTO SORTABLE CODE cod2*-------------------------------------------------------------------------- CREATE:CREATE OBJECT obj1 class2LANGUAGE lang1*-------------------------------------------------------------------------- DATA:DATA: BEGIN OF tabla1INCLUDE STRUCTURE struc1DATA: END OF tabla1DATA: BEGIN OF COMMON PART cp1DATA: END OF COMMON PARTDATA: BEGIN OF tabla1 OCCURS n2VALID BETWEEN v1 AND v2DATA: END OF tabla1DATA: BEGIN OF rec1DATA: END OF rec1DATA: v1TYPE typ1LIKE v1TYPE typ1 OCCURS n2LIKE v1 OCCURS n2TYPE LINE OF ityp1LIKE LINE OF tabla1VALUE lit1DECIMALS n1WITH HEADER LINEDATA: v1(len1)TYPE tipoTYPE typ1 OCCURS n2TYPE LINE OF ityp1VALUE lit1DECIMALS n1WITH HEADER LINE*-------------------------------------------------------------------------- DEFINE:DEFINE name1stm1stm2END-OF-DEFINITION*-------------------------------------------------------------------------- DELETE:DELETE tabla1DELETE tabla1 INDEX ix2DELETE tabla1 FROM ix2 TO ix3DELETE tabla1 WHERE cond2FROM ix1TO ix2DELETE ADJACENT DUPLICATES FROM tabla1COMPARING v1 v2 ...COMPARING ALL FIELDSDELETE etab1DELETE *etab1DELETE FROM etab1 WHERE cond2CLIENT SPECIFIEDDELETE FROM (name_etab1) WHERE cond2CLIENT SPECIFIEDDELETE (name_etab1)FROM area1CLIENT SPECIFIEDDELETE etab FROM TABLE tabla2DELETE (name_etab1) FROM TABLE tablaCLIENT SPECIFIEDDELETE etab1 VERSION ver2DELETE *etab1 VERSION ver2DELETE DATASET name1DELETE FROM DATABASE etab1(ar) ID key2CLIENT v1DELETE REPORT name1DELETE TEXTPOOL name1 LANGUAGE lan2DELETE DYNPRO v1DELETE FROM SHARED BUFFER etab1(ar) ... ID*-------------------------------------------------------------------------- DESCRIBE:DESCRIBE DISTANCE BETWEEN v1 AND v2 INTO v2DESCRIBE FIELD v1DECIMALS n1EDIT MASK msk1LENGTH n1OUTPUT-LENGTH n1TYPE t1 COMPONENTS n2TYPE t1DESCRIBE LISTNUMBER OF LINES ln1INDEX ix1NUMBER OF PAGES n1INDEX ix1LINE lin PAGE pn1INDEX ix1DESCRIBE LIST PAGE pag1INDEX ix1LINE-SIZE col1LINE-COUNT lin1LINES lin1FIRST-LINE lin1TOP-LINES lin1TITLE-LINES lin1HEAD-LINES lin1END-LINES lin1DESCRIBE TABLE tabla1LINES n1OCCURS n1*-------------------------------------------------------------------------- DETAIL:DETAILDIVIDE:DIVIDE v1 BY v2DIVIDE-CORRESPONDING r1 BY r2*-------------------------------------------------------------------------- DO:DODO v1 TIMESDO n1 TIMESVARYING v1 FROM v2 NEXT v3DO n1 TIMESVARYING v1 FROM v2 NEXT v3ENDDODO 254 TIMES.MOVE '#' TO SY-ULINE+SY-INDEX(1).ENDDO*-------------------------------------------------------------------------- EDITOR-CALL:EDITOR-CALL FOR tablaTITLE textDISPLAY-MODEEDITOR-CALL FOR REPORT nameDISPLAY-MODE*-------------------------------------------------------------------------- ELSE:ELSEELSEIF logop1*-------------------------------------------------------------------------- END:END-OF-DEFINITIONEND-OF-PAGEEND-OF-SELECTIONENDATENDCASEENDDOENDEXECENDFORMENDFUNCTIONENDIFENDLOOPENDMODULEENDONENDPROVIDEENDSELECTENDWHILEEXEC SQL:EXEC SQLPERFORMING formENDEXEC*-------------------------------------------------------------------------- EXIT:EXITEXIT FROM SQLEXIT FROM STEP-LOOP*-------------------------------------------------------------------------- EXPORT:EXPORT objn1 ... objn2 TO MEMORYFROM v1 ...ID key1EXPORT objn1 ... objn2 TO DATABASE etab3(ar4) ID key5FROM v1CLIENT c1USING form_nameEXPORT obj1 ... objn2 TO DATASET dsn3(ar4) ID key5EXPORT obj1 ... objn2 TO SHARED BUFFER etab3(ar4) ID key5 FROM v1 ...CLIENT c1EXPORT DYNPRO head1 fields2 order3 match4 ID id4EXPORT NAMETAB h f ID idEXTRACT:EXTRACT r1FETCH:FETCH NEXT CURSOR c1 INTO work2FIELD-GROUPS:FIELD-GROUPS: fgr1, fgr2 ...FIELD-SYMBOLS:FIELD-SYMBOLS <fs1>STRUCTURE stru1 DEFAULT work2TYPE typ1TYPE LINE OF typ1LIKE s1LIKE LINE OF s1FIELDS:FIELDS v1FORM:FORM pp1USING p2 p3 ...ENDFORM.FORM form_name1USING p1 p2 ...USING VALUE(p1) VALUE(p2) ...CHANGING p1 p2 ...CHANGING VALUE(p1) VALUE(p2) ...TABLES tabla1 tabla2 ...STRUCTURE name1FORMAT:FORMATCOLOR n1INTENSIFIEDINVERSEHOTSPOTINPUTRESETFREE:FREE v1FREE MEMORYID key1FREE OBJECT objname1FREE tabla1FROM:FROM etab1CLIENT SPECIFIEDBYPASSING BUFFERUP TO n ROWSFROM (etab_name1)FUNCTION:FUNCTION name1ENDFUNCTIONFUNCTION-POOLMESSAGE-ID id1GENERATE:GENERATE REPORT progMESSAGE v1INCLUDE v1LINE v1WORD v1OFFSET v1TRACE-FILE v1DIRECTORY ENTRY v1WITHOUT SELECTION-SCREENGENERATE SUBROUTINE POOL tabla1 NAME name2MESSAGE v1INCLUDE v2LINE v3WORD v4OFFSET v5TRACE-FILE v6GENERATE DYNPRO head1 fields2 order3 match4 ID id4OFFSET v1TRACE-FILE v1GET:GET etab1LATEFIELDS v1 ...GET CURSOR FIELD fOFFSET v1LINE v1VALUE v1LENGTH v1GET CURSOR LINE linOFFSET v1VALUE v1LENGTH v1GET TIMEGET RUN TIMEGET RUN TIME FIELD v1GET PARAMETER ID key1 FIELD v1GET PROPERTY OF name1 attrib2 = v3NO FLUSHGROUP-BY:GROUP BY v1 v2 ...GROUP BY (tabla1)HIDE:HIDE lin_v1IF:IF v1 EQ v2stm1ELSEstm2ENDIFIF v1 EQ v2IF v1 LT v2IF v1 GT v2IF v1 IS INITIALIF v1 IS REQUESTEDIF v1 logexp1IF v1 logexp2IF exp1 AND exp2 ...IF exp1 OR exp2 ...IF exp1 NOT exp2 ...IF v1 CA v2IF v1 NA v2IF v1 CO v2IF v1 CN v2IF v1 CP v2IF v1 NP v2IF v1 CS v2IF v1 NS v2IF v1 MIF v1 OIF v1 ZIMPORT:IMPORT v1 tabla2 ... FROM DATABASE etab3(ar4) ID key5TO v6 ...MAJOR-ID maj1 ...MAJOR-ID maj1 MINOR-ID min2CLIENT hUSING form_name1IMPORT DIRECTORY INTO tabla1 FROM DATABASE etab2(ar3) ID key4 CLIENT cl1IMPORT v1 tabla2 ... FROM LOGFILE ID key3TO v4IMPORT DYNPRO head1 tabla2 logik3 matchc4 ID id5IMPORT v1 tabla2 ... FROM MEMORYTO v3 ...ID keyIMPORT v1 tabla2 ... FROM SHARED BUFFER etab3(ar4) ID key5 TO v6CLIENT cl6INCLUDE:INCLUDE STRUCTURE rec1INCLUDE TYPE typename1INCLUDE pname1INFOTYPES:INFOTYPES: n1NAME v1OCCURS n1MODE m1VALID FROM begdt1 TO enddt2INITIALIZATION:INITIALIZATIONINPUTINSERT:INSERT etab1CLIENT SPECIFIEDINSERT etab1 FROM work2INSERT etab1 FROM TABLE tabla1ACCEPTING DUPLICATE KEYSINSERT INTO etab1CLIENT SPECIFIEDVALUES wb2INSERT (etab)CLIENT SPECIFIEDINSERT (etab) FROM work2INSERT (etab) FROM TABLE tabla1ACCEPTING DUPLICATE KEYSINSERT INTO (etab1)CLIENT SPECIFIEDVALUES wb2INSERT tabla1INSERT tabla1 INDEX ix2INSERT work1 INTO tabla2INSERT work1 INTO tabla2 INDEX ix3INSERT INITIAL LINE INTO tabla2INSERT LINES OF tabla1 INTO tabla2INSERT LINES OF tabla1 FROM ix1 INTO tabla2INSERT LINES OF tabla1 FROM ix1 TO ix2 INTO tabla2INSERT LINES OF tabla1 FROM ix1 TO ix2 INTO tabla2 INDEX ix3 INSERT REPORT name FROM tablaINSERT TEXTPOOL name FROM tabla LANGUAGE l1INSERT Field groupsINSERT v1 v2 ... INTO fgroup3INTO:INTO area1INTO CORRESPONDING FIELDS OF area1INTO (v1, v2, ...)INTO TABLE tabla1PACKAGE SIZE n1INTO CORRESPONDING FIELDS OF TABLE tabla1PACKAGE SIZE n1APPENDING TABLE tabla1PACKAGE SIZE n1APPENDING CORRESPONDING FIELDS OF TABLE tabla1PACKAGE SIZE n1LEAVE:LEAVELEAVE PROGRAMLEAVE TO TRANSACTION tac1AND SKIP FIRST SCREENLEAVE TO SCREEN dynp1LEAVE SCREENLEAVE TO LIST-PROCESSINGAND RETURN TO SCREEN dynp1LEAVE LIST-PROCESSINGLOAD:LOAD REPORT pnam1 PART 'HEAD' INTO tabla2LOAD REPORT pnam1 PART 'TRIG' INTO tabla2LOAD REPORT pnam1 PART 'CONT' INTO tabla2LOAD REPORT pnam1 PART 'DATA' INTO tabla2LOAD REPORT pnam1 PART 'DDNM' INTO tabla2LOAD REPORT pnam1 PART 'DATV' INTO tabla2LOAD REPORT pnam1 PART 'SELC' INTO tabla2LOAD REPORT pnam1 PART 'STOR' INTO tabla2LOAD REPORT pnam1 PART 'LITL' INTO tabla2LOAD REPORT pnam1 PART 'SYMB' INTO tabla2LOAD REPORT pnam1 PART 'LREF' INTO tabla2LOAD REPORT pnam1 PART 'SSCR' INTO tabla2LOAD REPORT pnam1 PART 'BASE' INTO tabla2 LOAD REPORT pnam1 PART 'INIT' INTO tabla2LOAD REPORT pnam1 PART 'DATP' INTO tabla2 LOAD REPORT pnam1 PART 'TXID' INTO tabla2LOAD REPORT pnam1 PART 'COMP' INTO tabla2LOCAL:LOCAL v1LOOP:LOOP AT tabla1WRITE: /1 tabla1-f1ENDLOOPLOOP AT tablaFROM n1TO n2WHERE logexp1TRANSPORTING NO FIELDSLOOP AT tabla INTO waFROM n1TO n2WHERE logexp1TRANSPORTING NO FIELDSLOOP AT SCREENMESSAGE:MESSAGE msgnr1WITH v1 v2 ...RAISING exc1MESSAGE ID id1 TYPE mtyp2 NUMBER mnr3WITH v1 v2 ...MODIFY:MODIFY etabMODIFY *etabMODIFY (etab_name1)FROM area1CLIENT SPECIFIEDMODIFY etab1 FROM TABLEMODIFY etab1 FROM TABLE tabla2MODIFY (etab-name1) FROM TABLE tabla2CLIENT SPECIFIEDMODIFY tabla1INDEX ix3TRANSPORTING v4 v5 ...WHERE logexp6MODIFY tabla1 FROM wk2MODIFY LINE n1INDEX ix1LINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY LINE n1 OF CURRENT PAGELINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY LINE n1 OF PAGE m2LINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY CURRENT LINELINE FORMAT lfmt1 lfmt2 ...FIELD VALUEFIELD FORMATMODIFY SCREENMODULE:MODULE mname1stm1ENDMODULEMODULE mname1OUTPUTINPUTMOVE:MOVE v1 TO v2MOVE v1+off1(len1) TO v2+off2(len2) MOVE v1 TO v2 PERCENTAGE v3RIGHTLEFTRIGHTMOVE-CORRESPONDING rec1 TO rec2MULTIPLY:MULTIPLY v1 BY v2MULTIPLY-CORRESPONDING r1 BY r2NEW-LINE:NEW-LINENO-SCROLLINGSCROLLINGNEW-PAGE:NEW-PAGE PRINT ONARCHIVE MODE armodeARCHIVE PARAMETERS arparamsARCHIVE PARAMETERS arparamsCOPIES n1COVER TEXT litDATASET EXPIRATION daysDEPARTMENT name1DESTINATION dest1IMMEDIATELY flagKEEP IN SPOOL flagLAYOUT layer1LINE-COUNT l1LINE-SIZE c1LIST AUTHORITY auth1LIST DATASET dsnameLIST NAME nameNEW LIST IDENTIFICATION flagNEW-SECTIONNEW-SECTIONNO DIALOGNO DIALOGPARAMETERS para1RECEIVER r1SAP COVER PAGE m1NEW-PAGELINE-COUNT lin1LINE-SIZE c1NO-HEADINGNO-TITLEWITH-HEADINGWITH-TITLEPRINT ON ...PRINT OFFON:ON CHANGE OF v1stm1ENDONON CHANGE OF v1OR v1 ...OPEN DATASET:OPEN DATASET name1AT POSITION pos1FILTER bsFOR APPENDINGFOR INPUTFOR OUTPUTIN BINARY MODEIN TEXT MODEMESSAGE msg1TYPE t1OPEN CURSOR:OPEN CURSOR c1 FOR SELECTWITH HOLDORDER-BY:ORDER BY PRIMARY KEYORDER BY v1 v2 ...ORDER BY (tabla)OVERLAY:OVERLAY v1 WITH v2ONLY v3PACK:PACK v1 TO v2PARAMETERS:PARAMETERS p1AS CHECKBOXDEFAULT valueFOR TABLE etab1LIKE v1LOWER CASEMATCHCODE OBJECT objname1MEMORY ID mid1MODIF ID key1NO-DISPLAYOBLIGATORYTYPE typ1DECIMALS n1RADIOBUTTON GROUP radbut1FOR TABLE etab1AS MATCHCODE STRUCTUREVALUE-REQUESTHELP-REQUESTPERFORM:PERFORM form IN PROGRAM progCHANGING p1 p2 p3 ...IF FOUNDTABLES tabla1 tabla2 ...USING p1 p2 p3 ...PERFORM form1(prog2)CHANGING p1 p2 p3 ...IF FOUNDTABLES tabla1 tabla2 ...USING p1 p2 p3 ...PERFORM form1USING p1 p2 p3 ...CHANGING p1 p2 p3 ...TABLES tabla1 tabla2 ...PERFORM n OF form1 form2 form3 ...PERFORM n ON COMMITLEVEL v1POSITION:POSITION colPRINT-CONTROL:PRINT-CONTROLCPI cpi1LPI lpi1SIZE size1COLORBLACKBLUEGREENYELLOWPINKLEFT MARGIN col1FONT font1FUNCTION v1LINE linPOSITION colPRINT-CONTROL INDEX-LINE fPROGRAM:PROGRAMPROVIDE:PROVIDE v1 v2 FROM itab3v4 v5 FROM itab6BETWEEN v7 AND v8ENDPROVIDEPUT:PUT etab1RAISE:RAISE expt1RANGES:RANGES sel FOR fOCCURS occ*-------------------------------------------------------------------------- READ:READ LINE l1FIELD VALUE v1 INTO v2INDEX ixREAD LINE lin OF CURRENT PAGEREAD LINE lin OF PAGE pagREAD CURRENT LINEREAD TABLE etab. " (-> old)READ TABLE tabla1BINARY SEARCHCOMPARING ALL FIELDSCOMPARING v1 v2 ...TRANSPORTING NO FIELDSTRANSPORTING v1 v2 ...WITH KEY keyWITH KEY key BINARY SEARCHWITH KEYWITH KEY = value1READ TABLE tabla INTO area1BINARY SEARCHCOMPARING ALL FIELDSCOMPARING v1 v2 ...INDEX ix1TRANSPORTING NO FIELDSTRANSPORTING v1 v2 ...WITH KEY keyWITH KEY key BINARY SEARCHWITH KEYWITH KEY = value1READ REPORT prog INTO tabla1READ TEXTPOOL prog INTO tabla LANGUAGE l1READ DATASET dsnname1 INTO wk2LENGTH lenRECEIVE:RECEIVE RESULTS FROM FUNCTION funcIMPORTINGTABLESEXCEPTIONSREFRESH:REFRESH tabla1 FROM SELECT-OPTIONSREFRESH tabla1 FROM TABLE etab2 "-> oldREFRESH tabla1REFRESH CONTROL ctrl FROM SCREEN dynpr2REJECT:REJECT etab1REPLACE:REPLACE v1 WITH v2 INTO v3LENGTH len1*-------------------------------------------------------------------------- REPORT:REPORT repname1NO STANDARD PAGE HEADINGLINE-SIZE colLINE-COUNT lin(n)MESSAGE-ID xxDEFINING DATABASE ldb*-------------------------------------------------------------------------- RESERVE:RESERVE n LINES*-------------------------------------------------------------------------- ROLLBACK:ROLLBACK WORK*-------------------------------------------------------------------------- SCAN:SCAN ABAP-SOURCE tabla1 ... TOKENS INTO tabla2 ...FROM v1TO v1KEYWORDS FROM tabla1LEVELS INTO tabla1OVERFLOW INTO tabla1WITH ANALYSISWITH COMMENTSWITH INCLUDESWITHOUT TRMACPROGRAM FROM v1INCLUDE INTO v1MESSAGE INTO v1WORD INTO v1LINE INTO v1OFFSET INTO v1*-------------------------------------------------------------------------- SCROLL:SCROLL LIST TO FIRST PAGEINDEX ix1LINE lin1SCROLL LIST TO LAST PAGEINDEX ix1LINE lin1SCROLL LIST TO PAGE pagINDEX ix1LINE lin1SCROLL LIST TO COLUMN colINDEX ix1LINE lin1SCROLL LIST FORWARDINDEX ix1n1 PAGESSCROLL LIST BACKWARDINDEX ix1n1 PAGESSCROLL LIST LEFTINDEX ix1BY n1 PLACESSCROLL LIST RIGHTINDEX ix1BY n1 PLACESSEARCH:SEARCH v1 FOR v2ABBREVIATEDSTARTING AT n1ENDING AT n2AND MARKSEARCH tabla1 FOR v2ABBREVIATEDSTARTING AT n1ENDING AT n2AND MARK*-------------------------------------------------------------------------- SELECT:SELECT {AutoSelect}SELECT * FROM etabWHERE etab_v1 EQ v2AND etab_v3 EQ v4ENDSELECTSELECT etab_v1 etab_v2etab_v3 etab_v3FROM etabWHERE etab_v1 EQ v2AND etab_v3 EQ v4ENDSELECTSELECT * INTO wrk1FROM etabWHERE etab_v1 EQ v2AND etab_v3 EQ v4ENDSELECTSELECT * FROM etab1WHERE etab_v1 EQ v2AND etab_v3 EQ v4ORDER BY PRIMARY KEYENDSELECTSELECT * FROM etab1CLIENT SPECIFIEDBYPASSING BUFFERUP TO n5 ROWSWHERE etab_v1 EQ v2AND etab_v3 EQ v4ENDSELECTSELECT SINGLE * FROM etabWHERE etab_v1 EQ v2AND etab_v3 EQ v4SELECT *SELECT SINGLE *SELECT SINGLE FOR UPDATE *SELECT DISTINCT *SELECT etab_v1 ...SELECT SINGLE etab_v1 ...SELECT SINGLE FOR UPDATE etab_v1 ...SELECT DISTINCT etab_v1 ...SELECT (tabla1)SELECT SINGLE (tabla)SELECT SINGLE FOR UPDATE (tabla)SELECT DISTINCT (tabla)*-------------------------------------------------------------------------- INTO de SELECT:INTO wrk1INTO CORRESPONDING FIELDS OF wrk1INTO (v1, v2 ...)INTO TABLE tabla1PACKAGAE SIZEINTO CORRESPONDING FIELDS OF TABLE tablaPACKAGAE SIZEINTO APPENDING TABLE tablaPACKAGAE SIZEINTO APPENDING CORRESPONDING FIELDS OF TABLE tablaPACKAGAE SIZE*--------------------------------------------------------------------------FROM de SELECT:FROM etab1CLIENT SPECIFIEDBYPASSING BUFFERUP TO n1 ROWSFROM (etab1)CLIENT SPECIFIEDBYPASSING BUFFERUP TO n1 ROWS*--------------------------------------------------------------------------WHERE de SELECT:WHERE where_conditionWHERE NOT where_conditionWHERE wherebedinung AND where_conditionWHERE wherebedinung OR where_conditionFOR ALL ENTRIES IN tabla1 WHERE where_conditionFOR ALL ENTRIES IN tabla1 WHERE NOT where_conditionFOR ALL ENTRIES IN tabla1 WHERE where_condition AND where_condition FOR ALL ENTRIES IN tabla1 WHERE where_condition OR where_conditionSELECT ... where_condici?FOR ALL ENTRIES IN tabla1WHERE f1 = v1WHERE f1 EQ v1WHERE f1 NE v1WHERE f1 <> v1WHERE f1 >< v1WHERE f1 LT v1WHERE f1 < v1WHERE f1 LE v1WHERE f1 <= v1WHERE f1 =< v1WHERE f1 GT v1WHERE f1 > v1WHERE f1 GE v1WHERE f1 >= v1WHERE f1 => v1WHERE f1BETWEEN v1 AND v2LIKE v1IN tabla1IN (v2, v3, ...)WHERE f1 NOTBETWEEN v1 AND v2LIKE v1IN tabla1IN (v2, v3, ...)WHERE f1 IS NULLWHERE f1 IS NOT NULLGROUP-BY de SELECT:GROUP BY v1 v2 ...HAVING wherecondGROUP BY (tabla)HAVING wherecond*-------------------------------------------------------------------------- ORDER-BY de SELECT:ORDER BY PRIMARY KEYORDER BY v1 v2 ...ORDER BY (tabla1)*-------------------------------------------------------------------------- SELECT-OPTIONS:SELECT-OPTIONS sel1 FOR v2DEFAULT lit1DEFAULT lit1 ... OPTION op2 ... SIGN ie3DEFAULT lit1 TO lit2DEFAULT lit1 TO lit1 OPTION op2 ... SIGN ie3MEMORY ID spa1MATCHCODE OBJECT mtch1MODIF ID scrg1NO-DISPLAYLOWER CASEOBLIGATORYNO-EXTENSIONNO INTERVALSNO DATABASE SELECTIONVALUE-REQUESTVALUE-REQUEST FOR LOW/HIGHHELP-REQUESTHELP-REQUEST FOR LOW/HIGH*-------------------------------------------------------------------------- SELECTION-SCREEN:SELECTION-SCREEN BEGIN OF LINESELECTION-SCREEN END OF LINESELECTION-SCREEN SKIP n1FOR TABLE etab1ID id1SELECTION-SCREEN ULINEpos1FOR TABLE etab1MODIF ID scr1ID id1SELECTION-SCREEN POSITION pos1FOR TABLE etab1SELECTION-SCREEN COMMENT fmt nameFOR TABLE etab1FOR FIELD v1MODIF ID scr1ID id1SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom FOR TABLE etab1MODIF ID scr1ID id1SELECTION-SCREEN BEGIN OF BLOCK blck1WITH FRAMETITLE titl1NO INTERVALSSELECTION-SCREEN END OF BLOCK blck1SELECTION-SCREEN FUNCTION KEY n1_5FOR TABLE etab1ID id1SELECTION-SCREEN BEGIN OF VERSION ver TEXT-xxxSELECTION-SCREEN END OF VERSION verSELECTION-SCREEN EXCLUDE ...PARAMETERS parSELECT-OPTIONS selRADIOBUTTON GROUPS radiBLOCKS blockIDS idSELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE dbtab SELECTION-SCREEN FIELD SELECTION FOR TABLE dbtab*-------------------------------------------------------------------------- SET:SET BLANK LINES ONSET BLANK LINES OFFSET COUNTRY count1SET CURSOR FIELD v1OFFSET off1LINE lin1SET CURSOR LINE lin1OFFSET off1SET CURSOR col1 lin2SET EXTENDED CHECKSET LANGUAGE langu1SET LOCALE LANGUAGE lgCOUNTRY cout1MODIFIER m1SET MARGIN vcol1 vlin2SET PARAMETER ID pid1 FIELD v2SET PF-STATUS pf1EXCLUDINGIMMEDIATELYSET PROPERTY OF obj1 attrb2 = v3NO FLUSHSET RUN TIME ANALYZER ONSET RUN TIME ANALYZER OFFSET SCREEN dynnr1SET LEFT SCROLL-BOUNDARYCOLUMN col1SET TITLEBAR titl1WITH &1 &2 ...SET UPDATE TASK LOCALSET USER-COMMAND lit1*-------------------------------------------------------------------------- SHIFT:SHIFT v1CIRCULARLEFTRIGHTSHIFT r1 BY n PLACESCIRCULARLEFTRIGHTSHIFT r1 UP TO r2CIRCULARLEFTRIGHTSHIFT v1 LEFT DELETING LEADING c1SHIFT v1 RIGHT DELETING TRAILING c1*-------------------------------------------------------------------------- SKIP:SKIP TO LINE l1SKIP n*-------------------------------------------------------------------------- SORT:SORTBY v1 v2 ...ASCENDINGDESCENDINGAS TEXTSORT tabla1BY v1 v2 ...ASCENDINGDESCENDINGAS TEXT*-------------------------------------------------------------------------- SPLIT:SPLIT v1 AT v2 INTO targ1 targ2SPLIT f AT g INTO TABLE tabla*-------------------------------------------------------------------------- START-OF-SELECTION:START-OF-SELECTION*-------------------------------------------------------------------------- STATICS:。
abap基本语法汇总
一数据类型和对象在ABAP中,可以使用与标准数据声明相似的语法处理数据类型,而与数据对象无关。
在程序中必须声明要使用的全部数据对象。
声明过程中,必须给数据对象分配属性,其中最重要的属性就是数据类型。
1.1 基本数据类型对算术运算的非整型结果(如分数)进行四舍五入,而不是截断。
类型 P 数据允许在小数点后有数字。
有效大小可以是从 1 到 16 字节的任何值。
将两个十进制数字压缩到一个字节,而最后一个字节包含一个数字和符号。
在小数点后最多允许14 个数字。
1.2 系统定义的数据对象1.3 确定数据对象的属性如果要查明数据对象的数据类型,或者要在程序的运行期间使用其属性,可使用DESCRIBE 语句。
语法如下:DESCRIBE FIELD <f> [LENGTH <l>] [TYPE <t> [COMPONENTS <n>]][OUTPUT-LENGTH <o>] [DECIMALS <d>][EDIT MASK <m>].将由语句的参数指定的数据对象<f>的属性写入参数后的变量。
DESCRIBE FIELDS 语句具有下列参数:1.3.1 确定字段长度要确定数据对象的长度,利用DESCRIBE FIELD 语句使用 LENGTH 参数,如下所示:DESCRIBE FIELD <f> LENGTH <l>.系统读取字段<f>的长度,并将值写入字段<l>。
1.3.2确定数据类型要确定字段的数据类型,利用DESCRIBE FIELD 语句使用 TYPE 参数,如下所示:DESCRIBE FIELD <f> TYPE <t> [COMPONENTS <n>].系统读取字段<f>的数据类型,然后将值写入字段<t>。
ABAP语法完整版
SAP ABAP / 4 基础知识学习数据类型C :字符串D :日期型格式为YYYYMMDD 例:'1999/12/03'F : 浮点数长度为8I :整数N :数值组成的字符串如:011,'302'P : PACKED数用于小数点数值如:12.00542T : 时间格式为:HHMMSS 如:'14:03:00'X : 16进制数如:'1A03'*-------------------------------------------------------------------------------------* 变量声明DATA <F> [<Length>] <type> [<value>][decimals]<F>变量名称<length><type>变量类型及长度<value>初值<decimals>小数位数exp:DATA : COUNTER TYPE P DECIMALS 3.NAME(10) TYPE C VALUE 'DELTA'.S_DATE TYPE D VALUE '19991203'.exp:DATA : BEGIN OF PERSON,NAME(10) TYPE C,AGE TYPE I,WEIGHT TYPE DECIMALS 2,END OF PERSON.另外,有关DATA声明的指令还有: CONSTANTS(声明常数)、STATICS(临时变量声明). exp:CONSTANTS PI TYPE P DECIMALS 5 VALUE '3.14159'.STATICS 关键字声明的变量仅在目前的程序中使用, 结束后会自动释放语法:STATICS <c> [<length>] <type> [<value>] [<decimals>]系统专用变量说明系统内部专门创建了SYST这个STRUCTURE,里面的栏位存放系统变量,常用的系统变量有: SY-SUBRC: 系统执行某指令后,表示执行成功与否的变量,'0'表示成功SY-UNAME: 当前使用者登入SAP的USERNAME;SY-DATUM: 当前系统日期;SY-UZEIT: 当前系统时间;SY-TCODE: 当前执行程序的Transaction codeSY-INDEX: 当前LOOP循环过的次数SY-TABIX: 当前处理的是internal table 的第几笔SY-TMAXL: Internal table的总笔数SY-SROWS: 屏幕总行数;SY-SCOLS: 屏幕总列数;SY-MANDT: CLIENT NUMBERSY-VLINE: 画竖线SY-ULINE: 画横线TYPE 关键字用来指定资料型态或声明自定资料型态Example:TYPES: BEGIN OF MYLIST,NAME(10) TYPE C,NUMBER TYPE I,END OF MYLIST.DATA LIST TYPE MYLIST.LIKE 关键字跟TYPE关键字使用格式相同, 如DATA TRANSCODE LIKE SY-TCODE.不同的是LIKE 用在已有值的资料项, 如系统变量, 而TYPE关键字则是用在指定资料型态。
abap 初始化对象语法
abap 初始化对象语法
在ABAP中,初始化对象有几种不同的语法。
首先,我们可以使用NEW关键字来初始化对象。
例如,如果我们有一个类叫做
CL\_MY\_CLASS,我们可以使用以下语法来初始化一个该类的对象:
DATA: lo\_object TYPE REF TO cl\_my\_class.
CREATE OBJECT lo\_object.
另一种初始化对象的方法是使用构造方法。
在类中定义了构造方法(通常是PUBLIC SECTION下的方法),我们可以在实例化对象的同时调用构造方法来初始化对象的状态。
例如:
DATA: lo\_object TYPE REF TO cl\_my\_class.
lo\_object = NEW cl\_my\_class( parameter1 = value1 parameter2 = value2 ).
此外,我们还可以使用工厂方法来初始化对象。
工厂方法是一种在类中定义的方法,用于创建对象实例并返回对该实例的引用。
例如:
DATA: lo\_object TYPE REF TO if\_my\_interface.
lo\_object = cl\_my\_factory=>create\_object( ).
总之,在ABAP中,我们可以使用NEW关键字、构造方法和工厂方法来初始化对象,具体取决于我们的需求和设计。
希望这些信息能够帮助到你理解ABAP中对象的初始化语法。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
SAP ABAP / 4 基础知识学习数据类型C :字符串D :日期型格式为 YYYYMMDD 例:'1999/12/03'F : 浮点数长度为8I :整数N :数值组成的字符串如:011,'302'P : PACKED数用于小数点数值如:12.00542T : 时间格式为:HHMMSS 如:'14:03:00'X : 16进制数如:'1A03'*-------------------------------------------------------------------------------------* 变量声明DATA <F> [<Length>] <type> [<value>][decimals]<F> 变量名称<length><type> 变量类型及长度<value> 初值<decimals> 小数位数exp:DATA : COUNTER TYPE P DECIMALS 3.NAME(10) TYPE C VALUE 'DELTA'.S_DATE TYPE D VALUE '19991203'.exp:DATA : BEGIN OF PERSON,NAME(10) TYPE C,AGE TYPE I,WEIGHT TYPE DECIMALS 2,END OF PERSON.另外,有关DATA声明的指令还有: CONSTANTS(声明常数)、STATICS(临时变量声明).exp:CONSTANTS PI TYPE P DECIMALS 5 VALUE '3.14159'.STATICS 关键字声明的变量仅在目前的程序中使用, 结束后会自动释放语法:STATICS <c> [<length>] <type> [<value>] [<decimals>]系统专用变量说明系统内部专门创建了SYST这个STRUCTURE,里面的栏位存放系统变量,常用的系统变量有: SY-SUBRC: 系统执行某指令后,表示执行成功与否的变量,'0'表示成功SY-UNAME: 当前使用者登入SAP的USERNAME;SY-DATUM: 当前系统日期;SY-UZEIT: 当前系统时间;SY-TCODE: 当前执行程序的Transaction codeSY-INDEX: 当前LOOP循环过的次数SY-TABIX: 当前处理的是internal table 的第几笔SY-TMAXL: Internal table的总笔数SY-SROWS: 屏幕总行数;SY-SCOLS: 屏幕总列数;SY-MANDT: CLIENT NUMBERSY-VLINE: 画竖线SY-ULINE: 画横线TYPE 关键字用来指定资料型态或声明自定资料型态Example:TYPES: BEGIN OF MYLIST,NAME(10) TYPE C,NUMBER TYPE I,END OF MYLIST.DATA LIST TYPE MYLIST.LIKE 关键字跟TYPE关键字使用格式相同, 如DATA TRANSCODE LIKE SY-TCODE.不同的是 LIKE 用在已有值的资料项, 如系统变量, 而TYPE关键字则是用在指定资料型态。
TABLES 关键字用来声明 Table Work Area 的数据, 对应至 ABAP/4 资料文件(Dictionary Object), 由SQL 指令加载所需数据语法:TABLES <dbtab>Example:TABLES: SPFL.SELECT * FROM SPFL.WRITE: SPFL-MANDT, SPFL-CARRID,SPFL-CONNECTION.ENDSELECT.从ABAP/4 Dictionary 的 SPFL 档载入MANDT,CARRID,CONNECTION 三个字段至SPFL 此Table Work Area*-------------------------------------------------------------------------------------*输出一. WRITE 语句ABAP/4用来在屏幕上输出资料的指令是WRITE指令,例如:WRITE: 'USER NAME IS:', SY-UNAME.二. 指定屏幕输出位置指定输出位置的语句格式为:WRITE: [AT] [ / ] [<pos>] [(<len>)] 资料项 [<par>]其中: / : 在下一行输出<pos>: 指定输出的行号;(<len>):指定输出位数(长度)<par>: 指定显示格式参数,参数有:LEFT-JUSTIFIED 资料*左对齐CENTERED 资料*中间对齐RIGHT-JUSTIFIED 资料*右对齐UNDER <g> 正对在资料项<g>的下面显示NO-GAP 紧接着显示,不留空格USING EDIT MASK <m>: 使用内嵌子元显示, 如 12:03:20USING NO EDIT MASK: 不使用内嵌子元NO-ZER 数字前面 0 的部分不显示NO-SIGN: 不显示正负号DECIMALS <d>: 显示 <d> 位小数EXPOENT <e>: F(浮点数)指数的值ROUND <r>: 四舍五入至小数点后<r>位CURRENCY <c>: 币别显示DD/MM/YY : 日期显示格式MM/DD/YY:YY/MM/DD:YY/DD/MMMM/DD/YYYY:DD/MM/YYYYYYYY/MM/DD:YYYY/DD/MM:例如1: WRITE: /10(6) 'ABCDEFGHIJK'.输出结果为: ABCDEF例如2: DATA: X TYPE I VALUE '11:20:30',A(5) TYPE C VALUE 'AB CDE'.WRITE: / X USING EDIT MASK '__:__:__'.WRITE: / X USING EDIT MASK '$___,___'.WRITE: / Y NO-GAP.输出结果为:11:20:30$112,030ABCDEF例如3: DATA: LEN TYPE I VALUE 10,POS TYPE I VALUE 11,TEXT(10) VALUE '1234567890'WRITE 'The text ------------ appears in the text.'.WRITE AT POS(LEN) TEXT.WRITE TO 语句的基本形式要将值(文字)或源字段内容写入目标字段,可以使用 WRITE TO 语句:语法WRITE <F1> TO <F2> [<option>].DATA: NUMBER TYPE F VALUE '4.3',TEXT(10),FLOAT TYPE F,PACK TYPE P DECIMALS 1.WRITE NUMBER.WRITE NUMBER TO TEXT EXPONENT 2.WRITE / TEXT.WRITE NUMBER TO FLOAT.WRITE / FLOAT.WRITE NUMBER TO PACK.WRITE / PACK.MOVE NUMBER TO PACK.WRITE / PACK.exp:DATA: NAME(10) VALUE 'SOURCE',SOURCE(10) VALUE 'Antony',TARGET(10)....WRITE (NAME) TO TARGET.WRITE: TARGET.exp :DATA: COUNTER TYPE I.COMPUTE COUNTER = COUNTER + 1.COUNTER = COUNTER + 1.ADD 1 TO COUNTER.在此,三条运算语句进行相同算术运算输出屏幕上的线和空行用下列语法,可以在输出屏幕上生成水平线:语法ULINE [AT [/][<pos>][(<len>)]].它等同于WRITE [AT [/][<pos>][(<len>)]] SY-ULINE.AT 后的格式规范,与在在屏幕上定位 WRITE 输出(页 28)中为 WRITE 语句说明的格式规范完全一样。
如果没有格式规范,系统则开始新的一行,并用水平线填充该行。
否则,只按指定输出水平线。
生成水平线的另一种方法,是在 WRITE 语句中键入恰当数量的连字符,如下所示:WRITE [AT [/][<pos>][(<len>)]] '-----...'.垂直线用下列语法,可以在输出屏幕上生成垂直线:语法WRITE [AT [/][<pos>]] SY-VLINE.或WRITE [AT [/][<pos>]] '|'.空行用下列语法,可以在输出屏幕上生成空行:语法SKIP [<n>].该语句从当前行开始,在输出屏幕上生成 <n> 个空行。
如果没有指定 <n> 的值,就输出一个空行。
要将输出定位在屏幕的指定行上,请使用:语法SKIP TO LINE <n>.该语句允许将输出位置向上或向下移动。
四. 显示图示:语法: WRITE: <symbol-name> AS SYMBOL.WRITE: <icon-name> AS ICON.例如: INCLUDE <SYMBOL>.INCLUDE <ICON>.WRITE: / 'Phone symbol:', SYM_PHONE AS SYMBOL.WRITE: / 'Alarm Icon:', ICON_VOICE_OUTPUT AS ICON.要查看系统所提供有那些符号及图示,可选择'EDIT'下的'Insert Statement',选择'Write',接下来选择要查看的群组,如SYMBOL 或ICON, 接下来按'Display'即可.*-------------------------------------------------------------------------------------*一. Internal Table 的声明ABAP/4中的Internal Table是一种Data Structure,类似于其他语言中的STRUTURE,它可以由几个不同类型的栏位(field)组成,用来表示具有不同属性的某一事物,单独一笔资料表示某个事物,多笔资料表示具有相同属性的多个事物.Internal table 的定义有以下几种格式:格式一. DATA: BEGIN OF <internal table> OCCURS <n>,<field 1> TYPE <type1>,[<field 2> TYPE <type 2>,<field 3> TYPE <type 3>,… ]END OF <internal table>.语法:DATA <f> <type> OCCURS <n> [WITH HEADER LINE]Example:DATA VECTOR TYPE I OCCURS 10 WITH HEADER LINE.格式二. TYPES: BEGIN OF <work area>,<field 1> TYPE <type1>,[<field 2> TYPE <type 2>,<field 3> TYPE <type 3>,… ]END OF <work area>.TYPES <internal table> TYPE <work area> OCCURS <n>.格式三. DATA: BEGIN OF <work area>.INCLUDE STRUCTURE <table name>.DATA: END OF <work area>.DATA: <internal table> LIKE <work area> OCCURS <n>.exp:TYPES VECTOR TYPE I OCCURS 10.TYPES: BEGIN OF LINE,COLUMN1 TYPE I,COLUMN2 TYPE I,COLUMN3 TYPE I,END OF LINE.TYPES ITAB TYPE LINE OCCURS 10.TYPES: BEGIN OF DEEPLINE,TABLE1 TYPE VECTOR,TABLE2 TYPE ITAB,END OF DEEPLINE.TYPES DEEPTABLE TYPE DEEPLINE OCCURS 10.本示例创建与上例相同的内表数据类型(VECTOR 和 ITAB)。