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 DATASET

Former Member
0 Kudos

I want to store report output in application sever .For that i followed open dataset.

My problem:

when i used below statements.

1) 1st

OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

TRANSFER WA_OUTPUT TO P_FILE.

loop at i_output into wa_output.

write:/0 wa_output-werks,

10 wa_output-matnr,

25 wa_output-lgort,

35 wa_output-labst.

endloop.

CLOSE DATASET P_FILE.

i got dump error:

Only character-type data objects are supported at the argument

position "f" for the statement

"TRANSFER f TO ...".

In this case, the operand "f" has the non-character-type "TYOUTPUT"._

The current program is flagged as a Unicode program. In the Unicode context ,

type X fields are seen as non-character-type, as are structures that

contain non-character-type components.

2) 2nd type

OPEN DATASET P_FILE FOR OUTPUT IN BINARY MODE.

TRANSFER WA_OUTPUT TO P_FILE.

loop at i_output into wa_output.

write:/0 wa_output-werks,

10 wa_output-matnr,

25 wa_output-lgort,

35 wa_output-labst.

endloop.

CLOSE DATASET P_FILE.

i donot get any error,but in t-code AL11.This file is creates without any data in it.

Kindly help me.

1 REPLY 1

Former Member
0 Kudos

hi,

TRANSFER xx should be inside loop ?

and try code like below:

OPEN DATASET filename FOR OUTPUT IN BINARY MODE.

CHECK sy-subrc EQ 0.

DATA CLRF(2) TYPE x VALUE '0D0A'.

LOOP AT itab.

PERFORM xTRANSFER USING itab-VBELN filename.

PERFORM xTRANSFER USING itab-AUART filename.

...

TRANSFER CRLF TO filename.

ENDLOOP.

CLOSE DATASET filename.

ENDLOOP.

...

form xTRANSFER USING xfield xfilename.

DATA f_type.

DESCRIBE FIELD xfield TYPE f_type.

CASE f_type.

WHEN 'C'.

TRANSFER xfield TO xfilename.

WHEN 'D'.

DATA: sData(10).

WRITE: xfield TO sData.

TRANSFER sData TO xfilename.

WHEN 'P'.

DATA: sAmount(20).

WRITE: xfield TO sAmount.

TRANSFER sAmount TO xfilename.

WHEN OTHERS.

EXIT.

ENDCASE.

TRANSFER ';' TO xfilename.

endform.

best regards,darek