Skip to Content
avatar image
Former Member

READ DATASET

Hi

uploaded into SAP. When tried to open and read the flat file using OPEN DATASET and READ DATASET commands,

the Sy-subrc value returned is 8 and the error message 'the specified file not found' is displayed. We checked the path and

the file is in the correct location. What is missing?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 11:13 AM

    File names and paths are case sensitive in a lot of server operating systems - check that yours is correct in this aspect.

    Also see if you can find / display the dataset in AL11 - could be permissions for the file are not correct.

    Andrew

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 24, 2007 at 10:10 AM

    Hi Rahul

    Before data can be processed , a file need to be opened.

    open dataset <file name> for < input / output / appending >

    in < text mode / binary mode>

    Processing a file involves reading the file or writing on to the file transfer.

    read dataset <file name> into < field>

    Each read will get one record from the dataset . In binary mode it reads the length of field and in text mode it reads each line.

    If the program attempts to read a record that do not exist ,then it will show an error.

    So it is the error in mode( text mode or binary mode)

    Manas

    If useful donot forget to reward me

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 24, 2007 at 12:11 PM

    Hi

    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    *--- Display error messages if any.

    IF sy-subrc NE 0.

    MESSAGE e001(zsd_mes).

    EXIT.

    ELSE.

    *---Data is downloaded to the application server file path

    LOOP AT it_tab2 INTO wa_tab2.

    TRANSFER wa_tab2 TO p_file.

    ENDLOOP.

    ENDIF.

    *--Close the Application server file (Mandatory).

    CLOSE DATASET p_file.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 27, 2007 at 08:04 AM

    Hi..Sharma..

    you can print the Exact message why the File is not opened using this code:

    PARAMETERS : P_DSN(40) DEFAULT 'TEMP.TXT'.

    DATA : V_MSG TYPE STRING.

    OPEN DATASET P_DSN FOR INPUT

    IN TEXT MODE ENCODING DEFAULT

    MESSAGE V_MSG. "Returns the Actual message why the file not opened

    if sy-subrc ne 0.

    Message v_msg type 'E'.

    Else.

    <<<<< do the Processing here>>>>

    Endif.

    <b>Reward if Helpful</b>

    Add comment
    10|10000 characters needed characters exceeded