Mi primer programa en ABAP

21 03 2007

(desde donde estoy no tengo acentos ni corrector ortografico, so bear me)

ABAP es un lenguaje muy curioso desde el punto de vista en que es una mescla de Asembler, Cobol, PASCAL mas todo lo que nos dijeron en la universidad que no debemos hacer.

Este es mi primer programa en ABAP. Es una calculadora que suma, resta, multiplica y divide.

DELPHI:
  1. *&---------------------------------------------------------------------*
  2.  
  3. *& Report YTRAINING0401
  4.  
  5. *&
  6.  
  7. *&---------------------------------------------------------------------*
  8.  
  9. *&
  10.  
  11. *&
  12.  
  13. *&---------------------------------------------------------------------*
  14.  
  15. REPORT ytraining0401.
  16.  
  17.  
  18.  
  19. PARAMETER a TYPE i.
  20.  
  21. PARAMETER b TYPE i.
  22.  
  23. PARAMETER c TYPE c.
  24.  
  25. DATA r TYPE i.
  26.  
  27. CASE c.
  28.  
  29. WHEN '+'.
  30.  
  31. r = a + b.
  32.  
  33. WHEN '-'.
  34.  
  35. r = a - b.
  36.  
  37. WHEN '/'.
  38.  
  39. IF b = 0.
  40.  
  41. WRITE 'No es posible dividir por 0, abortando'.
  42.  
  43. EXIT.
  44.  
  45. ENDIF.
  46.  
  47. r = a / b.
  48.  
  49. WHEN '*'.
  50.  
  51. r = a * b.
  52.  
  53. WHEN OTHERS.
  54.  
  55. WRITE 'No puede identificarse el operando. Abortando'.
  56.  
  57. EXIT.
  58.  
  59. ENDCASE.
  60.  
  61. WRITE r.


Acciones

Informacion

Una respuesta a “Mi primer programa en ABAP”

15 11 2007
FERNANDO (11:29:35) :

NO ESTA MAL, SIN EMBARGO ES DE MAL PROGRAMADOR USAR PALABRAS RESERVADAS COMO ‘EXIT’, MAS ALLA DE QUIÉN SE INTRODUZCA EN EL LENGUAJE. PARA ESO TENDRÍA QUE HABER AGREAGADO FLAGS Y BUCLES ANIDADOS. QUIÉN PROGRAME POR PRIMERA VEZ EN ABAP, DUDO MUCHO QUE SEA SU PRIMER ACERCAMIENTO A LA PROGRAMACIÓN.

MAS ALLA DE ESTO, ES UNA AYUDA IMPORTANTE.

Deje un comentario

usted puede usar estos tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word