ABAP 內錶定義

2021-10-05 20:27:57 字數 1875 閱讀 3243

表是記憶體中建立的乙個臨時表,你可以在程式執行時對錶中的資料進行,插入,修改,刪除等操作,程式跑完了,就會被釋放。

內錶共有3種型別:

1.  

standard:標準表 ,

一般用的比較多

2.  

sorted

:排序表

3. 

hashed

:雜湊表,一般用的比較少

工作區:內錶按照行進行訪問,必須使用

某個區域(工作區)

作為與**互相傳輸的介面。

注意:1、從內錶中讀取資料時,已定址的行內容覆蓋工作區的原有內容。

2、資料寫入內錶時,必須首先在工作區中輸入資料,再將工作區資料寫入內錶。

1、types

types自定義的表型別來定義內錶

types  type occurs 

types type table of

with header line :  定義

了帶工作區的內錶

例項:types: begin of line,    "

定義結構陣列型別       

acol1 type i,       

acol2 type i,       

end of line.

types: itabt type lineoccurs 10.                  "

定義表型別

data:    itabx type itabtwith header line.     "

定義帶工作區的內錶,工作區名稱與內錶名稱相同

2、data

data直接定義內錶:

data: begin of occurs  ……

end of

itab.

例項:data: begin of itaboccurs 0,         "自帶工作區的內錶,工作區名稱與內錶名稱相同

acol1 type i,      

acol2 type i,      

end of itab.

3、參考定義

參照內錶或資料庫表結構定義內錶,內錶結構與所參照資料庫表完全相同:

data  like  <

內錶或資料庫表

> occurs n with header line •

with

引數指定是否帶工作區

使用include structure包括已存在的結構體的所有字段

例項:

1、data: itab like spfli occurs 0 with header line.

2、  data: begin of itab occurs 0.  "

自帶同名工作區

, itab

是定義的內錶

include structure spfli.  "ztable1

是參照的資料庫表

data: name(20) type c,

*** type c.

data: end of itab.

關於ABAP內錶

1.內錶的型別及定義 1 any table 即任意表型別,此種定義方式只能在傳遞引數的時候定義。例如 form using changing type any table 2 any table包括了兩種型別 index table和hashed table 1 index table 包括了st...

ABAP動態內錶

定義的動態內錶,對應內錶一行的工作區 field symbols type standard table type any.form create dynamic table data lt fcat type slis t fieldcat alv,ls fcat like line of lt ...

ABAP 內錶總結 1

一 內錶是什麼 用處 當程式中處理有固定結構的資料時候,就需要使用內錶,特別是內錶是在程式中儲存資料庫表的載體。內錶 internal memory table 記憶體中的表,是外設 螢幕 磁碟,印表機等 和資料庫表資料交換的中介。注意 在abap語言中不提供二維陣列,內錶相當於二維陣列,它是乙個表...