04-25-2007 12:32 PM
Hi,
My reqirment is to read the excel input data and then upload it to internal table for further proceeing but without using selection input screen. I mean can I mention the fixed file name and the path in the function module iself for the input file.
04-25-2007 12:37 PM
Hi,
I f not using the selection screen..
you can directly fix the file name and the path..
regards,
nazeer
04-25-2007 12:38 PM
Please dont create duplicate threads for the same problem. Plesae check answers of the previous thread.
Best Regards,
Vibha
04-25-2007 12:39 PM
Hi,
Yes
You can hardcode the filename, if needed, if you doesn't wants to use selection screen,
for the fun module
ASLM_EXCEL_TO_INTERNAL_TABLE
reward if useful
regards,
Anji
04-25-2007 12:39 PM
Hi,
Use FM
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = <b>p_file</b> "give file name
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 10
I_END_ROW = p_lineno
TABLES
INTERN = asset_excel
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.
Regards,
Sonika
04-25-2007 12:40 PM
Hi Vamsi,
Try this Sample Code. I used the custom table for this Example.
TABLES: ZVIJ.
DATA : BEGIN OF WA,
NAME(6) TYPE C,
AGE(3) TYPE C,
DES(5) TYPE C,
SALARY(3) TYPE C,
INCENT(3) TYPE C,
END OF WA,
IT LIKE TABLE OF WA WITH HEADER LINE.
DATA : BEGIN OF WA1,
NAME(6) TYPE C,
AGE TYPE I,
DES(4) TYPE C,
SALARY TYPE I,
INCENT TYPE I,
END OF WA1,
IT1 LIKE TABLE OF WA1 WITH HEADER LINE.
OPEN DATASET 'SAMP' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\Desktop\BOOK6.XLS'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = IT.
.
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 IT .
IT1-NAME = IT-NAME.
IT1-AGE = IT-AGE.
IT1-DES = IT-DES.
IT1-SALARY = IT-SALARY.
IT1-INCENT = IT-INCENT.
APPEND IT1.
ENDLOOP.
LOOP AT IT1.
ZVIJ-NAME = IT1-NAME.
ZVIJ-AGE = IT1-AGE.
ZVIJ-DES = IT1-DES.
ZVIJ-SALARY = IT1-SALARY.
ZVIJ-INCENT = IT1-INCENT.
INSERT ZVIJ.
ENDLOOP.
Thanks.
reward If Helpful.