ALSM_EXCEL_TO_INTERNAL_TABLE
I have a report which is uploading data from excel and using function ALSM_EXCEL_TO_INTERNAL_TABLE to get the data into internal table.
I have used bdc and called transaction to perform a task.
CALL TRANSACTION 'tran' USING bdc_tab MODE 'N'.
Now i need to run my report in background.While executin program in background job got canceled with job log as
"ABAP/4 processor: RAISE_EXCEPTION"
Details of error:
000010 FUNCTION WS_QUERY.
000020 *"
000030 ""Lokale Schnittstelle:
000040 *" IMPORTING
000050 *" VALUE(ENVIRONMENT) TYPE C OPTIONAL
000060 *" VALUE(FILENAME) TYPE C OPTIONAL
000070 *" VALUE(QUERY) TYPE C
000080 *" VALUE(WINID) TYPE C OPTIONAL
000090 *" EXPORTING
000100 *" VALUE(RETURN)
000110 *" EXCEPTIONS
000120 *" INV_QUERY
000130 *" NO_BATCH
000140 *" FRONTEND_ERROR
000150 *"
000160
000170 * check FILENAME NOT INITIAL : FL GL 11.8.1994
000180 * : FE
000190 * : DE
000200 * check WINID NOT INITIAL : WI ==> INV_QUERY
000210
000220 DATA: GUI_EXIST TYPE C VALUE SPACE.
000230
000240 CALL FUNCTION 'GUI_IS_AVAILABLE'
000250 IMPORTING
000260 RETURN = GUI_EXIST.
000270
000280 IF GUI_EXIST IS INITIAL.
> RAISE NO_BATCH.
000300 ENDIF.
<REMOVED BY MODERATOR>
Title and Message edited by: Alvaro Tejada Galindo on Dec 31, 2007 11:23 AM
Hello Concern,
Back Ground Job will not take file from presentation Server. To do such thing you have following way..
1. Either Save the Data file in Appliation Server itself.
2. Better to save the file in File Server.
In my org. we have started with Application Server but later on Basic guys say due to this there is performance issue so we have change it to File Server.
Hope it help you,
Regards
Swati Namdeo
Similar Messages
-
Uploading Excel file using 'ALSM_EXCEL_TO_INTERNAL_TABLE'
Hi,
I am uploading excel file into an internal table using 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
but I'm getting a popup with the message
'There is a large amount of the information on the clipboard. Do you want to be able to paste this information into another programme later.' and there are three buttons in the popup 'YES', 'CANCEL' and 'NO'. but for any choice there is no data in the internal table.
the progrsm is working in other systems but giving problem in customer laptop, can you please tell me is there any settings need to set for EXCEL or SAP.
system details are as below
OS: windows 7
MS-Office - 2007
SAP : ECC06Looks like there was an intention to clear the clipboard in the code, but this does not seem to work.
I copied the function module to my own version and added the following code, which seems to work :
* clear clipboard
refresh excel_tab.
call method cl_gui_frontend_services=>clipboard_export
importing
data = excel_tab
changing
rc = ld_rc
exceptions
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
others = 4
* Copy only one cell to prevent the clipboard data message.
call method of worksheet 'Cells' = h_cell
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'Cells' = h_cell1
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'RANGE' = range
exporting #1 = h_cell #2 = h_cell1.
m_message.
call method of range 'SELECT'.
m_message.
* copy marked area (whole spread sheet) into Clippboard
call method of range 'COPY'.
m_message.
* quit Excel and free ABAP Object - unfortunately, this does not kill
* the Excel process
call method of application 'QUIT'.
m_message. -
What's the difference between FM 'UPLOAD' and FM 'ALSM_EXCEL_TO_INTERNAL_TABLE'
thanks!hi,
Generally FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' is used for reading Excel sheet i.e, either row wise or column wise . where as WS_UPLOAD will read the entire data in to an internal table in a file format.
for illustration as how it is used check this out
PARAMETER p_infile like rlgrap-filename.
*START OF SELECTION
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_infile
i_begin_col = '1'
i_begin_row = '2' "Do not require headings
i_end_col = '14'
i_end_row = '31'
tables
intern = itab
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e010(zz) with text-001. "Problem uploading Excel Spreadsheet
endif.
http://www.sapdevelopment.co.uk/file/file_upexcelalt2.htm
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
http://www.sapdevelopment.co.uk/file/file_uptabpc.htm
Regards,
Santosh -
Problem in Function Module "ALSM_EXCEL_TO_INTERNAL_TABLE"
Dear All,
In this function module we give the number of end rows to be picked from the excel sheet. So, please tell me what can be the maximum number, currently I have put 4000 end rows.
Thanx&Reg,
NishuHai Nishu
*& Report ZK_REPORT *
REPORT ZK_REPORT.
internal table declarations
DATA: BEGIN OF ITAB OCCURS 0,
NAME(20) TYPE C,
ADDR(20) TYPE C,
END OF ITAB.
DATA: ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
DATA: K1 TYPE I VALUE 1,
M1 TYPE I VALUE 1,
K2 TYPE I VALUE 100,
M2 TYPE I VALUE 9999.
use FM for uploading data from EXCEL to internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = 'C:\book1.xls'
I_BEGIN_COL = K1
I_BEGIN_ROW = M1
I_END_COL = K2
I_END_ROW = M2
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.
WRITE:/ ITAB1.
ENDLOOP.
Thanks & regards
Sreeni -
Problems using ALSM_EXCEL_TO_INTERNAL_TABLE in Web Dynpro ABAP
Hello experts, im using the fm ALSM_EXCEL_TO_INTERNAL_TABLE.
When i call this fm from a web dynpro i have a dump that says that cannot import the clipboard.
Any ideas why this is happening?
(The parameter of the function are Ok, becouse if I call the function from SAP/R3 everything work fine)
ThankS!>
Mariano Gallicchio wrote:
> Thanks for the answer!
>
> I will continue searching for other fm!
I didn't mean to imply that there is a Function Module that should work from Web Dynpro. In fact I would be highly suprised if there was one. As already posted in this forum, the only way to get data from the client desktop is with the fileUpload UI element. No function module is going to be able to work with the Web Dynpro UI element. -
Query Related to FM ALSM_EXCEL_TO_INTERNAL_TABLE
hi guru,
I want to know how many row and column we can upload through FM ALSM_EXCEL_TO_INTERNAL_TABLE.
one more query is that.. when we using this FM, I unable to upload data through .txt file... so there is any way to upload data through both .txt and excel.
plz help me..
Edited by: Manish Sharma on Jul 25, 2009 9:01 AMHi manish,
you can get from this function module,try this "TEXT_CONVERT_XLS_TO_SAP".
<=<< Sharing Knowledege is a way to Innovative >=>>
By,
Yoga -
Excel to internal table upload 'ALSM_EXCEL_TO_INTERNAL_TABLE' issue
I am using ALSM_EXCEL_TO_INTERNAL_TABLE function module to upload the excel into an internal table. In case there is a column with no data. This function module is still populating the previous row data into the internal table
Ex. if the Excel has data like the below 3 rows and 3 columns
1 10 5.0
20
2 6.0
The internal table is posting data like this
1 10 5.0
1 20 5.0
2 20 6.0
Please tell me if i am missing something to be added in the below snip of code
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = B1
I_BEGIN_ROW = C1
I_END_COL = B2
I_END_ROW = C2
TABLES
INTERN = IT_upload
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC = 0.
ENDIF.
LOOP AT IT_upload.
CASE IT_Upload-COL.
WHEN 1.
IT_Excel-BILLCO = IT_Upload-VALUE.
WHEN 2.
IT_Excel-PONUM = IT_Upload-VALUE.
WHEN 3.
CLEAR v_upload.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = IT_upload-value
IMPORTING
OUTPUT = v_upload.
IT_Excel-STORENUM = v_upload.
WHEN 4.
IT_Excel-VINVNUM = IT_Upload-VALUE.
WHEN 5.
IT_Excel-LINEITNUM = IT_Upload-VALUE.
WHEN 6.
IT_Excel-LINEITAMT = IT_upload-VALUE.
WHEN 7.
IT_Excel-TAXAMT = IT_upload-VALUE.
WHEN 8.
IT_Excel-TOTAL = IT_upload-VALUE.
ENDCASE.
AT END OF ROW.
APPEND IT_Excel.
ENDAT.
ENDLOOP.Hi,
Please check below link. surely it will help u.
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105
Thanks
Jitendra -
'ALSM_EXCEL_TO_INTERNAL_TABLE issue
Hi
I tried below fm to download data. But sy-subrc value is 2
pls help me
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_pcfile
i_begin_col = 1
i_begin_row = 2
i_end_col = 255
i_end_row = 65000
tables
intern = it_material
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.hi,
Check out the file format and the path ...Refer the below path for a piece of code for reference
http://www.sapdev.co.uk/file/file_upexcelalt2.htm
Regards,
Santosh -
FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' Problem ..
i use the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' .
My only and strange problem is that when i execute the report i take the notification that i must save my excel file !!!!
I don't open the file for writing !!!! Look my code to see what happens ...
REPORT YDP_EXAG_TRAP .
TYPE-POOLS TRUXS.
TABLES : YREPORTS.
DATA: BEGIN OF ITAB OCCURS 0 ,
REPORTNR LIKE YREPORTS-REPORTNR,
SALESMAN LIKE YREPORTS-SALESMAN,
TITLE LIKE YREPORTS-TITLE,
REPCAT LIKE YREPORTS-REPCAT,
CDATE LIKE YREPORTS-CDATE,
TR_DATE LIKE YREPORTS-TR_DATE,
VI_DATE LIKE YREPORTS-VI_DATE,
SOFIA LIKE YREPORTS-SOFIA,
SOF_HAL LIKE YREPORTS-SOF_HAL,
FILENAME LIKE YREPORTS-FILENAME,
LAND1 LIKE YREPORTS-LAND1,
KUNNR LIKE YREPORTS-KUNNR,
TR_DATE1 LIKE YREPORTS-TR_DATE1,
NEW_CUST LIKE YREPORTS-NEW_CUST,
RADIO,
END OF ITAB.
DATA: W_CHK LIKE ALSMEX_TABLINE-VALUE.
DATA : MYITAB LIKE TABLE OF ALSMEX_TABLINE WITH HEADER LINE.
*DATA : MYITAB LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
PARAMETERS : S_FILE LIKE RLGRAP-FILENAME.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = 'X'
CHANGING
FILE_NAME = S_FILE.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = S_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 19
I_END_ROW = 19
TABLES
INTERN = MYITAB
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 MYITAB.
CASE MYITAB-ROW.
WHEN '2'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-REPORTNR.
WHEN '3'.
MOVE MYITAB-VALUE TO ITAB-SALESMAN.
WHEN '7'.
MOVE MYITAB-VALUE TO ITAB-TITLE.
ENDCASE.
WHEN '7'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-CDATE.
WHEN '6'.
MOVE MYITAB-VALUE TO ITAB-REPCAT.
ENDCASE.
WHEN '10'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-TR_DATE.
WHEN '6'.
MOVE MYITAB-VALUE TO ITAB-REPCAT.
ENDCASE.
WHEN '13'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-TR_DATE1.
ENDCASE.
WHEN '14'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-TR_DATE1.
WHEN '4'.
MOVE MYITAB-VALUE TO W_CHK.
ENDCASE.
WHEN '19'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-NEW_CUST.
ENDCASE.
ENDCASE.
ENDLOOP.
APPEND ITAB.
END-OF-SELECTION.
Please help ....
Points will be rewarded .....REPORT YDP_EXAG_TRAP .
TYPE-POOLS TRUXS.
TABLES : YREPORTS.
DATA: BEGIN OF ITAB OCCURS 0 ,
REPORTNR LIKE YREPORTS-REPORTNR,
SALESMAN LIKE YREPORTS-SALESMAN,
TITLE LIKE YREPORTS-TITLE,
REPCAT LIKE YREPORTS-REPCAT,
CDATE LIKE YREPORTS-CDATE,
TR_DATE LIKE YREPORTS-TR_DATE,
VI_DATE LIKE YREPORTS-VI_DATE,
SOFIA LIKE YREPORTS-SOFIA,
SOF_HAL LIKE YREPORTS-SOF_HAL,
FILENAME LIKE YREPORTS-FILENAME,
LAND1 LIKE YREPORTS-LAND1,
KUNNR LIKE YREPORTS-KUNNR,
TR_DATE1 LIKE YREPORTS-TR_DATE1,
NEW_CUST LIKE YREPORTS-NEW_CUST,
RADIO,
END OF ITAB.
DATA: W_CHK LIKE ALSMEX_TABLINE-VALUE.
DATA : MYITAB LIKE TABLE OF ALSMEX_TABLINE WITH HEADER LINE.
*DATA : MYITAB LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
PARAMETERS : S_FILE LIKE RLGRAP-FILENAME.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = 'X'
CHANGING
FILE_NAME = S_FILE.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = S_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 19
I_END_ROW = 19
TABLES
INTERN = MYITAB
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 MYITAB.
CASE MYITAB-ROW.
WHEN '2'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-REPORTNR.
WHEN '3'.
MOVE MYITAB-VALUE TO ITAB-SALESMAN.
WHEN '7'.
MOVE MYITAB-VALUE TO ITAB-TITLE.
ENDCASE.
WHEN '7'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-CDATE.
WHEN '6'.
MOVE MYITAB-VALUE TO ITAB-REPCAT.
ENDCASE.
WHEN '10'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-TR_DATE.
WHEN '6'.
MOVE MYITAB-VALUE TO ITAB-REPCAT.
ENDCASE.
WHEN '13'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-TR_DATE1.
ENDCASE.
WHEN '14'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-TR_DATE1.
WHEN '4'.
MOVE MYITAB-VALUE TO W_CHK.
ENDCASE.
WHEN '19'.
CASE MYITAB-COL.
WHEN '1'.
MOVE MYITAB-VALUE TO ITAB-NEW_CUST.
ENDCASE.
ENDCASE.
ENDLOOP.
APPEND ITAB.
LOOP AT ITAB.
CLEAR YREPORTS.
SELECT SINGLE * FROM YREPORTS WHERE REPORTNR = ITAB-REPORTNR.
IF SY-SUBRC = 4.
MOVE-CORRESPONDING ITAB TO YREPORTS.
IF W_CHK = 'TRUE'.
MOVE 'X' TO YREPORTS-SOFIA.
ENDIF.
INSERT YREPORTS.
ELSE.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
TITEL = 'ΜΗΝΥΜΑ ΛΑΘΟΥΣ ...... '
TEXTLINE1 = 'Η ΕΓΓΡΑΦΗ ΗΔΗ ΥΠΑΡΧΕΙ !!!!!!'
TEXTLINE2 = 'ΑΛΛΑΞΤΕ ΤΗΝ ΕΓΓΡΑΦΗ ΣΤΟ EXCEL ΓΙΑ ΝΑ ΣΥΝΕΧΙΣΕΤΕ ....'
START_COLUMN = 25
START_ROW = 6.
ENDIF.
ENDLOOP.
END-OF-SELECTION. -
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
Hi experts,
I have a doubt in fn module..
i gave the flat file data as
matnr mbrsh mtart maktx meins
z58723 m roh dfsdfsd kg
z57934 m roh rsdrss ea
when i am uploading from excel to mm01 t.code
in matnr it takes z58723 and in
mbrsh it takes z not m and in mtart it takes z587 not roh....
i think u can understand.....help me please.....Hello,
Check with this sample.
DATA: G_T_FILE LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*download the excel data into an internal table
IF NOT P_FILE IS INITIAL.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = G_C_START_COL
I_BEGIN_ROW = G_C_START_ROW
I_END_COL = G_C_END_COL
I_END_ROW = G_C_END_ROW
TABLES
INTERN = G_T_FILE
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE E000(SU) WITH TEXT-004.
ENDIF.
ENDIF.
LOOP AT G_T_FILE.
IF G_T_FILE-COL = '1'.
G_T_DEBI-KUNNR = G_T_FILE-VALUE.
ENDIF.
IF G_T_FILE-COL = '2'.
G_T_DEBI-LAND1 = G_T_FILE-VALUE.
ENDIF.
IF G_T_FILE-COL = '3'.
G_T_DEBI-VBUND = G_T_FILE-VALUE.
ENDIF.
IF G_T_FILE-COL = '4'.
G_T_DEBI-AKONT = G_T_FILE-VALUE.
ENDIF.
AT END OF ROW.
APPEND G_T_DEBI.
CLEAR G_T_DEBI.
ENDAT.
ENDLOOP.
Cheers,
Vasanth -
About the 'ALSM_EXCEL_TO_INTERNAL_TABLE'
Hi all,
I use the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' to write a report for the upload the Excel to Datatable.
And now, i am wondering to know wheater this FM is international or not, cause this report may be deliver to customers, and we hope this report will keep stable as soon as possible.
thank you very much!Hi!
You didn't find answer for this, because it is not possible. If you run your program in background, it is running on the server, and does not have any connection to your local machine. That's why you can't upload/download in background mode.
You might try to address somehow your local PC, with its IP or MAC address, but I don't think does this task worth so much time.
Run your program in online mode, or if you want to run it in background, then upload your file into the SAP server.
Regards
Tamá -
ALSM_EXCEL_TO_INTERNAL_TABLE upload
Hi All,
How can i upload the multiple entries
Material Number 5/14/2009 5/15/2009 5/16/2009 5/17/2009 5/18/2009 5/19/2009
PALM100HK 2902 2349 1243 0 1390 4570
PALM120HK 2902 2349 1243 0 1390 4570
I am getting the first line of material PALM100HK
my code :
CLEAR : lt_intexcel.
REFRESH: lt_intexcel.
lv_infile = p_file.
Uploading the data in the file into internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = lv_infile
i_begin_col = 1
i_begin_row = 1
i_end_col = 100
i_end_row = 100
tables
intern = lt_excel[]
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE text-c01 TYPE 'I'.
LEAVE TO TRANSACTION 'ZMIARL02'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
LOOP AT lt_excel.
read table lt_excel with key row = 2 col = 1. " <= order type
if sy-subrc = 0.
wa_line1-ordertype = lt_excel-value.
endif.
read table lt_excel with key row = 2 col = 2. " <= producttype
if sy-subrc = 0.
wa_line1-producttype = lt_excel-value.
endif.
read table lt_excel with key row = 2 col = 3. " <= material
if sy-subrc = 0.
wa_line1-material = lt_excel-value.
endif.
read table lt_excel with key row = 2 col = 4. " <= souceplant
if sy-subrc = 0.
wa_line1-sourceplant = lt_excel-value.
endif.
read table lt_excel with key row = 2 col = 5. " <= targetplant
if sy-subrc = 0.
wa_line1-targetplant = lt_excel-value.
endif.
read table lt_excel with key row = 2 col = 6. " <= slocation
if sy-subrc = 0.
wa_line1-slocation = lt_excel-value.
endif.
*delivery date
if flag7 = space.
read table lt_excel with key row = 1 col = LV_COL7. " <= delivery date
if sy-subrc = 0.
wa_line1-deliverydate = lt_excel-value.
FLAG7 = 'X'.
endif.
elseif flag7 = 'X'.
LV_COL7 = LV_col7 + 1.
read table lt_excel with key row = 1 col = lv_col7. " <= delivery date
if sy-subrc = 0.
wa_line1-deliverydate = lt_excel-value.
ENDIF.
endif.
*at end of row.
*quantity
if flag8 = space.
read table lt_excel with key row = 2 col = LV_COL8. " <= quantity
if sy-subrc = 0.
wa_line1-quantity = lt_excel-value.
FLAG8 = 'X'.
endif.
elseif flag8 = 'X'.
LV_COL8 = LV_col8 + 1.
read table lt_excel with key row = 2 col = lv_col8. " <= quantity
if sy-subrc = 0.
wa_line1-quantity = lt_excel-value.
ENDIF.
endif.
*at end of row.
*at end of col.
append wa_line1 to gt_line1.
clear wa_line1.
*endat.
*endat.
ENDLOOP.
endif.Duplicate thread. Please close
-
Information regarding ALSM_EXCEL_TO_INTERNAL_TABLE function module
Hi,
I am using "ALSM_EXCEL_TO_INTERNAL_TABLE" function module for reading 'XLS' file from client machine into internal table. Now question is "IS there is need of Micosoft office installed on client machine for reading excel file to internal table"
ThankuSandip,
No, To display the output in excel it needs. -
Incorrect result using the function ALSM_EXCEL_TO_INTERNAL_TABLE
I have used the function ALSM_EXCEL_TO_INTERNAL_TABLE to load a Excel sheet on an internal table and the function returns the following result:
Row Col Value
0001 0001 902000100 A601 K 627542130 021 AGARDUN ZMAS 673 EU
0002 0001 902000101 A602 K 627542131 022 AGARDUN ZMAS 695 EU
0003 0001 902000102 A603 K 627542132 023 AGARDUN ZMAS 717 EU
0004 0001 902000103 A604 k 627542133 024 AGARDUN ZMAS 739 EU
0005 0001 902000104 A605 k 627542134 025 AGARDUN ZMAS 761 EU
0006 0001 902000105 A606 W 627542135 026 AGARDUN ZMAS 783 EU
0007 0001 902000106 A607 W 627542136 027 AGARDUN ZMAS 805 EU
0008 0001 902000107 A608 W 627542137 028 AGARDUN ZMAS 827 EU
0009 0001 902000108 A609 K 627542138 029 AGARDUN ZMAS 849 EU
0010 0001 902000109 A610 k 627542139 030 AGARDUN ZMAS 871 EU
0011 0001 902000110 A611 O 627542140 031 AGARDUN ZMAS 893 EU
That is to say, the excel sheet has nine columns, and the function thinks that only has 1 column.
I have checked the function with the same file in other computers, and the result has been the correct one, that is to say, the function returns the value of the column in its corresponding column:
Row Col Value
0001 0001 902000100
0001 0002 A601
0001 0003 K
0001 0004 627542130
0001 0005 021
0001 0006 AGARDUN
0001 0007 ZMAS
0001 0008 673
0001 0009 EU
0002 0001 902000101
0002 0002 A602
0002 0003 K
0002 0004 627542131
0002 0005 022
0002 0006 AGARDUN
0002 0007 ZMAS
0002 0008 717
0002 0009 EU
Can you help me?
Thanks.Hi Garduño,
1. U want to upload data from EXCEL
into internal table.
2. and u are using ALSM_EXCEL_TO_INTERNAL_TABLE.
3. But We cannot do this direclty !
For uploading purpose :
6. There are TWO options.
a) either save the excel to TAB Delimited file,
and use GUI_UPLOAD to upload the data in internal table.
b) use FM for excel purpose.
7. a) is easy and recommended
8. b) there is a FM for it,
but we have to apply some more logic
bcos the FM uploads data of excel
in the intenal table,
CELL BY CELL
9. afTER THAT , we have to convert this cell by cell data,
into our format of internal table.
10. use this code (just copy paste in new program)
(it is tried wit T001 structure data)
(it will AUTOMATICALLY based upon the
fields of internal table,
convert data from cell by cell,
to that of internal table fields)
REPORT abc.
DATA : ex LIKE TABLE OF alsmex_tabline WITH HEADER LINE.
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : cmp LIKE TABLE OF rstrucinfo WITH HEADER LINE.
DATA : col TYPE i.
DATA : col1 TYPE i.
FIELD-SYMBOLS : .
DATA : fldname(50) TYPE c.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = 'd:def.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = 100
i_end_row = 100
TABLES
intern = ex
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
BREAK-POINT.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = sy-repid
fieldname = 'T001'
TABLES
components = cmp.
LOOP AT ex.
AT NEW row.
IF sy-tabix = ex-value.
ENDLOOP.
BREAK-POINT.
regards,
amit m. -
Error in FM :Alsm_Excel_to_Internal_Table
Hi Everyone,
I Tried to Upload Excel File to internal table using FM:Alsm_excel_to_internal_table._I am getting error like UPLOAD_OLE .
Any one Help me why that error is occurring and how to solve it.
Thanks in AdvanceHi Santosh,
You are getting this error due to improper file name given. Use this function module to get the name of file to be uploaded by F4.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_PATH'
* STATIC = ' '
* MASK = ' '
CHANGING
FILE_NAME = P_PATH
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
Where P_PATH is: the filename.
PARAMETERS:
P_PATH TYPE RLGRAP-FILENAME MODIF ID A2.
Regards,
Amit.
Maybe you are looking for
-
LACK of Apple Support!!!! (iTunes help)
I have 2 computers I've tried to upgrade my iTunes for. Both failed and now I don't have any operational iTunes program available. Which means, I can't update my iPod with new songs as iTunes does not work on either computer. One computer reads: "Inv
-
Embedded Fonts on Dynamic Label Component
I am working on a project that calls for multiple label components to be dynamically rendered based on a selected comboBox selectedItem. The comboBox is a choice of fonts available to the user - all of which are embedded fonts. For some reason, the f
-
SharePoint 2007 Export to Excel 2010 or Excel 2013 Fails to Export All Fields in All Items View
Hi All, When I am trying to export the SharePoint View from SharePoint site to Spreadsheet (Excel 2013), I am able not able to export the the whole data, I'm missing some numerical columns from being displayed in Excel I have Infopath form (2007) pub
-
Hi Experts, Need your help in editing the JAVA mapping code...I know it would be done by some external tool like Eclipse, netweaver studio..I just need to make a small change in the code and reimport the same in PI mapping. Can someone help me in pro
-
Hello I have this css file and i can only view the code, when I try to click on the design view its greyed out. This wasnt the case last week when I could view it fine. Can anyone help me? Thanks