Professional Documents
Culture Documents
ABAP Chapter 6: Message Debugging File Transfer Type Group
ABAP Chapter 6: Message Debugging File Transfer Type Group
Message
Debugging
File Transfer
Type Group
Message in ABAP
User Messages
Message Type
Syntax
Message [ A<nnn> ](message class) with <field1> <field2>
E, W, I, S
Program Start
Selection
Screen
A Message
Exit
Program Start
Selection
Screen
New input
Require
E Message
Program Start
Selection
Screen
New input
possible
W Message
Enter
List
Program Start
Selection
Screen
I Message
Enter
List
Program Start
Selection
Screen
List
(Next Screen)
Dynamic Message
Report ztest1.
Parameters today like sy-datum.
At selection-screen.
if today <> sy-datum.
message e000(38) with Please enter today : sy-datum.
endif.
Start-of-selection.
Write: / Today is :, today.
Debugging
Debugging Mode
ABAP Practice
File Transfer
File Transfer
* Prepare Internal Table
Data all_customers like customers occurs 0 with header line.
Data msg_txt(50).
Parameters filename(128) default customersdata.txt lower case.
Start-of-selection.
Select * from customers into table all_customers.
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.
File Transfer
* Transferring data to a file
Loop at all_customers.
Transfer all_customers to filename.
Endloop.
* Closing a file
Close dataset filename.
Endif.
Transaction : AL11
Deleting OS File
Parameters filename(128) default customersdata.txt lower case.
START-OF-SELECTION.
Delete dataset filename.
If sy-subrc = 0.
write: / Delete OK.
Endif.
Download Data to PC
* Download data from PC
parameters filename like rlgrap-filename
default c:\customers.txt.
Data all_customers like customers occurs 0
with header line.
START-OF-SELECTION.
Select * from customers into table all_customres.
Download Data to PC
CALL FUNCTION DOWNLOAD
Exporting
filename = filename
Tables
data_tab = all_customers
Exceptions
file_open_error = 1
others
= 5.
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.
others
= 5.
When 0.
Insert customers from table all_customers.
Endcase.
...
and
Call function WS_UPLOAD
Exporting
filename = filename
...
Type Group
ABAP Program
Exercise IV