ABAP Programs:Reading data from a file (presentation server)
REPORT ZSOURCE2604.
* Data declarations for later use
PARAMETERS FILENAME(128) DEFAULT 'c:usersdefaulttestfile.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:
- ABAP Program:Transferring data to a file (presentation server) REPORT ZSOURCE2603. * Data declarations for later use PARAMETERS FILENAME(128) DEFAULT 'c:usersdefaulttestfile.dat' LOWER CASE. TABLES CUSTOMERS. DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE. * Get data for file...
- 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 WITH HEADER LINE. * Opening the File...
- 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....
- 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.~~~...
- 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...
- ABAP Programs: Local data in a form REPORT ZSOURCE1002. * Global field of the programDATA FLAG VALUE ‘G’.* Displaying the global fieldWRITE FLAG.* Calling a formPERFORM WRITE_FLAG.* Displaying the global field againWRITE FLAG.* Defining a form with...
- ABAP Programs: Obtaining data with nested select loops REPORT ZSOURCE1111.* Work areasTABLES: CUSTOMERS, BOOKINGS.* Reading entries from both database tableSELECT * FROM CUSTOMERS. SELECT * FROM BOOKINGS WHERE CUSTOMID = CUSTOMERS-ID AND ORDER_DATE = ’19990101′. WRITE: / CUSTOMERS-NAME,...
- ABAP Programs: Complex Non-Elementary Types and Data Objects REPORT ZSOURCE0408. * Nested recordsTYPES: BEGIN OF ADDRESS, CITY(25), STREET(30), END OF ADDRESS, BEGIN OF PERSON, NAME(25), ADDRESS TYPE ADDRESS, END OF PERSON.DATA RECEIVER TYPE PERSON.RECEIVER-NAME = ‘Smith’.RECEIVER-ADDRESS-CITY = ‘Big...
- Reading PDF attachment from sap inbox through ABAP Function Modules used are as follows: 1.SO_USER_READ_API1 This fm will read the folder details in the sap inbox for the particular user id. 2.SO_FOLDER_READ_API1 This fm will read the folder...
- Difference between Master Data, Transaction Data and Customizing Data Customizing Data refers to the customized information for a particular Client. This includes data such as payment terms, discounts, pricing, tolerance limits, etc., which you do not normally change on...
- Internet Transaction Server (ITS) Internet Transaction Server (ITS) is the transaction processing system that connects the web HTTP server and the standard R/3 system. ITS is available since SAP release 3.1G. All the Internet...
- Different Instances in Application Server Application Server is a physical server which is used to handle and process the user request. In SAP naming convention we define them as an Instance and it is possible...
- How to Populate extended IDOC File segments? Once you extend the IDOC, it is an enhancemnet of the standard IDOC. Write some coding in the USER-EXIT for each outbound/inbound message. Go to CMOD and search for whether...
- ABAP Source Code: Syntax of ABAP/4 Programs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 * Declaration...
- ABAP Programs: Exporting to the ABAP/4 Memory REPORT ZSOURCE1401. * Work areas TABLES: CUSTOMERS, BOOKINGS. * Internal tables which will be exported DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 10 WITH...



















Leave a Reply