2006 Dec 11 9:53 PM
hi all,
i am getting the following error when trying to execute the following program to upload excel fileto internal table in BW. I know it is a simple one...i couldnt figure out myself...
Error message:
Program ZUPLOAD_EXCEL
<b>Field "ALSMEX_TABLINE" is unknown. It is neither in one of the
specified tables nor defined by a "DATA" statement.</b>
I got the program from the following post
I am using the program posted by shejal shetty
i got the similar error when i tried to use another program also.
plz help me there..
the following is my code
&----
*& Report ZUPLOAD_EXCEL *
*& *
&----
*& *
*& *
&----
REPORT ZUPLOAD_EXCEL .
tables : zmat_match.
data : g_repid like sy-repid,
$v_start_col type i value '1',
$v_start_row type i value '1',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
DATA : BEGIN OF it_table OCCURS 0,
MTART LIKE zmat_match-mtart,
mtpos LIKE zmat_match-mtpos,
disgr LIKE zmat_match-disgr,
mtvfp LIKE zmat_match-mtvfp,
dismm LIKE zmat_match-dismm,
beskz LIKE zmat_match-beskz,
sbdkz LIKE zmat_match-sbdkz,
sfcpf LIKE zmat_match-sfcpf,
disls LIKE zmat_match-disls,
match_code LIKE zmat_match-match_code,
END OF it_table.
data: itab like alsmex_tabline occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Get the data from XLS to Internal Table
perform upload_data.
&----
*& Form upload_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append it_table.
clear it_table.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
it_table-mtart = itab-value.
when '0002'.
it_table-mtpos = itab-value.
when '0003'.
it_table-disgr = itab-value.
when '0004'.
it_table-mtvfp = itab-value.
when '0005'.
it_table-dismm = itab-value.
when '0006'
it_table-beskz = itab-value.
when '0007'
it_table-sbdkz = itab-value.
when '0008'
it_table-sfcpf = itab-value.
when '0009'
it_table-disls = itab-value.
when '0010'
it_table-match_code = itab-value.
endcase.
endloop.
endif.
append it_table.
ENDFORM. " upload_data
thanks in advance
ravi
points will be assigned for inputs...
2006 Dec 11 10:27 PM
Did you copy paste the code from IE to ABAP editor directly? Try remooving all data declaration and type em manually.
or
Paste the the code from IE into notepad and copy paste from notepad into se38.
Regards
Sridhar
2006 Dec 11 10:08 PM
Hi,
try reducing the value of
$v_end_row type i value '5536'.
i guess the FM DOESN'T SUPPORT MORE THAN 10000 RECORDS ATA ATIME.
THANKS
2006 Dec 11 10:11 PM
hi preeti,
i tried that, but it is still showing the same error, should i do something else too?
ravi
2006 Dec 11 10:15 PM
whats the format of your excel file. I mean the first row does it have data, Imean whats the first cell which holds data in it.
Shejal.
2006 Dec 11 10:22 PM
The error says that the data type is not existing. First go to transaction se11 and check if you can see the structure of ALSMEX_TABLINE there. If you cant then that the problem.
- Guru
Reward points for helpful answers
2006 Dec 11 10:26 PM
hi guruprasad,
i checked in se11 and the structure of ALSMEX_TABLINE doesnt exist there, what should i do now? should i create it, if so how do i know the fields and stuff?
looks like it is sap owned...
hi sheetal,
my first row holds data...but i am getting this error when i am trying to activate the program....i didnt even go far as execution....
2006 Dec 11 10:32 PM
In SE11 u dont find, ALSMEX_TABLINE?
It should be there it is SAP owned structure and should exist.
check out again.
Shejal.
2006 Dec 11 10:32 PM
There are two options.
1. If you are using this structure across many programs then create a structure globally through se11 and your program will work.
2. If you are not using it else where and is local only to your program then declare it internally in your program using the DATA statement.
The structure of ALSMEX_TABLINE shoudl be the same as that of your excel file.
- Guru
Please reward points if you find answers helpful
2006 Dec 11 10:27 PM
Did you copy paste the code from IE to ABAP editor directly? Try remooving all data declaration and type em manually.
or
Paste the the code from IE into notepad and copy paste from notepad into se38.
Regards
Sridhar
2006 Dec 11 10:32 PM
hi,
i am able to find the structure in ALSMEX_TABLINE in r/3 but not in BW...i am trying to do this in BW. so can i manually create the structure in customer namespace or can i ask basis to do something to get in to bw? any suggestion there?
ravi
2006 Dec 11 10:38 PM
I dont have idea of things work in BW but i would suggest you to create a structure in the program and use it, which is of the same format as of ALSMEX_TABLINE.
Hope this helps,
Shejal.
2006 Dec 11 10:49 PM
hi shejal,
can you give me the code for doing so...i am not good in abap..or point me to a document ....
2006 Dec 11 10:59 PM
My concern is this, even if you were to create the structure, I fear that this function module may not even exist in the BW system anyway, If you were to create the structure and activate your program, syntax check will pass, but you will get an ABAP dump when the function is called(if it doesn't exist). So you next problem will be that the function simply doesn't exist in your BW system. Check that the function exists in SE37, if it does, then you have to ask why is the structure missing as it is supposed to be used in the funciton module signature.
I'm thinking that since the structure is not there, the function module is not either.
Regards,
Rich Heilman
2006 Dec 11 11:13 PM
hi rich heilman,
nice to see answer from you. you are right. i created a z structure ..but is saying ALSM_EXCEL_TO_INTERNAL_TABLE doesnt exist I also checked in se37 and it dosnt exist.... so can this be eliminated if i convert excel to text file. i have the macros to convert excel to text file. i see a function by name UPLOAD_FILES
plz suggest me
thanks in advance
Message was edited by:
ravi a
2006 Dec 11 11:19 PM
Well, I'm sure we agree that you are not going to be able to use the mentioned function module, so we are going to have to get around it. Personally, I like to use comma delimited files. You can save your excel file as a .csv file. This puts a comma between all of the columns. You can then try using the function module GUI_UPLOAD. I hope this exists in BW. You will want to declare an internal table of strings, and another to hold all of the values. Use GUI_UPLOAD to upload the comma delimited file and then loop at this internal table and use the SPLIT statement to separate the data at comma(,) into the various fields. Here is a sample program.
report zrich_0001.
types: begin of ttab,
rec(1000) type c,
end of ttab.
types: begin of tdat,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of tdat.
data: itab type table of ttab with header line.
data: idat type table of tdat with header line.
data: file_str type string.
parameters: p_file type localfile.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = p_file.
start-of-selection.
file_str = p_file.
call function 'GUI_UPLOAD'
exporting
filename = file_str
tables
data_tab = itab
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.
loop at itab.
clear idat.
split itab-rec at ',' into idat-fld1
idat-fld2
idat-fld3.
append idat.
endloop.
loop at idat.
write:/ idat-fld1, idat-fld2, idat-fld3.
endloop.
REgards,
Rich Heilman
2006 Dec 12 2:39 AM
hi Rich Heilman,
you program woks prefect, i added single insert statement to move records from idat in to my own custom table zmat. the problem is zmat table has only one extra field MANDT , the first column is writiing into that and getting overwritted by system...can you help me there how to insert starting from second column onwards....
thanks in advance
2006 Dec 12 2:50 AM
2006 Dec 12 6:26 AM
thanks frends for all the swift replies...this is my first post in abap forums....
awarded points for all useful inputs