Created
May 18, 2012 14:31
-
-
Save EkremGungormez/2725550 to your computer and use it in GitHub Desktop.
Collect Statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATA: BEGIN OF itabo OCCURS 0, | |
ogrno(10) TYPE n, | |
derskod(10) TYPE c, | |
not TYPE i, | |
sayi TYPE i, | |
END OF itabo. | |
DATA: BEGIN OF itabd OCCURS 0, | |
ogrno(10) TYPE n, | |
derskod(10) TYPE c, | |
sinav(2) TYPE n, | |
not TYPE i, | |
sayi TYPE i, | |
END OF itabd. | |
DATA: lv_ort(8) TYPE p DECIMALS 2. | |
START-OF-SELECTION. | |
PERFORM fill_itabd USING: '1000000001' 'MAT01' 1 56, | |
'1000000001' 'MAT01' 2 66, | |
'1000000001' 'MAT01' 3 36, | |
'1000000001' 'DST01' 1 45, | |
'1000000001' 'DST01' 2 70, | |
'1000000001' 'DST01' 3 80, | |
'1000000001' 'OPS01' 1 80, | |
'1000000001' 'OPS01' 2 90, | |
'1000000002' 'MAT01' 1 16, | |
'1000000002' 'MAT01' 2 69, | |
'1000000002' 'MAT01' 3 90, | |
'1000000002' 'DST01' 1 85, | |
'1000000002' 'DST01' 2 40, | |
'1000000002' 'OPS01' 2 100, | |
'1000000002' 'DST01' 3 20, | |
'1000000002' 'OPS01' 1 50, | |
'1000000002' 'OPS01' 3 80. | |
END-OF-SELECTION. | |
loop at itabd. | |
move-corresponding itabd to itabo. | |
collect itabo. | |
endloop. | |
loop at itabo. | |
lv_ort = itabo-not / itabo-sayi. "ortalamanın hesaplanması | |
write: / itabo-ogrno,itabo-derskod,itabo-not, itabo-sayi, lv_ort. | |
IF lv_ort gt 50 . | |
WRITE 'geçti'. | |
ELSE. | |
WRITE 'kaldi'. | |
ENDIF. | |
endloop. | |
* Fonksiyonu birden fazla kez çağırmak yerine parametrik hale getirerek kolaylık sağladık. | |
FORM fill_itabd USING p_ogr | |
p_ders | |
p_sinav | |
p_not. | |
itabd-ogrno = p_ogr. | |
itabd-derskod = p_ders. | |
itabd-sinav = p_sinav. | |
itabd-not = p_not. | |
itabd-sayi = 1. | |
APPEND itabd. | |
ENDFORM. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment