Variante 1 (sy-scols / sy-srows)
* Zeilen und Spalten in Pixel umrechnen
DATA(lv_x_metric) = cl_gui_cfw=>compute_metric_from_dynp( metric = cl_gui_control=>metric_pixel
x_or_y = 'X'
in = sy-scols ).
DATA(lv_y_metric) = cl_gui_cfw=>compute_metric_from_dynp( metric = cl_gui_control=>metric_pixel
x_or_y = 'Y'
in = sy-srows ).
WRITE: / |X: { lv_x_metric }|.
WRITE: / |Y: { lv_y_metric }|.
Variante 2 (Kernel-Methode ‚GET_WINDOW_DATA‘)
DATA: lv_begin_r TYPE i.
DATA: lv_end_r TYPE i.
DATA: lv_begin_c TYPE i.
DATA: lv_end_c TYPE i.
* Kernel-Methode 'GET_WINDOW_DATA' aufrufen, gibt Position des Fensters in Dynprozeilen und -spalten zurück
CALL 'GET_WINDOW_DATA' ID 'BEGROW' FIELD lv_begin_r ID 'BEGCOL' FIELD lv_begin_c ID 'ENDROW' FIELD lv_end_r ID 'ENDCOL' FIELD lv_end_c.
WRITE: / |From col: { lv_begin_c } to row: { lv_end_c }|.
WRITE: / |From row: { lv_begin_r } to row: { lv_end_r }|.
* Zeilen und Spalten gesamt ausrechnen
DATA(lv_cols) = lv_end_c - lv_begin_c.
DATA(lv_rows) = lv_end_r - lv_begin_r.
WRITE: / |Cols: { lv_cols }|.
WRITE: / |Rows: { lv_rows }|.
* Zeilen und Spalten in Pixel umrechnen
DATA(lv_x_metric) = cl_gui_cfw=>compute_metric_from_dynp( metric = cl_gui_control=>metric_pixel
x_or_y = 'X'
in = lv_cols ).
DATA(lv_y_metric) = cl_gui_cfw=>compute_metric_from_dynp( metric = cl_gui_control=>metric_pixel
x_or_y = 'Y'
in = lv_rows ).
* Breite des Fensters in Pixel
WRITE: / |X: { lv_x_metric }|.
* Höhe des Fensters in Pixel
WRITE: / |Y: { lv_y_metric }|.