Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

input file for bdc

Former Member
0 Likes
634

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
612

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á

6 REPLIES 6
Read only

Former Member
0 Likes
613

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á

Read only

0 Likes
612

Thanx tamas..

it did work...

Read only

Former Member
0 Likes
612

Hi,

You do not need to have those single quotes in your file.

Best regards,

Kazmi

Read only

0 Likes
612

Thanx kazmi for your reply...

Read only

Former Member
0 Likes
612

Bhakti,

i feel in SDN there is zillien of thread for same you need to just search them.

Amit.

Read only

0 Likes
612

Amit,

if you want to answer than do it else let people answer...

may there be zillion of same type ques...