2010 Mar 02 8:15 AM
Hi,
I want to know, which is the FM - we can use to read the excel file from the application server and load the data from the excel file to the int table.
I tried with FM - FILE_READ_AND_CONVERT_SAP_DATA and FILE_READ_AND_GET_TAB
These FM's I tried with the help of SDN.
Do you have any idea ?
Cheers,
dinesh
Hi,
You can get excel sheet data from Application server to internal table by using OPEN DATASET PHYSICAL FILE INTO TEMP FILE FOR INPUT ENCODING DEFAULT.
Regards,
Venkat.
2010 Mar 02 1:32 PM
I think you can't read an excel on application server.
If you want to read an excel file you need to convert it into .csv et .txt file, separator or tab (#) and to send it on your application server.
After that you'll have to do an "open dataset" to populate your internal tab.
Edited by: julien schneerberger on Mar 2, 2010 2:32 PM
Edited by: julien schneerberger on Mar 2, 2010 2:32 PM
2010 Mar 02 1:37 PM
Hi Dinesh,
Please search the forum with your subject line and see the magic:-)
Small typo error in subject. It is Excel.
http://www.sdn.sap.com/irj/scn/advancedsearch?query=readingexcelfilefromApplication+server
Thanks,
Vinod.
2010 Mar 02 2:00 PM
Hi,
You can get excel sheet data from Application server to internal table by using OPEN DATASET PHYSICAL FILE INTO TEMP FILE FOR INPUT ENCODING DEFAULT.
Regards,
Venkat.
2010 Mar 02 2:06 PM
The data that exists in the file comes with TAB delimitor and in ONE line, so you SPLIT the data using the horizontal TAB
data: TAB(2) type c.
TAB = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
now split the data using TAB field.......
2010 Mar 03 7:26 AM
Hi Dinesh,
if you really have an excel file on your application server, that means where SAP is running, you can read the file using open/read dataset into an xstring.
If the excel is in proprietary ms excel format you can only extract the table data using excel program on your presentation server, this is your PC where the SAPGUI is running.
In this case, you can convert the xstring into an internal table, make a GUI download to a local directory (i.e. SAP work directory) and then open the excel using SAP desktop office integration.
If the excel file has been saved as tab-delimited text, you can open/read as TEXT file and split the records at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into a useful structure to be appended to an internal table.
Regards,
Clemens
2010 Mar 03 8:02 AM
Hi,
Use the following code it will solve your problem....
data: begin of itaba occurs 0,
name(20) type c,
addre(20) type c,
end of itaba.
DATA:itab like table of itaba with header line.
DATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
DATA : B1 TYPE I VALUE 1,
C1 TYPE I VALUE 1,
B2 TYPE I VALUE 100,
C2 TYPE I VALUE 9999.
DATA: ROW LIKE ALSMEX_TABLINE-ROW VALUE 1,
COL LIKE ALSMEX_TABLINE-ROW VALUE 1.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = 'D:\EMPLOYE.XLS'
I_BEGIN_COL = B1
I_BEGIN_ROW = C1
I_END_COL = B2
I_END_ROW = C2
TABLES
INTERN = itab1
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at itab1.
IF ITAB1-ROW EQ ROW.
WRITE:/ ITAB1-VALUE(15).
ROW = ROW + 1.
ELSE.
WRITE:ITAB1-VALUE(15).
ENDIF.
EndloOp.Regards,
Shankar.
2010 Mar 03 8:24 AM
yes, ALSM_EXCEL_TO_INTERNAL_TABLE can be used for single-sheet local excel files if you have excel installed on your desktop. The function ALSM_EXCEL_TO_INTERNAL_TABLE uses SAP desktop office integration technique which will not work on application server.
Regards,
Clemens
2010 Mar 03 8:55 AM
>
> Use the following code it will solve your problem....
>
> CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
> EXPORTING
> FILENAME = 'D:\EMPLOYE.XLS'
> I_BEGIN_COL = B1
> Shankar.
Please read the requirements first. Your solution will not solve the problem cause its oinly working on presentation server, not on application server as requested.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |