‎2008 Apr 17 1:52 PM
Hi,
i am uploading a file which is have 587 width, i have used declaration of string for the internal table but i am not getting complete data...here the code is below....
DATA: BEGIN OF data_all OCCURS 0,
all type string ,
END OF data_all.
IF p_fname IS INITIAL.
MESSAGE i150(pn).
EXIT.
ELSE.
MOVE p_fname TO fname.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FNAME
tables
data_tab = data_all.
so please let me know y i am not getting complete data.....in the data_all internal table which is in the file.....
‎2008 Apr 17 2:25 PM
Hi,
You r not getting the file into P_file .
for this use f4_filename.
then move p_file into the string type variable then pass it into the GUI_Upload.
For uploading the flat file on ur presentation server use GUI_upload .
then ur problem may be solve.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FNAME
filetype = 'ASC'
tables
data_tab = data_all.
Reward If Helpful.
Jagadish.
‎2008 Apr 17 2:28 PM
Also give filetype
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FNAME
filetype = 'ASC'
tables
data_tab = data_all.
‎2008 Apr 17 2:45 PM
hi Jagdish,
i already assigned the p_fname to the string type variable(fname) and then i had passed to to the gui_upload.....but here my question is as i am uploading the data but i am getting only length upto 256 characters in the table output of the gui_upload......more than 256 characters per line is existing in my uploading file....but i am not getting the complete data.....
chandu: as file type is default 'asc' i think there is no need of providing the file type.....
guys anyone who knows please help me out of this....
Thanks in advance...!
brahma
‎2008 Apr 17 2:48 PM
‎2008 Apr 17 2:54 PM
hi imran,
but it is throwing sy-subrc 5, which is the file type is wrong.....but here i think it is not a problem...but i think in the declaration part some thing is wrong as i had declared the type which i had shown in above...
ABAPers please help out....
Thanks in Advance...!
Brahma.
‎2008 Apr 17 3:52 PM
Hi all,
Any one who knows about this....please help me out.....
Thanks in Advance...!
Brahma
‎2008 Apr 17 2:52 PM
Hi,
1.Specify the length of string.
eg: DATA: BEGIN OF data_all OCCURS 0,
all(255) type string ,
END OF data_all.
2.Give the file name and file type in the function module.
FILENAME = 'D:\ABAP EVE\file1.txt'
FILETYPE = 'ASC'
Reward,if useful.
Thanks,
Chandu
‎2008 Apr 17 3:51 PM
I copied your code and tried it, and it works just fine.
I upload a text file with variable length, where one line has 429 characters!!!
Are you sure about the line size of your file? Doesn't it have a string in which a Carriage Return Line Feed is incorporated (hexadecimal value perhaps). What do you see when you open your file with notepad / wordpad?
Edited by: Micky Oestreich on Apr 17, 2008 4:52 PM
‎2008 Apr 17 3:58 PM
Hi MICKY,
Thanks for valuable suggestion.....can i have ur mail id so that i can send u my file which i am uploading so that u can try it.....please do this for me.....as i am not getting any idea for this simple uploading i dont know where i am getting error....i will send u file...if you dont have any concerns...let me know your id....please
Thanks in Advance...!
Brahma
‎2008 Apr 17 4:11 PM
You can, click on my name (link) on the left and you know where to send it.
MAKE SURE IT'S NOT TOOOOO BIG, only need a few records for testing.
Edited by: Micky Oestreich on Apr 17, 2008 5:15 PM
‎2008 Apr 17 3:56 PM
hi boss if you had already known the field then you can use the length of the field why you r using the string ( may be some cases the string takes the value 256 in length ) . if you dont know the length ..then use this..
REPORT zc1download message-id zc1dwnmsg.
&----
*& Declaration Section for the Tables *
&----
TABLES: makt.
&----
*& Declaration Section for the Internal Tables
&----
DATA: intab TYPE TABLE OF makt,
wa_intab LIKE LINE OF intab,
no_of_rec TYPE i,
count TYPE i.
DATA: BEGIN OF f_intab,
str(255) TYPE c,
END OF f_intab.
DATA: t_intab LIKE TABLE OF f_intab,
w_intab LIKE LINE OF t_intab,
temp(255) TYPE c.
FIELD-SYMBOLS: <f> TYPE ANY.
&----
*& Selection ScreenSection for the file download
&----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: file TYPE rlgrap-filename MEMORY ID file,
tab RADIOBUTTON GROUP rad1 DEFAULT 'X',
others RADIOBUTTON GROUP rad1,
delimit TYPE c.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
IF file IS INITIAL. " check to ensure file.
MESSAGE i001.
EXIT.
ENDIF.
IF others = 'X'. " check to ensure delimiter.
IF delimit = ' '.
MESSAGE i002.
EXIT.
ENDIF.
ENDIF.
SELECT * FROM makt INTO TABLE intab.
IF tab = 'X'. " default delimiter tab is used
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = file
filetype = 'DAT'
mode = 'A'
TABLES
data_tab = intab
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE. " If user defind delimiter is to be used
Counts the number of fields *
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.
IF sy-subrc <> 0.
EXIT.
ELSE.
count = count + 1.
ENDIF.
ENDDO.
LOOP AT intab INTO wa_intab.
DO count TIMES. " Adding the delimiter in required places
ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.
CONCATENATE temp delimit <f> INTO temp.
ENDDO.
SHIFT temp.
APPEND temp TO t_intab.
CLEAR temp.
ENDLOOP.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = file
filetype = 'ASC'
mode = 'A'
TABLES
data_tab = t_intab .
WRITE:/ 'The Data has been tranfered to :', file.
regards,
venkat
‎2008 Apr 17 4:13 PM
Dear Bramha,
please have a look on this code
types: begin of ty_down,
i_length(600) type C,
end of ty_down.
data: down type table of ty_down.
data typety type STRING.
typety = p_pfile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = typety
FILETYPE = 'ASC'
TABLES
DATA_TAB = down
regards
Kiran
‎2008 Apr 18 2:04 PM