Advertisement
Gireada

ABAP v2

Mar 14th, 2019
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 2.55 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Report  Y_GRIGORE_LAB5
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *&
  6. *&
  7. *&---------------------------------------------------------------------*
  8.  
  9. REPORT  Y_GRIGORE_LAB5.
  10.  
  11. DATA int TYPE I.
  12. int = 10.
  13.  
  14. DATA float TYPE F.
  15. float = '1.234'.
  16.  
  17. Data ari TYPE D.
  18. ari = '20190307'.
  19.  
  20. DATA ora TYPE T.
  21. ora = '103719'.
  22.  
  23. DATA nume TYPE C.
  24. nume = 'GRIGORE'.
  25.  
  26. WRITE: int, / float, / ari ,/ ora ,/ nume.
  27.  
  28.  
  29. *& DATA f TYPE I OCCURS 3.
  30. *& INSERT 1 INTO f INDEX 0.
  31. *& INSERT 2 INTO f INDEX 1.
  32. *& INSERT 3 INTO f INDEX 2.
  33.  
  34.  
  35. DATA n1 TYPE F.
  36. DATA n2 TYPE F.
  37. DATA n3 TYPE F.
  38. DATA n4 TYPE F.
  39.  
  40. n1 = '10.10'.
  41. n2 = '10.20'.
  42. n3 = '10.30'.
  43. n4 = '10.40'.
  44.  
  45. WRITE:/ 'Numarul maxim este: '.
  46. IF n1 > n2 AND n1 > n3 AND n1 > n4.
  47.   WRITE: n1.
  48. ENDIF.    
  49. IF n2 > n1 AND n2 > n3 AND n2 > n4.
  50.   WRITE: n2.
  51. ENDIF.      
  52. IF n3 > n2 AND n3 > n1 AND n3 > n4.
  53.   WRITE: n3.  
  54. ENDIF.    
  55. IF n4 > n1 AND n4 > n2 AND n4 > n3.
  56.   WRITE: n4.
  57. ENDIF.  
  58. WRITE: /.  
  59.  
  60. DATA numar_div TYPE I.
  61. DATA NUMAR_DOI TYPE I.
  62. DATA NUMAR_TREI TYPE I.
  63. DATA NUMAR_CINCI TYPE I.
  64. DATA NUMAR_SAPTE TYPE I.
  65.  
  66. numar_div = 25.
  67.  
  68. NUMAR_DOI = numar_div MOD 2.
  69. NUMAR_TREI = numar_div MOD 3.
  70. NUMAR_CINCI = numar_div MOD 5.
  71. NUMAR_SAPTE = numar_div MOD 7.
  72.  
  73. If NUMAR_DOI = 0.
  74.   WRITE: numar_div , 'este divizibil cu 2'.
  75. ENDIF.  
  76. If NUMAR_TREI = 0.
  77.   WRITE: numar_div , 'este divizibil cu 3'.
  78. ENDIF.  
  79. If NUMAR_CINCI = 0.
  80.   WRITE: numar_div , 'este divizibil cu 5'.
  81. ENDIF.  
  82. If NUMAR_SAPTE = 0.
  83.   WRITE: numar_div , 'este divizibil cu 7'.
  84. ENDIF.  
  85.  
  86.  
  87. DATA numar_text TYPE I.
  88.  
  89. numar_text = 10.
  90.  
  91. CASE numar_text.
  92.   WHEN 0.
  93.     WRITE: / 'Zero'.
  94.   WHEN 1.
  95.     WRITE: / 'Unu'.
  96.   WHEN 2.
  97.     WRITE: / 'Doi'.
  98.   WHEN 3.
  99.     WRITE: / 'Trei'.
  100.   WHEN 4.
  101.     WRITE: / 'Patru'.
  102.   WHEN 5.
  103.     WRITE: / 'Cinci'.
  104.   WHEN 6.
  105.     WRITE: / 'Sase'.
  106.   WHEN 7.
  107.     WRITE: / 'Sapte'.
  108.   WHEN 8.
  109.     WRITE: / 'Opt'.
  110.   WHEN 9.
  111.     WRITE: / 'Noua'.
  112.   WHEN 10.
  113.     WRITE: / 'Zece'.              
  114. ENDCASE.    
  115.  
  116.  
  117. DATA numar_1 TYPE F.
  118. DATA numar_2 TYPE F.
  119. DATA operator TYPE C.
  120.  
  121. operator = '+'.
  122. numar_1 = '10.20'.
  123. numar_2 = '20.30'.
  124.  
  125. DATA rezultat TYPE F.
  126. rezultat = 0.
  127. CASE operator.
  128.   WHEN '+'.
  129.     rezultat = numar_1 + numar_2.
  130.   WHEN '-'.
  131.     rezultat = numar_1 - numar_2.
  132.   WHEN '*'.
  133.     rezultat = numar_1 * numar_2.
  134.   WHEN '/'.
  135.     rezultat = numar_1 / numar_2.
  136.   WHEN '%'.
  137.     rezultat = numar_1 MOD numar_2.            
  138. ENDCASE.    
  139.  
  140. WRITE: / 'Rezultatul este: ', rezultat.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement