Google Search - Blog...........

ABAP - Uploading Data From Excel Sheet To Internal Table Using FM ALSM_EXCEL_TO_INTERNAL_TABLE.

REPORT z_file3.

DATA: fname(40),
w_line TYPE i VALUE 1,
w_file TYPE rlgrap-filename.

DATA:
t_tab LIKE
TABLE OF ALSMEX_TABLINE
WITH HEADER LINE.

DATA: fs_tab LIKE LINE OF t_tab.


w_file = 'C:\Documents and Settings\ABC\Desktop\Book1.xls'.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = w_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 10
i_end_row = 100
tables
intern = t_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
.
IF sy-subrc NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
WRITE: 'UPLOAD SUCCESSFUL'.
ENDIF.

fname = '.\z_file.xls'.
OPEN DATASET fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT t_tab INTO fs_tab.
TRANSFER fs_tab TO fname.
ENDLOOP.

IF sy-subrc EQ 0.
WRITE: / 'FILE OPENED ON APPS SERVER'.
ELSE.
WRITE: / 'FILE COULD NOT BE OPENED'.
ENDIF.


ALSO READ:

- Uploading Images From PC To An Internal Table Using FM BDS_BUSINESSDOCUMENT_CREATEF.

- Uploading Data To The FTP Server Using FM GUI_UPLOAD And FILE_GET_NAME.

- Sample Program For Creating XML File On Presentation Server.

- Uploading Multiple Files At One Time.

- Download Data Into More Than One Excel Sheet.


RELATED POST:


RETURN TO MAIN INDEX:

- Sample Programs On Uploading & Downloading Files.

- Sample Programs On HR ABAP.

- Sample Report Programs On ALV List/ Grid Display.

- Sample Programs On Selection Screen.

- Sample Programs On BDC.

.....Back To MAIN INDEX.


2 comments:

  1. how can i read a excel file in batch mode ? i know that i need to use OPEN DATASET, but what happened with excel format ?

    ReplyDelete
  2. Dear Appiconda,
    Thanks a lot for you help, you save me !! realy
    Thanks thanks, thanks....

    ReplyDelete