‎2009 Feb 09 1:07 PM
I am uploadign hte file using GUI_UPLOAD.
When the file is not available, the sy-subrc is not zero and hte system message is thrown.
After this message, the user is thrown out of transaction.
My requirement is to prompt the error message to the user but the user should remain on the same file selection screen.
Anyidea?
Thanks in advance.
‎2009 Feb 09 1:09 PM
Hi,
Give the user message after chking sy-subc as
if sy-subrc NE 0.
Message 'Error in uploading' type 'I'. ***You can give either 'E' if it is Error message
endif.
‎2009 Feb 09 1:12 PM
This is my code.
I am getting hte appropriate error message.
However after error message display, the user has to hit enter and after hitting enter se is sent out of the transaction.
I want the usee to remain on the same transaction.
Thanks
‎2009 Feb 09 1:15 PM
hi,
After,
throwing error message...
if it is a report then u can use
LEAVE TO SCREEN 1000.
or if it is a module pool...then use ...
Call transacation 'TCODE'.
‎2009 Feb 09 1:19 PM
Hi,
Use STOP Command after the message.
IF sy-subrc NE 0.
Message 'No Input File is available' type 'I'.
STOP..
ENDIF.
‎2009 Feb 09 1:20 PM
Hi,
If u have fieldname ( as F4 help ) on selection screen,
then place ur message in at selection-screen on fieldname.
Thanks.
‎2009 Feb 09 1:09 PM
Hi,
and gui_upload function module should be in the at selection-screen event....
After the gui_upload function module... use the if condition as given below....
IF sy-subrc <> 0.
message 'File not found' type 'E'.
ENDIF.
Regards,
Siddarth
‎2009 Feb 09 1:11 PM
Hi,
you have to do like below.
CALL FUNCTION 'GUI_UPLOAD' "#EC *
EXPORTING
filename = l_s_file
filetype = 'ASC'
has_field_separator = c_x
replacement = '#'
TABLES
data_tab = g_t_file1
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.
{ Begin of Addition SN1
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
MESSAGE text-rc1 TYPE 'S' RAISING file_open_error.
EXIT.
WHEN 2.
MESSAGE text-rc2 TYPE 'S' RAISING file_read_error.
EXIT.
WHEN 3.
MESSAGE text-rc3 TYPE 'S' RAISING no_batch.
EXIT.
WHEN 4.
MESSAGE text-rc4 TYPE 'S' RAISING gui_refuse_filetransfer.
EXIT.
WHEN 5.
MESSAGE text-rc5 TYPE 'S' RAISING invalid_type.
EXIT.
WHEN 6.
MESSAGE text-rc6 TYPE 'S' RAISING no_authority.
EXIT.
WHEN 7.
MESSAGE text-rc7 TYPE 'S' RAISING unknown_error.
EXIT.
WHEN 8.
MESSAGE text-rc8 TYPE 'S' RAISING bad_data_format.
EXIT.
WHEN 9.
MESSAGE text-rc9 TYPE 'S' RAISING header_not_allowed.
EXIT.
WHEN 10.
MESSAGE text-r10 TYPE 'S' RAISING separator_not_allowed.
EXIT.
WHEN 11.
MESSAGE text-r11 TYPE 'S' RAISING header_too_long.
EXIT.
WHEN 12.
MESSAGE text-r12 TYPE 'S' RAISING unknown_dp_error.
EXIT.
WHEN 13.
MESSAGE text-r13 TYPE 'S' RAISING access_denied.
EXIT.
WHEN 14.
MESSAGE text-r14 TYPE 'S' RAISING dp_out_of_memory.
EXIT.
WHEN 15.
MESSAGE text-r15 TYPE 'S' RAISING disk_ful.
EXIT.
WHEN 16.
MESSAGE text-r16 TYPE 'S' RAISING dp_timeout.
EXIT.
WHEN OTHERS.
MESSAGE text-r17 TYPE 'S' RAISING unknown_error.
EXIT.
ENDCASE.
Hope it helps!!
Regards,
Pavan
‎2009 Feb 09 1:26 PM
Hi friend,
If u want to handle error by urself, then simply use
AT SELECTION-SCREEN .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\Testing.xls'
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = g_t_mara1
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 i010(zawi_demo). (Your information message)
ENDIF.
START-OF-SELECTION.
.........
Thanks...