Application Development 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: 

Excel file in Application Server

Former Member
0 Kudos

Dear All ,

I have put my Excel file which needs to be uploaded by using bdc . How do I Read The excel file from Application server .

8 REPLIES 8

Former Member
0 Kudos

Balmurugan,

Pls. use below FM...

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = filename

i_begin_col = '1'

i_begin_row = '1'

i_end_col = '200'

i_end_row = '5000'

TABLES

intern = meta_xl_itab.

Pls. mark if useful

Former Member
0 Kudos

Hi,

REPORT zztest.

DATA : filename LIKE dxfields-longpath.

DATA : BEGIN OF itab OCCURS 0,

a(200) TYPE c,

END OF itab.

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

i_location_flag = 'A'

  • I_SERVER = '?'

  • I_PATH =

<b>filemask = '*.xls'</b>

  • FILEOPERATION = 'R'

IMPORTING

  • O_LOCATION_FLAG =

  • O_SERVER =

o_path = filename

  • ABEND_FLAG =

EXCEPTIONS

rfc_error = 1

error_with_gui = 2

OTHERS = 3.

OPEN DATASET filename FOR INPUT IN BINARY MODE.

WHILE sy-subrc = 0.

CLEAR itab .

READ DATASET filename INTO itab.

APPEND itab.

ENDWHILE.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'd:\abc.xls'

filetype = 'BIN'

TABLES

data_tab = itab.

Refer these threads:

Regards,

Priyanka.

Former Member
0 Kudos

Hi,

Use dataset operations for taking data from appln server.

for ex use various opns like open dataset...

read datset...

clsoe dataset

kiran_k8
Active Contributor
0 Kudos

Bala,

Use CG3Y transaction.Kindly let me know in what way it benefitted.

K.Kiran.

sreeramkumar_madisetty
Active Contributor
0 Kudos

Hi

Use the below code:

OPEN DATASET g_file FOR INPUT IN TEXT MODE ENCODING DEFAULT

IF SY-SUBRC EQ 0.

DO.

READ DATASET g_file INTO FILE.

if sy-subrc = 0.

split FILE at ',' into itab.(created in ur program with ur required fields)

endif.

Regards,

kumar

Former Member
0 Kudos

Use open datataset, read dataset to read the file from application server.

Former Member
0 Kudos

first use CG3Y to download data from application server to presentation server...

then use...

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = filename

i_begin_col = '1'

i_begin_row = '1'

i_end_col = '200'

i_end_row = '5000'

TABLES

intern = meta_xl_itab.

to upload data and use it in BDC...

Former Member
0 Kudos

Hi Bala,

Is your requirement to download the file from Application server to your desktop and then do a BDC where you will specify the file path. Not you cannot pass the Internal Table in BDC, if its something like a popup where u specify ur file path then you can follow this.

There are 2 steps for this :

1) Read the file form Application Server to a local PC

Read from App server to INternal Table


    OPEN DATASET fp_path FOR INPUT IN BINARY MODE.
    IF sy-subrc EQ 0.
      DO.
        READ DATASET fp_path INTO t_doc_content.
        IF sy-subrc EQ 0.
          APPEND  t_doc_content.
          CLEAR   t_doc_content.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET fp_path.
    ENDIF.

Internal Table to local PC

CALL METHOD cl_gui_frontend_services=>gui_download
  EXPORTING
    filename              = 'c:text.xls'
  CHANGING
    data_tab              = t_doc_content[]

2) In the BDC recording specify the file path.

<b>AS</b>