Step Loop Örnek
Aynı ekranda iki step-loop kullanım örneğidir.
0203 ana ekran
0204 subscreen 1. step loop
0205 subscreen 2. step loop
Sayfalama yöntemi ; Her sayfada gösterilecek satır sayısı belirlenir. Toplam sayfa sayısı hesaplanır. Sayfa sayısına göre ilk ve son gösterilecek satır hesaplanır.
Genel tanımlar;
"Tanımlamalar,
types: begin of ty_form_ht,
spras type spras,
form_no type ztst_e_form_no,
form_baslik type ztst_e_form_baslik,
form_aciklama type ztst_e_form_aciklama,
end of ty_form_ht.
data: gs_203_form_h type ty_form_h.
data: gt_204_form_ht type standard table of ty_form_ht WITH HEADER LINE.
data: gs_204_form_ht type ty_form_ht.
types: begin of ty_tablet,
sec type xfeld,
tablet_kull type ztst_e_tablet_user,
form_no type ztst_e_form_no,
end of ty_tablet.
data: gt_205_tablet type standard table of ty_tablet WITH HEADER LINE.
data: gs_205_tablet type ty_tablet.
"Yönerge:
types: begin of ty_fireym ,
total_row TYPE i,
idx type i,
line type i,
cursor TYPE i,
xndx_start TYPE i ,
xndx_end TYPE i ,
page_cur type i,
page_per type i,
page_tot type i,
END OF ty_fireym.
data: gs_xn_tblt type ty_fireym.
data: gs_xn_label type ty_fireym.
Ana ekrana (0203) 0204 ve 0205 alt ekranları
"0203 için PBO ve PAI
PROCESS BEFORE OUTPUT.
MODULE STATUS_0203.
CALL SUBSCREEN SC_204 INCLUDING sy-repid `0204`.
CALL SUBSCREEN SC_205 INCLUDING sy-repid `0205`.
PROCESS AFTER INPUT.
CALL SUBSCREEN SC_204 .
CALL SUBSCREEN SC_205 .
MODULE USER_COMMAND_0203.
module STATUS_0203 output.
set pf-status `OKCANC`.
set titlebar `0203`.
endmodule. " STATUS_0203 OUTPUT
module USER_COMMAND_0203 input.
ok_code = ok_code_scr.
clear ok_code_scr.
case ok_code.
when `BACK` or `EXIT` or `QUIT` or `BT_IPT` .
gv_scr_err = `X`."Başka işlem yapılmasın
leave to screen 0.
when `TB_NEXT` or `TB_PREV` .
PERFORM f_xndx_move USING ok_code+3(4) CHANGING gs_xn_tblt.
when ``. "perform f_fill_0201.
when `TB_SALL`. PERform f_tablet_sel USING `X`.
when `TB_DSEL`. PERform f_tablet_sel USING SPACE.
when `BT_TMM`.
leave to screen 0.
endcase.
clear ok_code.
endmodule. " USER_COMMAND_0203 INPUT
0205 Ekranında objeleri seçtikten sonra menüden Step Loop olarak gruplayın.
"0205 alt ekranı için PBO/PAI
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0204.
LOOP AT gt_205_tablet INTO gs_205_tablet
CURSOR gs_xn_tblt-cursor
FROM gs_xn_tblt-xndx_start TO gs_xn_tblt-xndx_end.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT gt_205_tablet.
MODULE TRANSP_0205_IN.
ENDLOOP.
MODULE TRANSP_0205_IN INPUT.
gs_xn_tblt-idx = sy-stepl + gs_xn_tblt-xndx_start - 1.
MODIFY gt_205_tablet FROM gS_205_tablet INDEX gs_xn_tblt-idx.
ENDMODULE.
"0204 için PBO/PAI
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0204.
LOOP AT gt_204_form_ht INTO gs_204_form_ht
CURSOR gs_xn_label-cursor
FROM gs_xn_label-xndx_start TO gs_xn_label-xndx_end.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT gt_204_form_ht.
MODULE TRANSP_0204_IN.
ENDLOOP.
MODULE TRANSP_0204_IN INPUT.
gs_xn_label-idx = sy-stepl + gs_xn_label-xndx_start - 1.
MODIFY gt_204_form_ht FROM gs_204_form_ht INDEX gs_xn_label-idx.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Form f_tablet_sel
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PRM_SEL text
*----------------------------------------------------------------------*
form f_tablet_sel using prm_sel.
data: ls_205_tablet like line of gt_205_tablet.
data: lv_xndx type int4.
loop at gt_205_tablet into ls_205_tablet.
lv_xndx = sy-tabix.
ls_205_tablet-sec = prm_sel.
modify gt_205_tablet from ls_205_tablet index lv_xndx.
endloop.
endform. "f_tablet_sel
*&---------------------------------------------------------------------*
*& Form f_xndx_init
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->T_CONTENT text
* -->PRM_GORUNEN text
* <--CHN_FIREYM text
*----------------------------------------------------------------------*
form f_xndx_init tables t_content
using prm_gorunen type int4 changing chn_fireym type ty_fireym.
data: lv_bolum type p decimals 1.
clear chn_fireym.
if t_content[] is INITIAL.
append INITIAL LINE TO t_content[].
endif.
describe table t_content lines chn_fireym-total_row.
chn_fireym-page_per = prm_gorunen.
chn_fireym-line = 0.
if prm_gorunen = 0.
chn_fireym-page_tot = 0.
else.
lv_bolum = chn_fireym-total_row / prm_gorunen.
chn_fireym-page_tot = floor( lv_bolum ).
if ( chn_fireym-total_row mod prm_gorunen ) eq 0.
chn_fireym-page_tot = chn_fireym-page_tot - 1. "1 sayfa = 0. sayfa
* else.
* chn_fireym-page_tot = chn_fireym-page_tot .
endif.
endif.
chn_fireym-page_cur = 0.
perform f_xndx_setpage changing chn_fireym.
endform. "f_xndx_init
*&---------------------------------------------------------------------*
*& Form f_xndx_setpage
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--CHN_FIREYM text
*----------------------------------------------------------------------*
form f_xndx_setpage changing chn_fireym type ty_fireym.
if chn_fireym-page_cur => chn_fireym-page_tot.
chn_fireym-page_cur = chn_fireym-page_tot .
endif.
if chn_fireym-page_cur < 0 .
chn_fireym-page_cur = 0.
endif.
chn_fireym-xndx_start = ( chn_fireym-page_per * chn_fireym-page_cur ) + 1 .
chn_fireym-xndx_end = chn_fireym-xndx_start + chn_fireym-page_per - 1.
if chn_fireym-total_row < chn_fireym-xndx_end.
chn_fireym-xndx_end = chn_fireym-xndx_end.
endif.
chn_fireym-cursor = chn_fireym-xndx_start.
endform. "f_xndx_setpage
*&---------------------------------------------------------------------*
*& Form f_xndx_move
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PRM_CMD text
* <--CHN_FIREYM text
*----------------------------------------------------------------------*
form f_xndx_move using prm_cmd
changing chn_fireym type ty_fireym.
case prm_cmd.
when `NEXT`.
chn_fireym-page_cur = chn_fireym-page_cur + 1.
perform f_xndx_setpage changing chn_fireym.
when `PREV`.
chn_fireym-page_cur = chn_fireym-page_cur - 1.
perform f_xndx_setpage changing chn_fireym.
endcase.
endform. "f_xndx_move
"Ana ekranın çağırılması:
form XXXXXX. perform f_xndx_init TABLES gt_204_form_ht
USING 5 CHANGING gs_xn_label .
perform f_xndx_init TABLES gt_205_tablet
USING 3 CHANGING gs_xn_tblt .
call SCREEN 0203 starting at 10 10 .
endform.
.