05-18-2006 5:09 PM
Hi, ABAPers,
this is my first post in this forum.
I have a (to me) very strange problem which I can not figure out. BTW, SAP 4.6B with SAP-Gui 640, Windows XP Sp2
this is my program:
REPORT zhma_gprism .
TYPES: ty_line(1024) TYPE c.
TYPES: BEGIN OF ty_download,
zline TYPE ty_line,
END OF ty_download.
TYPES: tyt_downloads TYPE STANDARD TABLE OF ty_download.
DATA: tl_downloads TYPE tyt_downloads.
PARAMETERS: p_fname1 TYPE rlgrap-filename,
p_fname2 TYPE rlgrap-filename.
CLEAR tl_downloads. REFRESH tl_downloads.
BREAK-POINT.
PERFORM download_data TABLES tl_downloads
USING p_fname1.
BREAK-POINT.
PERFORM download_data TABLES tl_downloads
USING p_fname2.
BREAK-POINT.
PERFORM download_data TABLES tl_downloads
USING p_fname1.
BREAK-POINT.
PERFORM download_data TABLES tl_downloads
USING p_fname2.
FORM download_data TABLES pt_downloads TYPE tyt_downloads
USING value(p_fname) TYPE rlgrap-filename.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_fname
FILETYPE = 'ASC'
IMPORTING
FILELENGTH =
TABLES
data_tab = pt_downloads
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
OTHERS = 6.
IF sy-subrc EQ 0.
WRITE:/ 'OK', p_fname.
ELSE.
WRITE:/ 'Err', sy-subrc, p_fname.
ENDIF.
ENDFORM. " DOWNLOAD_DATA
and these are my files:
TEXT1.txt:
123456789a 1289b
123456789a 123456789b
123789a 123456789b
123456789a 1239b
123456789a 123456789b
123456789a 123456789b
1236789a 123456789b
123456789a 12349b
123456789a 123456789b123456789a 123456789b
123456789a 123456789b
123456789a 123489b
1234589a 123456789b
TEXT2.txt:
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
HéikoMáérz789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
1234567HéikoMáérz6789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 123456789_20
v
123456789_10 123456789_20
v
vHéikoMáérz
v
HéikoMáérzv
123456789_10 123456789_20
123456789_10 123456789_20
123456789_10 HéikoMáérz456789_20
123456789_10 123456789_20123456789_10 123456789_20
1234567HéikoMáérz_10 123456789_20
vHéikoMáérz
vHéikoMáérzHéikoMáérzHéikoMáérz
v
vv
and finally TEXT3.txt:
C490200604
0A0001E002;10276451244
0A0001E004;MyCompany
0A0001E005;5126
0A0001E006;HéikoMáérz
0A0001E007;MyCompany
0A0001E008;tér
0A0001E009;1
0A0001F001;20060101
0A0001F002;20060331
0A0001F006;1
and this is what happens: I can upload TEXT1.txt and TEXT2.txt as much as I like and in any order, no problem.
As soon as I include TEXT3.txt the subsequent upload of ANY file creates a short-dump
DATA_OFFSET_NEGATIVE
The system tried to access field "LINEBUFFER" with offset
"-2" in the current program "SAPLSFES ".
Partial field access is not allowed with negative offset specifications.
The termination occurred in the ABAP/4 program "SAPLSFES " in
"PUT_LINEBUFFER".
and I really don't know how to solve this problem.
I searched SAP Notes but did not find anything that seemed relevant to my problem.
Help!
Cheers,
Heiko
05-19-2006 11:41 AM
Hi,
when you do it, and say F3, come out of SE37, and again try from beginning. but i am not getting any dump. come out of SE37, not simply F3.
Regards
vijay
05-18-2006 5:27 PM
Hi,
in your FM , pass the file name as
<b>
DATA:L_FILENAME TYPE STRING.
Move P_FNAME to L_FILENAME.</b>
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
<b>filename = L_FILENAME</b>
FILETYPE = 'ASC'
IMPORTING
FILELENGTH =
TABLES
data_tab = pt_downloads
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
OTHERS = 6.
IF sy-subrc EQ 0.
WRITE:/ 'OK', p_fname.
ELSE.
WRITE:/ 'Err', sy-subrc, p_fname.
ENDIF.
ENDFORM. " DOWNLOAD_DATA
Hope , you won't get dump.
Please mark point if it's helpful for you.
Thanks,
Pramod
05-18-2006 5:31 PM
Hi,
gui_ulpad takes the filename only string type.
so try to move the p_file to some string type variable , and then pass it to gui_download.
Regards
vijay
05-19-2006 9:50 AM
Hi,
I am sorry, I did not make myself very clear. Acutally I changed filename to type string as I found that by searching SDN before, but it did not change anything.
The problem is with my third file, and I can create the short dump even in transaction SE37 for function 'GUI_UPLOAD':
SE37 --> Single Test --> upload TEXT3.txt (OK),
back with F3, execute again, short dump, somehow it has to do loading TEXT3.txt two times in a row with GUI_UPLOAD (actually it does not make any difference what I specify as the second file, I always get a short dump for the second upload).
Cheers,
Heiko
05-19-2006 9:58 AM
Hi,
it is because the file is not proper, and the internal table is not able to hold the values properly what ever is inside the file. and also try to save your file as tabdelimited file, and provide HAS_FIELD_SEPARATOR = 'X' so that all fields will fit in to itab properly. check your file first create the correct file and save it as tab delimited file using excel.
regards
vijay
05-19-2006 10:16 AM
Hi vijay,
thank you very much, that is what I expected, that there was some problem with the file.
I had expected GUI_UPLOAD to read the lines (the file is an ASCII flat file after all) into the internal table (the lines are type c with length 1024 after all) and interpret the text just as text, even if it contains characters that in some scenarios might be considered delimiters.
Could you tell me what makes this file 'corrupt'?
Thank you very much in advance,
cheers,
Heiko
05-19-2006 10:24 AM
not sure, and i don't what you are giving init. and make sure you have provided the correct file. to check give the data properly with tabs separated. and are you taking this file into itab of type c lenght 1024. are you not taking it to internal table fields.
can you tell me what is your file contents.
Regards
vijay
05-19-2006 10:51 AM
Hi vijay,
the file I am trying to upload is an ASCII-flatfile saved on a Windows XP NTFS directory and contains just the following lines:
C490200604
0A0001E002;10276451244
0A0001E004;MyCompany
0A0001E005;5126
0A0001E006;HéikoMáérz
0A0001E007;MyCompany
0A0001E008;tér
0A0001E009;1
0A0001F001;20060101
0A0001F002;20060331
0A0001F006;1
and I can duplicate the short dump even from transaction SE37 for the function module GUI_UPLOAD
(SE37 for GUI_UPLOAD, F8, give filename, F8 --> uploads fine; back with F3, F8 again --> shortdump)
which makes me guess the problem is not really with the way I call GUI_UPLOAD in my report.
Thank you very much,
cheers,
Heiko
05-19-2006 11:05 AM
Hi,
i did the same test with your file, i didn't get any Dump. it is uploading to itab. in test i am only giving the filename and then F8. thats it.and F3 ,and F8 nothing is happening.
are you open the file by any chance and using GUI_UPLOAD that will give dump. and what Dump says. can you paste it.
Regards
vijay
05-19-2006 11:22 AM
Hi vijay,
my short dump (from SE37, GUI_UPLOAD, second upload) in a nutshell:
ABAP runtime errors DATA_OFFSET_NEGATIVE
Error analysis
The system tried to access field "LINEBUFFER" with offset
"-2" in the current program "SAPLSFES ".
Partial field access is not allowed with negative offset specifications.
System environment
SAP Release.............. "46B"
Operating system......... "HP-UX"
Release.................. "B.11.11"
Hardware type............ "9000/800"
Database type............ "ORACLE"
Character set............ "sapuni"
SAP kernel............... "46D"
Database version......... "OCI_805_64__OCI_7_API "
Patch level.............. "2212"
Source code extract
006590 FORM PUT_LINEBUFFER USING DATA LEN.
006600 IF LEN > 0.
-
> MOVE DATA TO LINEBUFFER+LINEBUFFERSIZE(LEN).
006620 LINEBUFFERSIZE = LINEBUFFERSIZE + LEN.
006630 ENDIF.
006640 ENDFORM.
Thank you very much,
cheers,
Heiko
05-19-2006 11:41 AM
Hi,
when you do it, and say F3, come out of SE37, and again try from beginning. but i am not getting any dump. come out of SE37, not simply F3.
Regards
vijay
05-19-2006 12:13 PM
Hi,
yes, but in my actual problem I have to upload two files similar to the one I gave as an example, and I get the short dump when I call GUI_UPLOAD the second time, after a day of trying to find the problem I find out it is just the function module GUI_UPLOAD and I can even recreate the short dump with SE37 alone.
It seems as if something is not initialised correctly before the second call in the same LUW.
Thank you,
cheers,
Heiko
05-20-2006 7:17 AM
just before calling the FM
CALL FUNCTION 'GUI_UPLOAD'
clear and refresh the itab passed for
data_tab = pt_downloads
clear: pt_downloads .
refresh: pt_downloads.
This should solve the issue.
Regards
Raja
05-26-2006 5:47 PM
Dear all,
we have opened a call with SAP Service Marketplace, I will tell you the results.
Cheers,
Heiko
06-14-2011 5:00 PM
Hi, wondering how did you solve this issue, am facing same issue..
thanks,