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: 

How can I upload data from excel file from Application Server?

Former Member
0 Kudos

Hi

Can anyone tell me how can I upload data from excel file and that is from Application Server?

3 REPLIES 3

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You need to use the OPEN DATASET and READ DATASET statements. You may have a problem uploading from excel, you might want to try to upload from a comma delimited file, or .CSV

Regards,

Rich Heilman

Former Member
0 Kudos

Hi ,

Please first copy the EXcel file to .DAT or .CSV file . Then upload by using GUI_UPLOAd (if from Presentation Server) or use Data sets.

0 Kudos

Here is a sample, This program will upload a comma delimited file from app server, and break it up into specific fields of an ITAB.



report zrich_0001
       no standard page heading.


parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.csv'.

data: begin of itab occurs 0,
      fld1(20) type c,
      fld2(20) type c,
      fld3(20) type c,
      end of itab.
data: wa(2000) type c.


start-of-selection.

  open dataset d1 for input in text mode.
  if sy-subrc = 0.
    do.
      read dataset d1 into wa.
      if sy-subrc <> 0.
        exit.
      endif.
      split wa at ',' into itab-fld1 itab-fld2 itab-fld3.
      append itab.
    enddo.
  endif.
  close dataset d1.

Regards,

Rich Heilman