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

BDC - upload (text file)

Former Member
0 Likes
1,325

HI all,

I have my input text file with tab delimited data. I want to upload the data from text file into internal table. Which function module shall I use. Is it WS_UPLOAD or GUI_UPLOAD.

And also my input text file has column headings in the first line. I dont want the column headings. Instead I want to read the data from the second line of my input file. How can I do this.

Waiting for replies...........

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
907

Hi Raju,

Please use GUI_UPLOAD.

Take a look at this..

http://help.sap.com/saphelp_erp2005/helpdata/en/79/c554a3b3dc11d5993800508b6b8b11/frameset.htm

Hope this helps!

cheers,

Prashanth

P.S please mark helpful answers

Hi Raju,

Please use GUI_UPLOAD.

Take a look at this..

http://help.sap.com/saphelp_erp2005/helpdata/en/79/c554a3b3dc11d5993800508b6b8b11/frameset.htm

Hope this helps!

cheers,

Prashanth

P.S please mark helpful answers

4 REPLIES 4
Read only

Former Member
0 Likes
907

Hi,

Use GUI_UPLOAD this should be perfect for your requirement.

Cheers

VJ

Read only

0 Likes
907

Working with TAB delimited or comma delimited files, I usually like to upload to a flat structure then parse each record into appropriate fields. You can do this using the GUI_UPLOAD. Here is a sample program. You can just delete the first line after upload to remove the column headings.



report zrich_0001.

types: begin of ttab,
       rec(1000) type c,
       end of ttab.

types: begin of tdat,
       fld1(10) type c,
       fld2(10) type c,
       fld3(10) type c,
       end of tdat.

data: itab type table of ttab with header line.
data: idat type table of tdat with header line.

data: file_str type string.

parameters: p_file type localfile.

at selection-screen on value-request for p_file.
  call function 'KD_GET_FILENAME_ON_F4'
       exporting
            static    = 'X'
       changing
            file_name = p_file.

start-of-selection.

  file_str = p_file.

  call function 'GUI_UPLOAD'
       exporting
            filename                = file_str
       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.


delete itab index 1.

  loop at itab.
    clear idat.
    split itab-rec at cl_abap_char_utilities=>horizontal_tab
                          into idat-fld1
                               idat-fld2
                               idat-fld3.
    append idat.

  endloop.


  loop at idat.
    write:/ idat-fld1, idat-fld2, idat-fld3.
  endloop.

REgards,

Rich Heilman

Read only

Former Member
0 Likes
908

Hi Raju,

Please use GUI_UPLOAD.

Take a look at this..

http://help.sap.com/saphelp_erp2005/helpdata/en/79/c554a3b3dc11d5993800508b6b8b11/frameset.htm

Hope this helps!

cheers,

Prashanth

P.S please mark helpful answers

Read only

Former Member
0 Likes
907

Hi Raju,

1. Use the FM GUI_UPLOAD.

2. Read the table with the condition of the header.

3. Check for sy-subrc and remove the header.

Regards,

Azaz Ali.