Sample ABAP program to upload excel data to internal table and sending it to Application server
*--Attaching type group to the program
TYPE-POOLS TRUXS. *--Structure Type TYPES: BEGIN OF TY_STD, RONO TYPE C LENGTH 4, NAME1 TYPE C LENGTH 20, GEN TYPE C LENGTH 6, FEES TYPE C LENGTH 10, END OF TY_STD. *--Header line and internal table DATA WA TYPE TY_STD. DATA ITAB TYPE TABLE OF TY_STD. *--Dummy Internal table for Function module purpose DATA IT_RAW TYPE TRUXS_T_TEXT_DATA. *--Application Server files are known as "Datasets" *--here "fname" is the Dataset DATA FNAME TYPE C LENGHT 40 VALUE 'Students.txt'. *--Convert Excel flat file data into Internal table CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP' EXPORTING I_TAB RAW DATA = IT_RAW I_FILENAME = 'C:Documents and SettingsAdministratorDesktopstudents.xls' TABLES I_TAB_CONVERTED_DATA = ITAB. *--Sending data to Application Server OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. LOOP AT ITAB INTO WA. TRANSFER WA TO FNAME. ENDLOOP. CLOSE DATASET FNAME.
Comments
Post a Comment