08-17-2007 2:41 PM
Hello
I am a beginner in abap and I have a generic type declaration problem when I want to CALL METHOD cl_gui_frontend_services=>gui_uploadn
Could some one please help me out and with this? Thank you for your input.
Nadin.
FORM ada_pc_file_in_itab_stellen
TABLES ft_itab TYPE STANDARD TABLE
USING value(fw_filename) TYPE c
value(fw_filetype) TYPE c
value(fw_popup) TYPE c
value(fw_ausgabe_art) TYPE c
CHANGING fw_subrc LIKE sy-subrc
fw_lines LIKE w_lines.
DATA: lw_filename TYPE string.
DATA: lw_filetype TYPE char10.
DATA: lt_itab LIKE any table.
lw_filename = fw_filename.
lw_filetype = fw_filetype.
lt_itab = ft_itab.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = lw_filename
filetype = lw_filetype
CHANGING
data_tab = ft_itab
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.
ENDFORM.
08-17-2007 2:46 PM
08-17-2007 2:55 PM
Thank you Rich.
When I comment this line lt_itab = ft_itab.
it doesn't gives me an error but when I try to fun the program it gives me an error. Could you please be specific with your comment on this:
data_tab = ft_itab "<--- CHange this
Thank you
08-17-2007 3:00 PM
08-17-2007 3:04 PM
Hi,
Check this
report z0002.
data: ft_itab type filetable..
data: lw_filename type string.
data: lw_filetype type char10.
call method cl_gui_frontend_services=>gui_upload
exporting
filename = lw_filename
filetype = lw_filetype
changing
data_tab = ft_itab
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.
aRs
08-17-2007 3:24 PM
The error I get is
"Type conflict when calling a method."
Error analysis:
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught in
procedure "ADA_PC_FILE_IN_ITAB_STELLEN" "(FORM)", nor was it propagated by a
RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Type conflict when calling the method "GUI_UPLOAD" of the class
"CL_GUI_FRONTEND_SERVICES". It was tried
to transfer a non-compatible variable to the formal parameter "DATA_TAB".
This is my new code:
FORM ada_pc_file_in_itab_stellen
TABLES ft_itab
USING value(fw_filename) TYPE c
value(fw_filetype) TYPE c
value(fw_popup) TYPE c
value(fw_ausgabe_art) TYPE c
CHANGING fw_subrc LIKE sy-subrc
fw_lines LIKE w_lines.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = lw_filename
filetype = lw_filetype
CHANGING
data_tab = ft_itab
EXCEPTIONS
endform.
08-17-2007 3:30 PM
08-17-2007 3:36 PM
Thanks you all very much. I can't use the function GUI_UPLOAD bc it is non unicode and that's why I am calling the method of the class.
Problem still persist though.
08-17-2007 3:39 PM
GUI_UPLOAD is unicode compliant, it is actually called directly inside of the cl_gui_frontend_services=>gui_upload method, so in reality, you are using it. The difference between calling it directly and using the class, is that the class enforces that you do not pass an internal table with header line. Post all of your code so we can take a look.
Regards,
Rich Heilman
08-17-2007 3:47 PM
Hello Nadin
Sounds like you have to make the <b>SSM </b>(<i>Standard Schnittstellen Management</i>) Unicode-enabled.
The SSM has been developed by <b>Cirrus Consulting AG</b> for which I have worked until end of July.
In July I have adapted the SSM for Unicode systems since one of Cirrus' customers uses SSM and they have upgraded their systems to ECC 6.0 (Unicode).
You should change your coding as following:
FORM ada_pc_file_in_itab_stellen
"TABLES ft_itab TYPE STANDARD TABLE
TABLES ft_itab
USING value(fw_filename) TYPE c
value(fw_filetype) TYPE c
value(fw_popup) TYPE c
value(fw_ausgabe_art) TYPE c
CHANGING fw_subrc LIKE sy-subrc
fw_lines LIKE w_lines.
DATA: lw_filename TYPE string.
DATA: lw_filetype TYPE char10.
"DATA: lt_itab LIKE any table.
DATA: lt_data TYPE STANDARD table.
lw_filename = fw_filename.
lw_filetype = fw_filetype.
" lt_itab = ft_itab.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = lw_filename
filetype = lw_filetype
CHANGING
data_tab = ft_itab
data_tab = lt_data.
EXCEPTIONS
file_open_error = 1
...
ft_itab[] = lt_data.
...
Regards
Uwe
08-17-2007 4:03 PM
Hello Uwe,
thank you so much. When I uses this code
DATA: lt_data TYPE standard table.
I have the error: Any table expected not standard table.
when I change it to
DATA: lt_data TYPE any table
.
I get the message "you can not use generic types for fields. The table Types ANY and INDEX are generic.
Could you help on this Uwe? Thank you.
08-17-2007 5:31 PM
Hello Nadin
I think I simply replaced the GUI_UPLOAD function module this way:
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_UC_SSM_GUI_UPLOAD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zus_sdn_uc_ssm_gui_upload.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.
START-OF-SELECTION.
PERFORM gui_upload TABLES gt_knb1.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form GUI_UPLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GT_KNB1 text
*----------------------------------------------------------------------*
FORM gui_upload
TABLES ft_itab.
" TABLES ft_itab TYPE TABLE. " syntax ok
" TABLES ft_itab TYPE STANDARD TABLE. " snytax ok
* define local data
...
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = 'C:tempfile.txt'
* FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR = SPACE
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = SPACE
* CODEPAGE = SPACE
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* IMPORTING
* FILELENGTH =
* HEADER =
CHANGING
data_tab = ft_itab[] " brackets !!!
EXCEPTIONS
OTHERS = 99.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
...
ENDFORM. " GUI_UPLOAD
Regards
Uwe
08-17-2007 3:33 PM
You may need to specify the table to exclude any header line:
CHANGING
data_tab = ft_itab[] "<<<< table body only
Andrew
08-17-2007 3:35 PM