Message, Debugging, File Transfer and Type Group

2,521 views

Published on

6th part of series shared on http://sapdocs.info/sap/abap/documents-for-sap-abap-beginners/

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,521
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
309
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Message, Debugging, File Transfer and Type Group

  1. 1. ABAP Chapter 6 <ul><li>Message </li></ul><ul><li>Debugging </li></ul><ul><li>File Transfer </li></ul><ul><li>Type Group </li></ul>
  2. 2. Message in ABAP
  3. 3. User Messages <ul><li>If user has entered inconsistent values,you output a dialog message with MESSAGE statement </li></ul><ul><li>Dialog messages are stored in table T100 (Transaction : SE91) </li></ul>r eport ztest . … . AT SELECTION-SCREEN. … m essage e 000 (38) with ‘----’ ‘---’ ‘---’ ‘---’ . …
  4. 4. Message Type Syntax Message [ A < nnn > ] ( message class ) with < field1 > < field2 > … E, W, I, S
  5. 5. Messages Type - A(Abend) Message A000(38)... Program Start Selection Screen A Message Exit
  6. 6. Messages Type - E(Error) Message E 000(38) .. . Program Start Selection Screen E Message New input Require
  7. 7. Messages Type - W(Warning) Message W 000(38).. . Program Start Selection Screen W Message New input possible List Enter
  8. 8. Messages Type - I(Information) Message I 000(38).. . Program Start Selection Screen I Message List Enter
  9. 9. Messages Type - S(Success) Message S 000(38).. . Program Start Selection Screen List (Next Screen)
  10. 10. Dynamic Message Report ztest1. Parameters today like sy-datum . At s election-screen. if today <> sy-datum. m essage e000(38) with ‘ Please enter today : ’ sy-datum . endif. Start-of-selection. Write: / ‘ Today is :’, t oday .
  11. 11. Debugging
  12. 12. Debugging Mode
  13. 13. Debugging Mode : Internal Table
  14. 14. Debugging Mode : Internal Table
  15. 15. Debugging Mode : Watchpoint
  16. 16. Watchpoint : SAP ECC 6.0
  17. 17. How to Set Debugging Mode <ul><li>If you want to test transaction,enter /h in the command field,press ENTER and execute the transaction </li></ul><ul><li>Set breakpoints in the program </li></ul><ul><li>Utilities->Breakpoints->Set </li></ul><ul><li>Uses BREAK-POINT statement </li></ul>
  18. 18. ABAP Practice
  19. 19. File Transfer
  20. 20. File Transfer (Application Server) <ul><li>There are 3 steps for file transfer </li></ul><ul><ul><ul><li>Open File </li></ul></ul></ul><ul><ul><ul><li>Read/Write File </li></ul></ul></ul><ul><ul><ul><li>Close File </li></ul></ul></ul>
  21. 21. File Transfer * Prepare Internal Table Data all_customers like customers occurs 0 with header line. Data msg_txt(50). Parameters filename(128) default ‘cust omersdata .t xt ’ lower case. Start-of-selection. Select * from customers into table all_customers.
  22. 22. File Transfer * Opening a file Open dataset filename for output in text mode encoding default message msg_txt. If sy-subrc <> 0. Write: ‘File cannot be opened .Reason :’,msg_txt. else.
  23. 23. File Transfer * Transferring data to a file Loop at all_customers. Transfer all_customers to filename. Endloop. * Closing a file Close dataset filename. Endif.
  24. 24. Transaction : AL11
  25. 25. File Transfer (Appending Data) * Opening a file Open dataset filename for appending in text mode encoding default message msg_txt. If sy-subrc <> 0. Write: ‘File cannot be opened .Reason :’,msg_txt. else . ...
  26. 26. Reading Data from OS File * Reading data from a file Parameters filename(128) default ‘cust omersdata .t xt ’ lower case. Data msg_txt(50). Data all_customers like customers occurs 0 with header line. Start-of-selection. Open dataset filename for input in text mode encoding default message msg_txt. If sy-subrc <> 0. Write: ‘File cannot be opened .Reason :’,msg_txt. else .
  27. 27. Reading Data from OS File Do. Read dataset filename into all_customers. if sy-subrc <> 0. Exit. endif. Append all_customers. Enddo. Close dataset filename. Endif.
  28. 28. Deleting OS File Parameters filename(128) default ‘cust omersdata . txt ’ lower case. START-OF-SELECTION. Delete dataset filename. If sy-subrc = 0. write: / ‘Delete OK’. Endif.
  29. 29. Working with File on Presentation Server
  30. 30. Download Data to PC * Download data from PC parameters filename like rlgrap-filename default ‘c:cust omers .txt’. Data all_customers like customers occurs 0 with header line. START-OF-SELECTION. Select * from customers into table all_customres.
  31. 31. Download Data to PC C ALL FUNCTION ‘DOWNLOAD’ Exporting filename = filename Tables data_tab = all_customers Exceptions file_open_error = 1 … others = 5 .
  32. 32. Download Data to PC Case sy-subrc. When 1. Write: ‘Error when file opened’. When 2. Write: ‘Error during data transfer’. … When 0. Write: / ‘Data Download Finish’. Endcase.
  33. 33. Upload Data from PC * Upload data to PC parameters filename like rlgrap-filename default ‘c:cust omers .txt’. Data all_customers like customers occurs 0 with header line. START-OF-SELECTION.
  34. 34. Upload Data from PC CALL FUNCTION ‘UPLOAD’ Exporting filename = filename Tables data_tab = all_customers Exceptions file_open_error = 1 … others = 5 .
  35. 35. Upload Data from PC Case sy-subrc. When 1. Write: ‘Error when file opened’. When 2. Write: ‘Error during data transfer’. … When 0. Insert customers from table all_customers. … Endcase.
  36. 36. Upload/Download Data in Background Call function ‘WS_ DOWNLOAD’ Exporting filename = filename ... and Call function ‘ WS_UP LOAD’ Exporting filename = filename ...
  37. 37. Type Group : SE11
  38. 38. Type Group ABAP Program
  39. 39. Exercise IV
  40. 40. Exercise III : User Master usr02-bname usr02-trdat adcp-tel_number
  41. 41. Exercise IV : Drill-Down Report

×