cancel
Showing results for 
Search instead for 
Did you mean: 

BDC : Uploading a file into Application Server(Data Set)

Former Member
0 Kudos

Hi Peers,

I have a requirement where in I have to upload all the data from an Internal table to an Dataset.For this I m using:

OPEN DATASET p_ofile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT t_excel.

TRANSFER t_excel TO p_ofile.

ENDLOOP.

CLOSE DATASET p_ofile.

p_ofile is an .XLS file , t_excel is an Internal Table.

When the data is update in the p_ofile the Format of the data is not proper everything is on the first column of .xls file.

Could you please guide me in this regard.

Thanks,

Criag

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Daniel

You need to take other internal table with 2000 charecter length, then concatinate all the field to this Internla table with a Charecter return, so it will be displayed in teh excel sheet

Here is the sample program




    LOOP AT it_headings_gro_plc.   " Your INternal table

* Add tabs as the field separator, so that the file will be
* downloaded to the excel format
      CONCATENATE
           it_headings_gro_plc-prod      " Product code
           it_headings_gro_plc-type      " Pre-format Type
           it_headings_gro_plc-group     " Pre-format Group Code
           it_headings_gro_plc-code      " Pre-format Code
           it_headings_gro_plc-party     " Party Name
           it_headings_gro_plc-acct      " Debit Acct No
           it_headings_gro_plc-name      " Chinese Name
           it_headings_gro_plc-addr1                        " Address 1
           it_headings_gro_plc-addr2                        " Address 2
           it_headings_gro_plc-addr3                        " Address 3
           it_headings_gro_plc-method    " Delivery method
           it_headings_gro_plc-trans     " Transaction cod e
           it_headings_gro_plc-banka     " Benficiary bank name
           it_headings_gro_plc-bankn     " Benficiary Count number
        INTO it_report_out_tab SEPARATED BY g_separator.   " G-Separator is the separator for the line feed, 
" Beforre this one   g_separator = cl_abap_char_utilities=>horizontal_tab.

      APPEND it_report_out_tab.    "New  2000 charecter Internal table
    ENDLOOP.


Answers (2)

Answers (2)

Former Member
0 Kudos

enable has field seperator in gui_upload function module

Former Member
0 Kudos

Hi Daniel,

First you load the Excel data into internal table outside the DATASET using available standard FMs.

Later use the OPEN DATASET, TRANSFER and CLOSE DATASET keywords inside a loop for each record of the first internal table and move the records one by one to a new internal table inside the DATASET loop and from there move to the Application server.

Hope this resolves your query.

Regards

Nagaraj