abap開發內錶基礎知識總結

2021-07-10 08:49:15 字數 2071 閱讀 8804

1.定義乙個結構體

data: begin of ls_mastnr,

matnr type matnr,

maktx type maktx,

end of ls_matnr.

2.定義乙個包含表頭的內錶

data: begin of ls_mat occurs 0,

matnr type matnr,

maktx type maktx,

end of ls_mat.

3.參考資料結構來定義內錶1

data: lt_mat like table of ls_matnr with header line.

4.參考資料結構來定義內錶2

data:begin of lt_matnr occurs 0.

include structure ls_matnr.

data:end of lt_matnr.

5.常量定義

constants:l_str(10) type c value 'hello world'.

6.ranges 建立選擇型內錶

ranges: r_mat for mara-matnr.

data: begin of r_mat occurs 0,

sign type c length 1,

option type c length 1,

low type mara-matnr,

high type mara-matnr,

end of r_mat.

7.like、like line of、like table of、type、type standard table of之間的區別

like後接data型別的變數,可以是自定義變數,也可以是系統變數

like line of 後接內錶,表示定義乙個工作區。a like line of b,b是內錶,a是工作區

like table of 後接工作區,表示定義乙個內錶,such as:

data: begin of wa_itab,

matnr type mara-matnr,

maktx type mara-maktx,

end of wa_itab."不加occurs 0表示定義的工作區,加上表示定義的內錶,此處是工作區

data:it_tab like table of wa_itab."定義乙個內錶

type 後接自定義資料型別,可以是基本資料型別c、i、n,也可以是自定義資料型別,such as:

types:bengin of ty_itab,

matnr type mara-matnr,

maktx type mara-maktx,

end of ty_itab.

data: it_tab types standard table ty_itab,"定義乙個內錶

wa_tab types ty_itab."定義乙個工作區

8.內錶基本操作語法(增刪改查)

不帶表頭的內錶:

insert into index x.

insert into table .

modify index x from .

delete index idx.

delete table from .

read table index x into .

loop at into .

帶表頭的內錶:

insert index x.

modify index x.

delete table .

read table index x.

loop at .

9.內錶資料插入(比迴圈插入法速度快20倍)

insert lines of [from n1 ] [to n2] into  [table] index x.

不指定n1和n2時,itab1可以是任意型別的表,itab2必須是索引表(標準表和排序表都是索引表,雜湊表是非索引表);j如果新增table關鍵字,itab2可以是任意型別的表

10.內錶讀取小技巧

如果內錶行數巨大,將內錶定義成為雜湊表,並且使用關鍵字進行讀取可以提公升效率

ABAP 內錶總結 1

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

開發基礎知識

msdn 使用應用程式域和程式集程式設計 描述如何建立和使用程式集和應用程式域。利用屬性擴充套件元資料 描述如何使用屬性自定義元資料。使用基型別 討論如何格式化和分析基礎資料型別以及如何使用正規表示式處理文字。集合和資料結構 討論在 net framework 中提供的各種集合型別,包括堆疊 佇列 ...

線性表基礎知識總結

線性表 list 是由同一型別的資料元素構成的有序序列的線性結構。線性表中元素的個數稱為線性表的長度 當乙個線性表中沒有元素時,稱之為空表,表的起始位置稱為表頭,表的結束位置稱為表尾。線性表的操作集 list makeempty 初始化乙個新的空線性表。elementtype findkth int...