2008 Jul 22 3:16 PM
Hi all,
when using bdc with data in an input file ie txt file,how should the data be defined in it.
Eg: if i have 2 fields emp_id , name ,salary, i defined it like this:
emp.txt
'101','abc',80
'102',xyz',100
'103','pqr',50
and using fm 'gui_upload to save it in itab.
But it is not coming in proper format in itab.
is the input file in proper format?
Thanx
bhakti
2008 Jul 22 3:26 PM
Hi!
You can handle this file like this:
TYPES: begin of t_file,
line(1000)
end of t_file.
DATA: gt_file TYPE STANDARD TABLE OF t_file,
gs_file LIKE LINE OF gt_file.
DATA: lv_path TYPE string VALUE 'C: emp ile.txt'
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_path
has_field_separator = ' ' "if the file is separated by tabulators, then put an X into this parameter
tables
data_tab = gt_file.
LOOP AT gt_file INTO gs_file.
SPLIT gs_file-line AT ',' INTO field1 field2 field3.
ENDLOOP.
Regards
Tamá
Hi all,
when using bdc with data in an input file ie txt file,how should the data be defined in it.
Eg: if i have 2 fields emp_id , name ,salary, i defined it like this:
emp.txt
'101','abc',80
'102',xyz',100
'103','pqr',50
and using fm 'gui_upload to save it in itab.
But it is not coming in proper format in itab.
is the input file in proper format?
Thanx
bhakti
2008 Jul 22 3:26 PM
Hi!
You can handle this file like this:
TYPES: begin of t_file,
line(1000)
end of t_file.
DATA: gt_file TYPE STANDARD TABLE OF t_file,
gs_file LIKE LINE OF gt_file.
DATA: lv_path TYPE string VALUE 'C: emp ile.txt'
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_path
has_field_separator = ' ' "if the file is separated by tabulators, then put an X into this parameter
tables
data_tab = gt_file.
LOOP AT gt_file INTO gs_file.
SPLIT gs_file-line AT ',' INTO field1 field2 field3.
ENDLOOP.
Regards
Tamá
2008 Jul 23 9:28 AM
2008 Jul 22 3:31 PM
Hi,
You do not need to have those single quotes in your file.
Best regards,
Kazmi
2008 Jul 23 5:02 AM
2008 Jul 22 3:31 PM
Bhakti,
i feel in SDN there is zillien of thread for same you need to just search them.
Amit.
2008 Jul 23 5:02 AM
Amit,
if you want to answer than do it else let people answer...
may there be zillion of same type ques...
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |