‎2006 Jun 22 6:53 AM
HI experts,
am uploading the uploading data for MB1A T.CODE. IN session method while uploading the data. after executing the prg my prg is goes in to the dum, its giving error in call function
gui_upload, tables
dat_tab =it_tab.
so how can i solve problem
advance thanks
‎2006 Jun 22 6:57 AM
Check the interface properly.
The fields used to supply/recieve data from a Function module should have same data structures as that of interface of FM respectively.
I guess that is the problem.
Regards,
ND
‎2006 Jun 22 6:57 AM
Check the interface properly.
The fields used to supply/recieve data from a Function module should have same data structures as that of interface of FM respectively.
I guess that is the problem.
Regards,
ND
‎2006 Jun 22 7:01 AM
‎2006 Jun 22 7:02 AM
Check Few thinks..
1) The data structure and the traget fields as same.
2) The seperator used. is there any sepecial characters there in the file?
3) FILETYPE is 'ASC' ?
If not let me know the dump details.
rgds,
TM.
Message was edited by: Thomas Mann
Message was edited by: Thomas Mann
‎2006 Jun 22 7:35 AM
HI ,
OK THANKS BUT I HAVE define structure with all fields type c,
my file is like
21.06.2006 21.06.2006 222 BLORE 1234 6666
and mu structure is like TYPES : BEGIN OF LINES,
BLDAT(10) TYPE C,
BUDAT(10) TYPE C,
BWARTWA(3) TYPE C,
WERKS(4) TYPE C,
GRUND(4) TYPE C,
LGORT(4) TYPE C,
END OF LINES.
and file type as given like asc.
so what can i can i change
‎2006 Jun 22 7:53 AM
u gave like this in the TABLES parameter.
gui_upload,
tables
<b>dat_tab = it_tab[]</b>.
‎2006 Jun 22 7:07 AM
Hi,
gui_upload, tables
dat_tab =it_tab<b>[]</b>. <== Give me the body operator here
if ur problem not solved after this.
put a break point in sy-subrc and find the exception. then u'll get the idea.
if helps reward.
- Selva
‎2006 Jun 22 7:31 AM
Hi Raghuveer,
Check the FM
PARAMETERS: p_ifile TYPE dxfile-filename.
DATA : BEGIN OF itab OCCURS 0,
str TYPE string,
END OF itab,
l_file TYPE string.
CLEAR l_file.
l_file = p_ifile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
TABLES
data_tab = 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
OTHERS = 17.
‎2006 Jun 22 7:53 AM
ok thanks yaar,
but i have writeen sam like u but its not solved
‎2006 Jun 22 7:56 AM
‎2006 Jun 22 8:48 AM
Hi,
Consider this code. Working fine for me.
REPORT abc.
TYPES : BEGIN OF tp_final,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
werks TYPE marc-werks,
pstat TYPE marc-pstat,
END OF tp_final.
DATA : t_data TYPE STANDARD TABLE OF tp_final.
DATA : filen TYPE string.
PARAMETERS : p_filn TYPE rlgrap-filename.
filen = p_filn.
CONDENSE filen.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filen
filetype = 'ASC'
has_field_separator = '#'
TABLES
data_tab = t_data[]
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.These are my flat file contents.
MATNR MTART WERKS PSTAT
500000000000108181 ZSRV 1057 DV
500000000000108182 ZSRV 1057 DV
Reagards,
Arun Sambargi.
Message was edited by: Arun Sambargi
‎2006 Jun 22 9:57 AM
Hi,
&----
*& Report ZUPLOADTAB *
*& *
&----
*& Example of Uploading tab delimited file *
*& *
&----
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
*DATA: ld_file LIKE rlgrap-filename.
DATA: gd_file type string.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 LIKE pa0002-vorna,
name2 LIKE pa0002-name2,
age TYPE i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Internal table to upload data into
DATA: BEGIN OF it_datatab OCCURS 0,
row(500) TYPE c,
END OF it_datatab.
*Text version of data table
TYPES: BEGIN OF t_uploadtxt,
name1(10) TYPE c,
name2(15) TYPE c,
age(5) TYPE c,
END OF t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) TYPE c.
CONSTANTS: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
************************************************************************
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = p_infile
mask = ',*.txt.'
mode = 'O'
title = 'Upload File'(078)
IMPORTING
filename = p_infile
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
************************************************************************
*START-OF-SELECTION
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
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 NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
Alternative method, where by you split fields at each TAB after you
have returned the data. No point unless you dont have access to
GUI_UPLOAD but just included for information
*
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
filetype = 'ASC'
TABLES
data_tab = it_datatab "ITBL_IN_RECORD[]
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
ELSE.
LOOP AT it_datatab.
CLEAR: wa_string, wa_uploadtxt.
wa_string = it_datatab.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_record.
APPEND wa_record TO it_record.
ENDLOOP.
ENDIF.
************************************************************************
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
LOOP AT it_record INTO wa_record.
WRITE:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
ENDLOOP.
see this Sample program