Advertisement
brixium

Esercizio 6 sap abap

Jul 29th, 2020
4,401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 2.43 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Report  ZLA_RFC_TUTORIAL
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *&
  6. *&
  7. *&---------------------------------------------------------------------*
  8. REPORT zla_rfc_tutorial. "sei su D91
  9.  
  10. * Global Data Declaration
  11. TABLES: spfli.
  12.  
  13.  
  14. PARAMETERS: p_carrid TYPE spfli-carrid DEFAULT 'LH',
  15.             p_connid TYPE spfli-connid DEFAULT '400',
  16.             p_dest   TYPE rfcdes-rfcdest DEFAULT 'NONE'.
  17. DATA: system TYPE sy-sysid,
  18.       flag,
  19.       return TYPE sy-subrc.
  20.  
  21. * Calling the Function
  22. CALL FUNCTION 'LA_RFC_READ_SPFLI' DESTINATION p_dest
  23. starting new task 'TASK1'
  24. performing form_results on end of task
  25. "questo qui è in remoto du d92 per cui crasha senza p_dest
  26.   EXPORTING
  27.     carrid       = p_carrid
  28.     connid       = p_connid
  29. *  IMPORTING
  30. *    ex_spfli     = spfli
  31. *    sys          = system
  32.   EXCEPTIONS
  33. *    invalid_data = 1
  34.     communication_failure = 2
  35.     system_failure = 3
  36.  .
  37.  
  38. *wait until flag = 'X'.
  39. if p_dest = 'NONE'.
  40.     write: / 'Adesso crasho'.
  41. endif.
  42.  
  43. * Handling Exceptions
  44. CASE sy-subrc.
  45. *  WHEN 1.
  46. *    WRITE 'No data available'.
  47. *    EXIT.
  48.   WHEN 2 or 3.
  49.     WRITE 'RFC error'.
  50.     EXIT.
  51. ENDCASE.
  52.  
  53. wait until flag = abap_true.
  54.  
  55. IF return <> 0.
  56.    write: 'Error'.
  57. else.
  58.    WRITE: 'System:', SYSTEM COLOR 4.
  59.    SKIP 2.
  60.    WRITE: spfli-carrid,
  61.        spfli-connid,
  62.        spfli-cityfrom,
  63.        spfli-cityto,
  64.        spfli-deptime,
  65.        spfli-arrtime.
  66. endif.
  67.  
  68. * Displaying Results
  69. *WRITE: spfli-carrid,
  70. *       spfli-connid,
  71. *       spfli-cityfrom,
  72. *       spfli-cityto,
  73. *       spfli-deptime,
  74. *       spfli-arrtime.
  75. *WRITE: / 'System:', system COLOR 4.
  76.  
  77.  
  78. *&---------------------------------------------------------------------*
  79. *&      Form  FORM_RESULTS
  80. *&---------------------------------------------------------------------*
  81. *       text
  82. *----------------------------------------------------------------------*
  83. *  -->  p1        text
  84. *  <--  p2        text
  85. *----------------------------------------------------------------------*
  86. form form_results using task.
  87.     receive results from function 'LA_RFC_READ_SPFLI' "causa crash dump se la destinazione non è definita
  88.          importing
  89.                ex_spfli = spfli
  90.                sys      = system
  91.          exceptions
  92.                invalid_data = 1.
  93.          return = sy-subrc.
  94.          flag = 'X'.
  95. endform.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement