Exceptions in cl_gui_frontend_services= file_open_dialog
hi when upgrading from 4.5 to 6.o Im getting the following exception
When the pop up box is cancelled during the download option, a success message is displayed in 6.0 whereas an error message is displayed in 4.5.
here is the code
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
DEFAULT_EXTENSION = '*.xls,'
DEFAULT_FILENAME = '*.xls,'
FILE_FILTER = '.'
CHANGING
file_table = W_FILENAME
rc = w_rc
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
IF W_RC IS NOT INITIAL.
READ TABLE W_FILENAME INTO W_AREA INDEX 1.
IF SY-SUBRC = 0.
L_FILE = W_AREA-FILENAME.
ENDIF.
ENDIF.
IF SY-SUBRC EQ 3.
MESSAGE I999 WITH 'Action Cancelled by user'(044).
EXIT.
ENDIF.
plz tell me where is the eror
chk the data declearsation data type.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Import from a local file'
default_extension = 'DAT'
DEFAULT_FILENAME =
file_filter = l_file_filter
initial_directory = 'C:\'
MULTISELECTION =
WITH_ENCODING =
CHANGING
file_table = l_file_table
rc = l_rc
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = V_FILE
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
CHANGING
DATA_TAB = IT_MAIN[]
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
OTHERS = 23.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Similar Messages
-
Hello Experts,
I am currently practicing BDC and I think the first step is to locate where my text file is. Now based on my code below, after selecting my text file nothing happens.
Also, what will be my next after getting the file from a specific location? Thanks guys!
REPORT z_aris_practice_bdc_0
NO STANDARD PAGE HEADING
LINE-SIZE 255
LINE-COUNT 64
MESSAGE-ID zz.
*BDC Data
DATA: BEGIN OF bdc_tab OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdc_tab.
*Internal Table
DATA: BEGIN OF it_input OCCURS 0,
user TYPE usr02-bname,
title TYPE sza5_d0700-title_medi,
lname TYPE addr3_data-name_last,
fname TYPE addr3_data-name_first,
initials TYPE addr3_data-initials,
nickname TYPE addr3_data-nickname,
function TYPE addr3_data-function,
END OF it_input.
DATA: gt_lines TYPE sy-tabix,
gt_file TYPE filetable,
wa_file TYPE filetable,
gt_subrc TYPE i.
*CONSTANTS
CONSTANTS: c_mask(60) TYPE c VALUE ',..'.
*Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_input LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_input.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILENAME =
FILE_FILTER =
initial_directory = 'C:\Temp\'
multiselection = 'X'
CHANGING
file_table = gt_file[]
rc = gt_subrc
USER_ACTION =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*START-OF-SELECTION
START-OF-SELECTION.
PERFORM put_in_itab.
PERFORM process_records.
*& Form get_files
text
FORM put_in_itab.
DATA: lv_file TYPE string.
lv_file = p_input.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file
FILETYPE = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_input
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.
ELSE.
DESCRIBE TABLE it_input LINES gt_lines.
ENDIF.
ENDFORM. "get_files
*& Form process_records
text
FORM process_records.
LOOP AT it_input.
ENDLOOP.
ENDFORM. "process_recordsHii viraylab,
go throgh this link..This sample code solves ur problem....
/people/milind.upasani/blog/2007/03/07/step-by-step-approach-to-ceate-simple-bdc-session-program-using-reusable-template
U are new to BDC it seems...
first u read the sap help ... then u will come know what to do after wards....
http://help.sap.com/saphelp_47x200/helpdata/en/fa/097720543b11d1898e0000e8322d00/frameset.htm
Be familiar with the structure BDCDATA.
<b>Data transfers</b> In this page..
Next u need to know about the <b>transaction RECORDER the tcode is SHDB.</b>
Nothing is difficult in this ..
For example When u r creating a data element in SE11 u go through some screens in a flow, by clicking some pushbuttons and by generating some function codes manually, and entering values manually...
But here u wont do it manually, these values will be populated from file into an internal table...
Before calling a transaction into which u r going to populate the data is to be filled into a table with structure <b>BDCDATA.</b>
<b>U need to use CALL TRANSACTION 'SE11' using BDCDATA or
the session method..</b>
Reward points for helpful answers...
sai ramesh -
Hi
I have where I have a selection screen that finds the file, you can say where to get the file. After that I need to close that window. How do I close it???
Below is an example of my program. After I choose the file and execute the program, I have a <b>write</b> statement. I don't see that statement on the screen. How do i terminate the input screen and display text.
Parameters : AUSZFILE LIKE RFPDO1-FEBUMSF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR AUSZFILE. "mo271101
DATA: L_FILES TYPE FILETABLE,
H_FILES TYPE FILE_TABLE,
L_RC LIKE SY-SUBRC.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG CHANGING
FILE_TABLE = L_FILES
RC = L_RC
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
IF SY-SUBRC <> 0 OR L_RC < 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO "mo271101
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE. "mo271101
READ TABLE L_FILES INDEX 1 INTO H_FILES.
AUSZFILE = H_FILES-FILENAME.
ENDIF.
Write AUSZFILE.
Thanks in advanceYou must remember the START-OF-SELECTION event here, after you select the file name and click F8, the START-OF-SELECTION event is triggered, but if it is not there, nothing will happen.
if sy-subrc <> 0 or l_rc < 0.
message id sy-msgid type sy-msgty number sy-msgno "mo271101
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else. "mo271101
read table l_files index 1 into h_files.
auszfile = h_files-filename.
endif.
start-of-selection. "<-- Add this
write:/ auszfile.
Regards,
RIch Heilman -
Hello All,
I am calling the method FILE_OPEN_DIALOG of the class CL_GUI_FRONTEND_SERVICES to display the pop up to select the file from the desktop.After i select the file and execute the program it displays the report and when i clcik the back button it gives me the pop up again.I have used CALL METHOD CL_GUI_CFW=>FLUSH.Inspite of this it is not working properly.
Thanks,
Rakesh.Try This.....
AT SELECTION-SCREEN ON VALUE-REQUEST FOR F_PATH.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = file
rc = rtrncode
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5 -
hi,
Im upgrading from 4.5b to ecc 6.0 in the following code the export parameter Default extn parameter in the call method
cl_gui_frontend_services=>file_open_dialog does not get displayed
i,e *.xls should be there bydefault it is not there in 6.0 how to get it. check the code once
ws_filename get fm is in comments
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = C_DEFFILE
DEF_PATH = L_LOCFILE
MASK = C_MASK
MODE = C_MODE
IMPORTING
FILENAME = L_FILE
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
IF SY-SUBRC EQ 3.
MESSAGE I999 WITH 'Action Cancelled by user'(044).
EXIT.
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
DEFAULT_EXTENSION = '*.xls,'
FILE_FILTER = '.'
CHANGING
file_table = W_FILENAME
rc = w_rc
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
IF W_RC IS NOT INITIAL.
READ TABLE W_FILENAME INTO W_AREA INDEX 1.
IF SY-SUBRC = 0.
L_FILE = W_AREA-FILENAME.
ENDIF.
ENDIF.CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'File Selection'
default_filename = '*.xls'
file_filter = '(*.xls)|*.XLS|'
CHANGING
file_table = lt_filetable
rc = lv_filecount
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5. -
Hi folks
When using the CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG or WS_FILENAME_GET we some times have the server path returned.
And sometimes the drive letter returned.
See two examples:
1: \\blrx1\os390out\id1\test.txt
2: R:\os390out\id1\test.txt
What to do when we ALWAYS want the server path returned??
Best regards
CarstenI have used this several times in my own coding and I always get the \\
in my end result
method import_the_file_locn.
data:
lv_wintitle type string value 'Select Upload File',
lv_deffile type string value 'asset_data',
lv_dir type string value 'c\:',
ls_file type line of filetable,
lv_rc type i,
lv_user_action type i.
free gv_sdir.
call method cl_gui_frontend_services=>file_open_dialog
exporting
window_title = lv_wintitle
default_filename = lv_deffile
initial_directory = lv_dir
changing
file_table = gt_file
rc = lv_rc
user_action = lv_user_action
exceptions
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
others = 4.
check lv_user_action is initial.
read table gt_file into ls_file index 1.
translate ls_file to lower case.
gv_sdir = ls_file.
endmethod.
I don't know whether it is perhaps a mapping issue / windows setting that results in the path returned with the mapped drive?
I just debugged one of methods above and I cant recreate the same issue when I pick up a file in a mapped directory, sorry.
I guess there is also the option for you to do some substring manipulation and path mapping in a look up table - but if you have hundreds of servers rather than a few maybe not the best workaround. -
CL_GUI_FRONTEND_SERVICES= FILE_OPEN_DIALOG
Hi Experts,
I have a customized program with BDC. first My program will convert a .dbf file into .xls file. My second program executes the .xls file.
The .xls file that I get from my first program will be transferred into a textbox in my second program.
But my second program is using CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG to execute a command. If you just enter the directory/path in the textbox it wont execute but if you use f4 the program will successfully be executed.
I have put my method in AT SELECTION-SCREEN. so that when I use the bdc it will automatically read the path BUT the dialogbox still appear.
How can I make the dialog box disappear but still it will execute the method ?
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
exporting
default_filename = cv_fname "'C:\USERS\Asd\DESKTOP\RATRA.XLS'
CHANGING
FILE_TABLE = t_files
RC = v_rcode
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
OTHERS = 4.Hi Jepoy,
You can set the result of the save button which is action_ok in a variable. So when u execute the same code again, just pass this below method call.
IF lv_result = cl_gui_frontend_services=>action_OK.
RETURN.
ENDIF.
Regards,
Sivaganesh -
Regarding CL_GUI_FRONTEND_SERVICES= FILE_OPEN_DIALOG
I'm using CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG to replace WS_FILENAME_GET which is an obsolete function module in ECC6.
WS_FILENAME_GET was making use of the file mask -
',.csv ,.csv ,.txt ,.txt.'
When I use the same string in the file_filter parameter of FILE_OPEN_DIALOG, it doesn't work.
Can somebody tell me the correct string format? I would like *.csv & *.txt as the file mask in the open dialog.
Thanks!Hi
U can give like this |.csv| ,|.csv |,|.txt |,|.txt.|'
i think it will work.
Thanks -
Hello,
I would like to set the file extension for cl_gui_frontend_services=>file_open_dialog such that my default extension in the file open dialogue is the .csv (comma-separated value) file. May I know how can I do that?
Thanks!
Regards,
AnyiHello,
Thanks for the quick reply.
Howeer, I tried to use the extension of CSV and the file dialogue opened up with .RTF (which is the default extension) instead.
Any comment on that?
Thanks!
Anyi
> HI,
>
> Here is the code
>
DATA: l_title TYPE string,
> l_dfext TYPE string,
> l_dfinm TYPE string,
> l_file TYPE string,
> l_path TYPE string,
> l_fpath TYPE string.
> le = 'SAVE FILE PATH'.
> l_dfext = 'csv'.
> l_dfinm = 'Error_Idoc'.
>
> CONCATENATE l_dfinm sy-datum sy-uzeit INTO l_dfinm
> SEPARATED BY '_'.
>
> CONCATENATE l_dfinm l_dfext INTO l_dfinm SEPARATED
> BY '.'.
>
> CALL METHOD
> cl_gui_frontend_services=>file_save_dialog
> EXPORTING
> window_title = l_title
> default_extension = l_dfext
> default_file_name = l_dfinm
> INITIAL_DIRECTORY = L_DIR
> CHANGING
> filename = l_file
> path = l_path
> fullpath = l_fpath
> CEPTIONS
> cntl_error = 1
> error_no_gui = 2
> OTHERS = 3.
> s,
> Richa -
Hi,
When I try to select a file to download or upload an LSMW project my SAP GUI freezes completely, and the only way out is to kill it via Windows task manager.
After quite some research I found out that:
- This happens only on some PC's (but all PC's have the same SAP GUI version, i.e . 7.10)
- When I debug this I see that the issue happens somewhere within CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
- The default folder passed to that method is C:\. If I change it to something else (in debug change mode), everything goes well
Anybody experienced this before?
Thanks
PatrickHi Jepoy,
You can set the result of the save button which is action_ok in a variable. So when u execute the same code again, just pass this below method call.
IF lv_result = cl_gui_frontend_services=>action_OK.
RETURN.
ENDIF.
Regards,
Sivaganesh -
Exception in CL_GUI_FRONTEND_SERVICES= FILE_COPY
Hi,
I am trying to use FILE_COPY method and getting an exception 'CNTL_ERROR'. I am also using another method as FILE_EXIST and getting same exception. But in this method 'GET_WINDOWS_DIRECTORY' I don't get any error and I am getting the windows directory as expected. And the interesting method is DIRECTORY_CREATE. After I called this method I am getting 'OTHERS' as exception, but the directory is created. Additonally, these methods are called with SAP 4.6 for this computer.
When I use these method on another computers which have SAP 6.4 or 6.2, I don't get these errors/exceptions.
Although all of the Application SAP Server are same for three computers, why there is a difference? And how can I solve the problems for first computer?
Thanks.John,
1. I am sure that source file is exist. And the path is true.
2. The destiantion is true also. and before copy operation, destination path has not have this file. Also, I have declared overrite to true in FILE_COPY method.
I want to ask CNTL_ERROR when happens? And I have seen some topics about CL_GUI_FRONTEND_SERVICES can not be used in SAP Gui 4.6. Is it possible to get more information about not to use in 4.6?
Additionally, I am connecting for all three computers using remote desktop. But as I said in previous message, problem only occurs the computer which's SAP Gui is 4.6 -
CL_gui_frontend_services-To read data by selecting file from file dialog
Hi I have a requirement in which -
I have to selct the file using file open dialog . Cl_gui_open_frontendservices . From this I have to read the data into internal table .
How can I get the data after getting the file name .
Does any one have idea on this .data: begin of itab_string occurs 0,
record type char255,
end of itab_string.
data: L_FILETABLE TYPE FILETABLE,
L_FILETAB_H TYPE FILETABLE WITH HEADER LINE.
data: p_file1 type string.
selection screen .
PARAMETERS: P_FILE TYPE LOCALFILE.
at selection-screen on value-request for P_FILE.
IF THE USER SELECT EXTENTION BUTTON IT WILL OPEN THE LOCAL DIRECTORY FOR SELECTING THE FILE LOCATION.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION = 'CSV'
DEFAULT_FILENAME = 'C:\Documents and Settings\kiran\Desktop\STATUS.csv'
FILE_FILTER =
INITIAL_DIRECTORY = 'C:\Documents and Settings\kiran\Desktop\'
MULTISELECTION =
WITH_ENCODING =
CHANGING
FILE_TABLE = L_FILETABLE
RC = RC
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
IF SY-SUBRC <> 0.
ELSE.
LOOP AT l_filetable INTO L_FILETAB_H.
P_FILE = L_FILETAB_H-FILENAME.
move p_file to p_file1.
EXIT.
ENDLOOP.
ENDIF.
passing the selected file name to gui_upload for loading the data
into internal table
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = p_file1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = itab_string
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 I000(Z00) WITH 'PLEASE PROVIDE CORRECT FILE NAME'.
ENDIF.
Reward points for all helpful answers,
kiran.M
Reward points if helpful and close this thread
Message was edited by:
KIRAN KUMAR -
How to replace ws_filename_get function module to file_open_dialog
how to replace ws_filename_get function module to file_open_dialog
Here it is,
DATA: i_file_name TYPE FILETABLE,
w_file_name TYPE FILE_TABLE,
v_rc TYPE i.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
INITIAL_DIRECTORY = 'C:\'
CHANGING
file_table = i_file_name
rc = v_rc
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
others = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE i_file_name INTO w_file_name INDEX 1.
No wthe w_file_name will contain the file name.
Regards
Kathirvel -
BAD DATA FORMAT using cl_gui_frontend_services= gui_upload
Hello SAPients!
I'm using the method cl_gui_frontend_services=>gui_upload to upload a file to my program like this
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = lvs_input_f1
filetype = 'ASC'
CHANGING
data_tab = in_rec[]
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
The SY-.SUBRC field always returns with a value of 8 (Bad data format?). The thing is that the last field of the structure IN_REC is of type i (integer) and I think this is the problem. I modified the file with a text editor and set the last field with 2, 4, 8 and 16 chars but I always receive the same error. I can't change the last field to char. Does any one have an idea of what is the problem? How can I ensure that the last field have an integer value?
Thank you.Ok, I have modified the code a bit, you might want to try it. First upload to a table of type STRING, then move the values to the other internal table.
report zrich_0001 .
data: begin of in_rec occurs 0,
matnr(18), "Material Number
bwkey like mbew-bwkey, " For Plant
werks like mbew-bwkey, " Add Plant
type(2) type c, " TYPE.
cname(50) type c, " Changble Name
bom(1) type c, " BOM Usage
task(2) type c, " task type
verid_nd like ckmlmv001-verid_nd, "Production Version
perc(16) type c, " Percent for Plant1
* above are user inputs ; below are program flag.
flag(1) type c, " Program flag.
kalnr like ckmlmv001-kalnr, "
mix_flag(1) type c, " Program flag.
cnt type i,
end of in_rec.
data: istr type table of string with header line.
parameters: p_file type localfile.
at selection-screen on value-request for p_file.
data retfiletable type filetable.
data retrc type sysubrc.
data retuseraction type i.
call method cl_gui_frontend_services=>file_open_dialog
exporting
multiselection = abap_false
changing
file_table = retfiletable
rc = retrc
user_action = retuseraction.
read table retfiletable into p_file index 1.
start-of-selection.
perform open_file.
*& Form OPEN_FILE
form open_file.
*------------------------ Begin Change - UN001 ------------------------*
* CALL FUNCTION 'WS_UPLOAD'
* EXPORTING
* filename = input_f1
* filetype = 'DAT'
* TABLES
* data_tab = in_rec.
data:
lvs_input_f1 type string. " To store filename
* lit_mat_tbl TYPE TABLE OF lt_raw_tab, " To store file lines
* lwa_mat_tbl TYPE lt_raw_tab. " Work area
lvs_input_f1 = p_file.
* lvs_input_f1 = input_f1.
call method cl_gui_frontend_services=>gui_upload
exporting
filename = lvs_input_f1
filetype = 'ASC'
changing
data_tab = istr[]
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 = 19.
if sy-subrc ne 0.
* WRITE / text-e01.
message e000(fb) with text-e01.
endif.
loop at istr.
in_rec = istr.
append in_rec.
endloop.
loop at in_rec.
write:/ in_rec.
endloop.
*------------------------ End Change - UN001 ------------------------*
*SKD 08/02/06---------DEVK980441-----------v
delete in_rec where perc = 0.
*SKD 08/02/06---------DEVK980441-----------^
endform. "OPEN_FILE
Regards,
Rich Heilman -
Exception condition "NOT_SUPPORTED_BY_GUI" raised issue
Hi experts,
I use this method CL_GUI_FRONTEND_SERVICES->FILE_OPEN_DIALOG on ABAP webdynpro.
But got subject exception.
Is it something wrong with my GUI version?
Thank you in advance.
Exception code in the method
*-check if valid GUI is available----
IF IS_VALID_HANDLE( ) NE 0 AND cl_gui_control=>www_active IS INITIAL.
RAISE NOT_SUPPORTED_BY_GUI.
ENDIF.
Note
The following error text was processed in the system NW7 : Exception condition "NOT_SUPPORTED_BY_GUI" raised.
The error occurred on the application server and in the work process 3 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: FILE_OPEN_DIALOG of program CL_GUI_FRONTEND_SERVICES======CP
Method: ONACTIONSEARCH of program /1BCWDY/8F7FTC9E6OGCQL0JTNVT==CP
Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/8F7FTC9E6OGCQL0JTNVT==CP
Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP
Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP
Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP
Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP
Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP
Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP
Method: IF_WDR_RUNTIME~EXECUTE of program CL_WDR_MAIN_TASK==============CP
Richard>use this method CL_GUI_FRONTEND_SERVICES->FILE_OPEN_DIALOG on ABAP webdynpro.
and that was your problem...
this is as the class says - a GUI based call - you can't call it from the browser. Instead you should use the FileUpload UI element.
If you need any other details or want alternate solutions (including references to using Flex, ACF applet utilities etc) - have a quick search of the forum - the same issue has been reported/raised many, many times.
Good luck,
Chris
Maybe you are looking for
-
Find & replace part of a string in Numbers using do shell script in AppleScript
Hello, I would like to set a search-pattern with a wildcard in Applescript to find - for example - the pattern 'Table 1::$*$4' for use in a 'Search & Replace script' The dollar signs '$' seem to be a bit of problem (refers to fixed values in Numbers
-
ICal 2.0.5 and iOS 4.1 vs. MobileMe
I have a PPC iMac G5 running OS 10.4.11 and utilizing iCal 2.0.5. These are the latest versions of the respective software that this computer can run. I recently paid for a family MobileMe account in the hopes of coordinating my calendars and contact
-
Mac formatted ipod to transfer songs to windows computer
my friends gave me an ipod as a gift and they put my favorite songs in it....but they used a mac and now i want to put those songs into my computer but mine is a windows...i know i have to restore it but doing that will erase everything...and i cant
-
Error when refreshing web intelligence document less then every minute
Hi all, I get the following error, when refreshing document via javascript more often then every minute: Server Error in '/Dashboard' Application. FatalException occured. The cause was : BusinessObjects.Enterprise.OcaFramework.Oca.oca_abuse: IDL:img.
-
ALSA : LADSA plugin syntax help
Hey all, I just set-up my .asoundrc file on a new build. Using the declip plugin, in my alsa config, is producing some sound in the left channel, and only silence, interrupted by repetitious clicks, in the right channel. Using Audacious, which ship