SAP Database - The Unofficial SAP Knowledge Base

Free Business and Tech Magazines and eBooks

ABAP Programs:Reading data from a file (presentation server)

Print This Post Email This Post Written by admin on Feb 6th, 2008 | Filed under: ABAP Programs

REPORT ZSOURCE2604.
* Data declarations for later use
PARAMETERS FILENAME(128) DEFAULT 'c:\users\default\testfile.dat'
LOWER CASE.
TABLES CUSTOMERS.
DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100
WITH HEADER LINE.

CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FILENAME
TABLES
DATA_TAB = ALL_CUSTOMERS
EXCEPTIONS
FILE_OPEN_ERROR = 1
OTHERS = 2.
CASE SY-SUBRC.
WHEN 1.
WRITE 'Error when file opened'.
EXIT.
WHEN 2.
WRITE 'Error during data transfer'.
EXIT.
ENDCASE.
* Display the result
LOOP AT ALL_CUSTOMERS.
WRITE: / ALL_CUSTOMERS-NAME,
ALL_CUSTOMERS-CITY.
ENDLOOP.

If you like this post, you may as well like these too:

  1. ABAP Program:Transferring data to a file (presentation server) REPORT ZSOURCE2603. * Data declarations for later use PARAMETERS FILENAME(128) DEFAULT 'c:\users\default\testfile.dat' LOWER CASE. TABLES CUSTOMERS. DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 [...]...
  2. ABAP Program:Reading data from a file REPORT ZSOURCE2602. * Data declarations for later use TABLES CUSTOMERS. PARAMETERS FILENAME(128) DEFAULT '/usr/tmp/testfile.dat' LOWER CASE. DATA: MSG_TEXT(50), ALL_CUSTOMER_NAMES LIKE CUSTOMERS-NAME OCCURS 100 [...]...
  3. ABAP Programs: Transferring data to a file Here is a little program, which will teach you to transfer the data to a file. REPORT ZSOURCE2601. * Data declarations for later use PARAMETERS FILENAME(128) DEFAULT '/usr/tmp/testfile.dat' LOWER CASE....
  4. ABAP Programs: Reading single entries REPORT ZSOURCE1105.* Work area for a database tableTABLES CUSTOMERS.* Reading a single entrySELECT SINGLE * FROM CUSTOMERS WHERE ID = ‘87654321′.IF SY-SUBRC = 0. WRITE CUSTOMERS-NAME.ELSE. WRITE ‘Customer not found.’.ENDIF.~~~...
  5. ABAP Programs: Hexadecimal (or binary) data REPORT CHAP0406. * Hexadecimal (or binary) data is stored in fields of type x.* A type x field of length n contains 2n digits* and its output length is also...



This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Reply

  • Subscribe to RSS

  • Free Ebooks