TableControl使用方法

2021-04-13 02:33:38 字數 2025 閱讀 2239

talbecontrol使用方法總結

一.自己手動製作tablecontrol(我最喜歡用的方法)

1)定義內錶

data wa type mseg.

data itab like table of wa.

2)定義表控制物件

control: tc1 type tableview using screen 0100.

3)pbo

*將內錶中的值傳至

tablecontrol

中顯示出來.

*內錶=>螢幕

loop at itab into wa

with control tc1

cursor tc1-current_line. …

*將內錶或變數中的值傳給

tablecontrol

中相應的字段.

module tc1_change_field_attr.

endloop.

4)pai*將

tablecontrol

中的值傳至內錶 *

螢幕=>內錶

loop at itab

chain.

field itab-co1.

field itab-co2. …

*將tablecontrol

中相應欄位的值傳給內錶或變數

module tc1_modify on chain-request. …

endchain.

endloop.

5)module

module tc1_modify input.

modify itab from wa index tc1-current_line.

endmodule.

二、通過嚮導建立tablecontrol

1)進入screen painter;

2)將table control拖入螢幕,進入嚮導介面;

3)輸入table control名稱,繼續;

4)輸入內錶名稱( 注意,應該先在程式中建立好內錶);

5)選擇表字段,繼續;

6)設定input/output attributes、columns、line selectability屬性;

7)設定是否有scroll;

8)輸入生成程式的名稱,可以用預設;

9)單擊「完成」;

10)觀察程式,tablecontrl和相應**都已自動生成,建立成功。

三、與tablecontrl相關的一些知識

我總結如下:

tablecontrol-lines

**控制項總行數

tablecontrol-top_line

**控制項第一行索引(內錶中行號)

tablecontrol-current_line **控制項當前行,loop到的行號(內錶的行號)

sy-loopc 螢幕**中可見的行號(手動畫的tablecontrol的行數)

no

name

address

內錶中行號

(虛擬出來的)

2 游標所在字段 3

4 get cursor line n. "得到當前游標所在行號

內錶中的行號 = top_line + n – 1.

= 2 + 2 – 1.

= 3.

table control 雙擊事件

一 table control 響應雙擊事件 第一步 屬性選擇 響應雙擊 第二步 在status裡面f2要寫成pick,這樣雙擊的ucomm就是pick了 第三步 加上如下 就可以得到雙擊的行和列 data l row type i.data l field type char30.case ok ...

table control獲取雙擊行資料

1 啟用gui狀態響應雙擊事件的功能碼 2 在user command 的module裡獲取滑鼠所在位置 這裡要用get cursor語句,比如 data l line type i.get cursor line l line.這樣就取得了滑鼠在內表的所在行,如果希望對映到itab,那就需要結合t...

ABAP中的Table Control程式設計 2

上篇講了table control的基本功能,現在繼續討論它在其他方面的一些設定。4,滾動到某行某列 如果我們希望,螢幕顯示後展示在使用者面前的最上端或者左端是表內容中的某行某列,則應該修改變數top line和left col的值。一般可在pbo的tc 0100 change tc attr裡設定...