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: 

Dataset

Former Member
0 Kudos

Hi,

could anyone explain wats meant by

open dataset p_file for input in text mode

read dataset p_file for input in text mode.

thanks,

Ponraj.s.

ponraj_rec@yahoo.com

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

open dataset p_file for input in text mode

<b>To open a file on the application server for reading.</b>

read dataset p_file for input in text mode.

<b>To read the opened file .</b>

Regards,

Ravi

5 REPLIES 5

former_member181962
Active Contributor
0 Kudos

open dataset p_file for input in text mode

<b>To open a file on the application server for reading.</b>

read dataset p_file for input in text mode.

<b>To read the opened file .</b>

Regards,

Ravi

Former Member
0 Kudos

hi Ponraj,

1. the first statement open dataset is for <b>opening the file</b> from the application server.

2. the second statement is for <b>reading the file</b>( existing ) from the application server.

Hope i have answered your question

Have a look at this program for further queries

http://www.sapdevelopment.co.uk/file/file_uploadsap.htm

Regards,

Santosh

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

The DATASET statements are the statement that you use to read a file from the application server. You open the file using the OPEN dataset statement, you then read it using the READ dataset statement.



report zrich_0001.

Parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt'.
        

data: itab type table of string.
data: wa type string.


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.
      append wa to itab.
    enddo.
  endif.
  close dataset d1.


http://help.sap.com/saphelp_webas620/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/frameset.htm

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

1. Opens the specified file.

OPEN ... FOR INPUT opens the file in read mode.

2. Imports a record from a sequential file whose index and name are specified in dsn into the data object

Rgds,

Prakash

ferry_lianto
Active Contributor
0 Kudos

Hi Ponraj,

Please check your email.

Regards,

Ferry Lianto