Posted By

qrist0ph on 11/20/09


Tagged

abap


Versions (?)

ABAP Tabellen


 / Published in: Other
 

  1. METHOD main.
  2. "-------------------------------------
  3. "Working Areas.
  4. TYPES: BEGIN OF zcatest_line,
  5. id TYPE zcatest-id,
  6. bezeichnung TYPE zcatest-bezeichnung,
  7. END OF zcatest_line.
  8.  
  9. DATA zcatest_wa TYPE zcatest_line.
  10. DATA zcatest_wa2 TYPE zcatest.
  11. "-------------------------------------
  12. "Interne Tabellen erzeugen
  13. DATA zcatest_itab TYPE TABLE OF zcatest.
  14. DATA zcatest_itab2 TYPE TABLE OF zcatest_line.
  15. "-------------------------------------
  16. "Working Areas mit Like erzeugen
  17. DATA zcatest_wa3 LIKE LINE OF zcatest_itab.
  18. DATA zcatest_wa4 LIKE zcatest_wa.
  19.  
  20.  
  21. "-------------------------------------
  22. "In eine interne Tabelle schreiben und aus dieser lesen
  23. SELECT * from zcatest into TABLE zcatest_itab.
  24. LOOP AT zcatest_itab INTO zcatest_wa2.
  25. MESSAGE zcatest_wa2-bezeichnung TYPE 'I'.
  26. ENDLOOP.
  27.  
  28. "Direkt aus Datenbank-Tabelle lesen
  29. SELECT * from zcatest into zcatest_wa2.
  30. "MESSAGE zcatest_wa2-bezeichnung TYPE 'I'.
  31. ENDSELECT.
  32.  
  33.  
  34. "---------------------------------------
  35. "In interne Tablle schreiben und anschlie�end in Datenbank-Tabelle einfügen
  36. CLEAR zcatest_itab.
  37. DO 3 TIMES.
  38. zcatest_wa2-id = sy-index.
  39. APPEND zcatest_wa2 TO zcatest_itab.
  40. "oder direkt:
  41. INSERT zcatest FROM zcatest_wa2.
  42. ENDDO.
  43. INSERT zcatest FROM TABLE zcatest_itab.
  44.  
  45. ENDMETHOD.

Report this snippet  

You need to login to post a comment.