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: 

Open Data Set Probelem

Former Member
0 Kudos

Hello all,

i am using this statement to save my data file to Application Server:

OPEN DATASET l_file_name FOR OUTPUT

IN

LEGACY

TEXT MODE

FILTER 'compress'

IGNORING CONVERSION ERRORS

REPLACEMENT CHARACTER '$'

CODE PAGE g_sap_code_page.

LOOP AT lt_text_table.

TRANSFER lt_text_table TO l_file_name.

ENDLOOP.

CLOSE DATASET l_file_name.

___________________________________________________

IN THIS MY CODE PAGE IS 'iso_8859-1'.

In this i am getting a dump which says:

Short Text:

File "l_file_name" is not open.

What happened?

Error in the ABAP Application Program

The current ABAP program "YSL_DWH_PROCESSING" had to be termininated

because it has

come across a statement that unfortunately cannot be executed.

and when i do not use Filter "compress" in my code it works fine

please help:)

13 REPLIES 13

former_member181962
Active Contributor
0 Kudos

Hi Surmeet,

Try using BINARY mode and see if it works.

Regards,

Ravi

Former Member
0 Kudos

Hi,

Try like this:

open dataset v_file for output in text mode encoding default.

if sy-subrc eq 0.

loop at git_mara.

transfer git_mara to v_file.

endloop.

close dataset v_file.

endif.

clear : git_mara[].

Regards,

Bhaskar

0 Kudos

nd with text mode i can not give option of code page

Former Member
0 Kudos

Hi,

see following code :

*Create First Data Set

perform open_dataset using dataset1.

transfer text-001 to dataset1.

loop at i_contracts1.

transfer i_contracts1 to dataset1.

if i_contracts1-ebeln+0(1) ca '0123456789'.

cnt1 = cnt1 + i_contracts1-ebeln.

endif.

endloop.

perform close_dataset using dataset1.

&----


FORM open_dataset USING P_DATASET.

open dataset p_dataset for output in text mode.

if sy-subrc <> 0.

write: / text-e00, sy-subrc.

stop.

endif.

ENDFORM. " open_dataset

FORM close_dataset USING P_DATASET.

close dataset p_dataset.

ENDFORM. " close_dataset

Reward points if helpful

Regards.

Srikanta Gope

0 Kudos

Hello friends,

i need to encode as well as compress my data also

with niary mode i cant have encoded data

0 Kudos

What is the OS of your APPLICATION Server?IS it Unix or Windows or nything else?

0 Kudos

hi ravi,

how cn i know the Os of application server?

i dont know:(

0 Kudos

it is valid for all OS

0 Kudos

It is valid for only OS that use something called Pipes concept and in the help they have mentioned Unix and Windows only.

Did you try to capture the actual nessage by using message addition for the open dataset statement? That way , you can atleast find what was the message that was raised.

Regards,

ravi

0 Kudos

hi ravi,

the problem is at times it gets executed fine and at times it doesnt

so the code is ok

nd yes i have analysed the DUBP, it says that the file is not open i.e. the file that i open doesnt gt opened

Former Member
0 Kudos

hi sumeet

try this.....

open dataset p_file for output in text/binary mode.

if sy-subrc eq 0.

loop at itab.

transfer itab to p_file.

endloop.

close dataset v_file.

endif.

clear : itab[].

REWARD IF USEFUL...!!

0 Kudos

hello asha,

Sy-subrc is 8

Former Member
0 Kudos

hi sumeet

sy-subrc = 8...it indicate us that there is no list currently present right...so let us try it in different manner

************************

  • Download

************************

report zdowntex.

parameters:

p_report like sy-repid,

p_file like rlgrap-filename,

p_lang like sy-langu.

data: it_text like textpool occurs 100 with header line.

start-of-selection.

read textpool p_report into it_text language p_lang.

if sy-subrc = 0.

call function 'WS_DOWNLOAD'

exporting

filename = p_file

filetype = 'DAT'

tables

data_tab = it_text

exceptions

file_open_error = 1

file_write_error = 2

invalid_filesize = 3

invalid_table_width = 4

invalid_type = 5

no_batch = 6

unknown_error = 7

others = 8.

write: / 'ws_download : ', sy-subrc.

else.

write: / 'read textpool : ', sy-subrc.

endif.

************************

  • Upload

************************

report zuplotex.

parameters:

p_report like sy-repid,

p_file like rlgrap-filename,

p_lang like sy-langu.

data: it_text like textpool occurs 100 with header line.

start-of-selection.

call function 'GUI_UPLOAD'

exporting

filename = p_file

filetype = 'DAT'

tables

data_tab = it_text

exceptions

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_table_width = 4

invalid_type = 5

no_batch = 6

unknown_error = 7

others = 8.

if sy-subrc = 0.

insert textpool p_report from it_text language p_lang.

write: / 'insert textpool : ', sy-subrc.

else.

write: / 'gui_upload : ', sy-subrc.

endif.

jus check whether the list id present or not...

REWARD IF USEFULL..!!!