Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Excel file From FTP Server

Former Member
0 Likes
806

Hi All,

I am trying to fetch data from file server which is in EXCEL(.XLS) format.

Able to connect FTP using FTP_CONNECT,using FTP_COMMAND(get filename).

Now the problem is i am able to read text file but not EXCEL file.

How to capture the excel file entries,help me regarding this?

Sachin.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
622

Hi Sachin,

If you want to read the XLS file contains in an internal table, i have these codes, please try it, and if you face any problem, please let me know.

Thanks.

DATA: WA_TAB TYPE ALSMEX_TABLINE,

LT_TAB TYPE TABLE OF ALSMEX_TABLINE.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = 'C:\TEST.XLS'

I_BEGIN_COL = '1'

I_BEGIN_ROW = '1'

I_END_COL = '255'

I_END_ROW = '255'

TABLES

INTERN = lt_tab

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.

TYPES: BEGIN OF TY_DTAB,

ZONE TYPE STRING,

QTR1 TYPE STRING,

QTR2 TYPE STRING,

QTR3 TYPE STRING,

QTR4 TYPE STRING,

END OF TY_DTAB.

DATA: WA_DTAB TYPE TY_DTAB,

LT_DTAB TYPE TABLE OF TY_DTAB.

LOOP AT LT_TAB INTO WA_TAB.

CASE WA_TAB-COL.

WHEN '0001'.

WA_DTAB-ZONE = WA_TAB-VALUE.

WHEN '0002'.

WA_DTAB-QTR1 = WA_TAB-VALUE.

WHEN '0003'.

WA_DTAB-QTR2 = WA_TAB-VALUE.

WHEN '0004'.

WA_DTAB-QTR3 = WA_TAB-VALUE.

WHEN '0005'.

WA_DTAB-QTR4 = WA_TAB-VALUE.

ENDCASE.

AT END OF ROW.

APPEND WA_DTAB TO LT_DTAB.

ENDAT.

ENDLOOP.

Thanks,

Kunal.

Hi All,

I am trying to fetch data from file server which is in EXCEL(.XLS) format.

Able to connect FTP using FTP_CONNECT,using FTP_COMMAND(get filename).

Now the problem is i am able to read text file but not EXCEL file.

How to capture the excel file entries,help me regarding this?

Sachin.

2 REPLIES 2
Read only

Former Member
0 Likes
623

Hi Sachin,

If you want to read the XLS file contains in an internal table, i have these codes, please try it, and if you face any problem, please let me know.

Thanks.

DATA: WA_TAB TYPE ALSMEX_TABLINE,

LT_TAB TYPE TABLE OF ALSMEX_TABLINE.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = 'C:\TEST.XLS'

I_BEGIN_COL = '1'

I_BEGIN_ROW = '1'

I_END_COL = '255'

I_END_ROW = '255'

TABLES

INTERN = lt_tab

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.

TYPES: BEGIN OF TY_DTAB,

ZONE TYPE STRING,

QTR1 TYPE STRING,

QTR2 TYPE STRING,

QTR3 TYPE STRING,

QTR4 TYPE STRING,

END OF TY_DTAB.

DATA: WA_DTAB TYPE TY_DTAB,

LT_DTAB TYPE TABLE OF TY_DTAB.

LOOP AT LT_TAB INTO WA_TAB.

CASE WA_TAB-COL.

WHEN '0001'.

WA_DTAB-ZONE = WA_TAB-VALUE.

WHEN '0002'.

WA_DTAB-QTR1 = WA_TAB-VALUE.

WHEN '0003'.

WA_DTAB-QTR2 = WA_TAB-VALUE.

WHEN '0004'.

WA_DTAB-QTR3 = WA_TAB-VALUE.

WHEN '0005'.

WA_DTAB-QTR4 = WA_TAB-VALUE.

ENDCASE.

AT END OF ROW.

APPEND WA_DTAB TO LT_DTAB.

ENDAT.

ENDLOOP.

Thanks,

Kunal.

Read only

former_member194669
Active Contributor
0 Likes
622

Possible option will be you need to transfer the file to local first then read using some function modules