Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Sample Code arrow ABAP Reports arrow Sample Program to Upload Excel document into internal table
Sample Program to Upload Excel document into internal table PDF Print E-mail
User Rating: / 2
PoorBest 
Written by Amit khari   
Tuesday, 17 July 2007
ABAP code for uploading an Excel document into an internal table. See code below for structures. The code is based on uploading a simple Excel spreadsheet or for an actual Excel file.

There are also a couple of alternatives which use fucntion modules ‘KCD_EXCEL_OLE_TO_INT_CONVERT’
and ‘ALSM_EXCEL_TO_INTERNAL_TABLE’ but the method below is by far the simplest method to use. *……………………………………………………..
*: Description :
*: ———– :
*: This is a simple example program to get data from an excel :
*: file and store it in an internal table. :
*: :
*: Author : www.sapdev.co.uk, based on code from Jayanta :
*: :
*: SAP Version : 4.7 :
*:……………………………………………………:
REPORT zupload_excel_to_itab.

TYPE-POOLS: truxs.

PARAMETERS: p_file TYPE rlgrap-filename.

TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.

DATA: it_raw TYPE truxs_t_text_data.

* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION ‘F4_FILENAME’
EXPORTING
field_name = ‘P_FILE’
IMPORTING
file_name = p_file.

***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

CALL FUNCTION ‘TEXT_CONVERT_XLS_TO_SAP’
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = ‘X’
i_tab_raw_data = it_raw ” WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] “ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.

IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

***********************************************************************
* END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.

Related Items:

 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 38
Tips and Tricks: 330
Sample Code: 164
Total Contributions: 545

Member Activity
Members: 6061 since 2/1/2007!
New: 0 since yesterday!
Visitors: 959232
We have 2 guests online

Newest Members

Welcome our newest members:

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor