2007 Mar 19 5:43 AM
hi i need to upload a file from presentation server to internal table and i need to check whether the file nami is not blenk and throw a error message !!1 how to do it?
hi i need to upload a file from presentation server to internal table and i need to check whether the file nami is not blenk and throw a error message !!1 how to do it?
2007 Mar 19 5:44 AM
if not itab[] is initial.
else.
message.....
endif.
regards
shiba dutta
null
2007 Mar 19 5:46 AM
Hi,
You can make the Selection screen field as mandatory first. because without file, no upload takes place.
Next before calling the fun module GUI_UPLOAD.write like this.
if not p_file is initial. (for file)
or it not itab[] is initial. (for Int table)
call function gui_upload
...
endif,.
regards,
Anji
Message was edited by:
Anji Reddy Vangala
2007 Mar 19 5:53 AM
"----
Type declaration of the structure to hold file data *
"----
data:
begin of fs_table1,
str type string,
end of fs_table1.
"----
Internal table to hold file data *
"----
data:
t_table1 like standard table
of fs_table1.
call function 'GUI_UPLOAD'
exporting
filename = 'C:\Assign\kna1'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = t_table1
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 <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
loop at t_table1 into fs_table1.
write:/ fs_table1-str.
endloop. " LOOP AT T_TABLE1...
if t_table1[] is initial.
message 'the file is empty' type 'E'.
endif.
reward if helpful.
regards,
kiran kumar k
2007 Mar 19 5:53 AM
check the internal table using
if not itab[] is initial.
do
else.
message.....
endif.
Regards,
2007 Mar 19 6:08 AM
Hi Sushant,
If you want to know " Whether the file is empty or not ", before uploading a file from presentation server.Use Function Module <b>WS_QUERY</b>,
in this Function Module you can see one parameter "QUERY", in that you can put
either CD' 'FE' 'FL' 'EN' 'WI' 'WS' ....... .Here <b>FL</b> is nothing but a file length. Set paramter as FL so that you will get <b>File Size</b> before uploading a file from presentation server.OK.
Reward,if helps.
Regards,
V.Raghavender.
2007 Mar 19 6:31 AM
IF p_file NP c_file_extn .
MESSAGE File should be in *.XLS format
ENDIF.
Here P_FILE is the parameter for File on selection Screen.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |