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

dataset

Former Member
0 Likes
750

hi folks i am going to upload journal info from text file to sap but it gives error like 'unable to open dataset' my statement follows

'/usr/sap/SPE/DVEBMGS00/work/ZPSPAR35_PERS_UP.TXT' FOR OUTPUT

IN TEXT MODE

ENCODING DEFAULT.

plz clarify

chiya

hi folks i am going to upload journal info from text file to sap but it gives error like 'unable to open dataset' my statement follows

'/usr/sap/SPE/DVEBMGS00/work/ZPSPAR35_PERS_UP.TXT' FOR OUTPUT

IN TEXT MODE

ENCODING DEFAULT.

plz clarify

chiya

5 REPLIES 5
Read only

Former Member
0 Likes
727
data: P_file like rlgrap-fielname.

p_file = '/usr/sap/SPE/DVEBMGS00/work/ZPSPAR35_PERS_UP.TXT'.

open dataset p_file for output in text mode encoding default.

try this...

Read only

Former Member
0 Likes
727

Check with the path whether the spelling is correct or not. because for application server, you should give the path as it is(check where u have upper casse and lower case.)

Cheers,

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
727

Here is a sample that works for me.




report zrich_0001.

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

data: begin of itab occurs 0,
      rec(200) type c,
      end of itab.
data: wa(200) type c.


start-of-selection.

  open dataset d1 for <b>input</b> in text mode.
  if sy-subrc = 0.
    do.
      read dataset d1 into wa.
      if sy-subrc <> 0.
        exit.
      endif.
      itab-rec = wa.
      append itab.
    enddo.
  endif.
  close dataset d1.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
727

Hi chiya,

1. In unix/aix OS,

the file names with directory paths,

are CASE SENSITIVE.

Hence, checkout on that.

2. What is the value of sy-subrc

just immediate after open dataset.

Possibly it cannot find the file

(because of upper case / lower case)

regards,

amit m.

Message was edited by: Amit Mittal

Read only

Former Member
0 Likes
727

Hi use this one.

PARAMETERS: P_FILE LIKE RLGRAP-FILENAME.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_FILE

.