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

What is problem?

Former Member
0 Likes
1,038

Hi all,

Here is the code part of bdcrecxx.

FORM OPEN_DATASET USING P_DATASET.

OPEN DATASET P_DATASET IN TEXT MODE.

>>Error is here above: open dataset...

IF SY-SUBRC <> 0.

WRITE: / TEXT-E00, SY-SUBRC.

STOP.

ENDIF.

ENDFORM.

The error message is;

One of the additions "FOR INPUT", "FOR OUTPUT", "FOR APPENDING" or "FOR UPDATE" was expected.

What is the problem?

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
999

hi,

This is a syntax error.

OPEN DATASET command wants what has to be done with the data that you are referring to.

Do an F1 on OPEN DATASET and u'll know the syntax

Reward if helpful.

Regards,

Preeti

8 REPLIES 8
Read only

Former Member
0 Likes
1,000

hi,

This is a syntax error.

OPEN DATASET command wants what has to be done with the data that you are referring to.

Do an F1 on OPEN DATASET and u'll know the syntax

Reward if helpful.

Regards,

Preeti

Read only

0 Likes
999

Thank you Preeti Yadav,

However it is not possible to change a line of BDCRECXX.

if I attemp to change it, I am forced to enter Access key.

This sam code runs at version 4.6 and not working at 4.7.

I am carrying the same code.

Thanks.

Read only

0 Likes
999

Hello,

In 4.6 'for input' is the default mode whereas in 4.7 onwards you need to explicitly specify the mode

The program BDCRECXX has the appropriate changes in version 4.7

Edited by: Kris Donald on Jan 7, 2008 1:57 PM

Read only

former_member188829
Active Contributor
0 Likes
999

Hi,

The Correct Syntax is..

OPEN DATASET P_DATASET FOR OUTPUT/INPUT/APPENDING IN TEXT MODE ENCODING DEFAULT.

Read only

Former Member
0 Likes
999

hi,

when u want to transfer the file data to application server.

OPEN DATASET P_DATASET

FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

IF SY-SUBRC 0.

WRITE: / TEXT-E00, SY-SUBRC.

STOP.

ENDIF.

use this code u can trasfer the data to file

Read only

abdulazeez12
Active Contributor
0 Likes
999

The syntax for OPEN DATASET is as follows:

Syntax

OPEN DATASET dset FOR access IN mode [position]

[ os_addition]

[error_handling].

So, OPEN DATASET should be followed by "FOR input" or FOR output..then it shud be followed by in TEXT mode..

OPEN DATASET FOR INPUT IN TEXT MODE. is the correct syntax.

CHeers

Shakir

Read only

former_member189059
Active Contributor
0 Likes
999

Hello Deniz,

You need to open a file either to write to or to read from

Use

OPEN DATASET P_DATASET for input IN TEXT MODE.

(to read from the file)

or

OPEN DATASET P_DATASET for output IN TEXT MODE.

(to write to the file)

('encoding default' may be needed at the end of the line, depending on your SAP version)

Read only

Former Member
0 Likes
999

Hi,

To create/read a file on application server OPEN DATASET is used.

You must open the file according to the requirement.

FOR OUTPUT : To create a new file or to overwrite the existing file.

FOR INPUT : Open file in read mode. so that writing is not possible.

FOR APPENDING: Open file in append mode. i.e., previous data will not be erased. control will be placed at the end of the file and data can be writen to the file.

Hence while using open dataset, one of these options should be used.