‎2008 Apr 13 3:58 AM
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 PFILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.+_
+TRANSFER WAOUTPUT TO P_FILE.+_
+loop at ioutput into wa_output.+_
+write:/0 waoutput-werks,+_
+10 waoutput-matnr,+_
+25 waoutput-lgort,+_
+35 waoutput-labst.+_
endloop.
+CLOSE DATASET PFILE.+_
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.
‎2008 Apr 13 5:18 AM
Hi Saritha,
1.
When you use IN TEXT MODE ENCODING default addition, it supports only character-type variables only. In your case wa_output-labst is a quantity field.
check this F1 help on IN TEXT MODE.
.
Effect:
The addition IN TEXT MODE opens the file as a text file. The addition ENCODING defines how the characters are represented in the text file. When writing to a text file, the content of a data object is converted to the representation entered after ENCODING, and transferred to the file. If the data type is character-type and flat, trailing blanks are cut off. In the data type string, trailing blanks are not cut off. The end-of-line selection of the relevant platform is applied to the transferred data by default. When reading from a text file, the content of the file is read until the next end-of-line selection, converted from the format specified after ENCODING into the current character format, and transferred to a data object. The end-of-line selection used is controlled using the addition linefeed (as of Release 7.0).
In Unicode programs, only the content of character-type data objects can be transferred to text files and read from text files. The addition encoding must be specified in Unicode programs, and can only be omitted in non-Unicode programs.
Try to use BINARY MODE or create one structure with all Char Variables.
Regards,
Venkat.O
... TEXT MODE encoding [linefeed]
‎2008 Apr 13 7:11 AM
Hi Saritha,
I think you have to make all the fields of the table t_output of type C.
then..try this...
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
loop at t_output into wa_output.
transfer wa_output TO p_file.
endloop.
CLOSE DATASET p_file
‎2008 Apr 13 7:44 AM
Hi,
Please refer the code below:
* Download internal table to Application server file(Unix)
DATA: e_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.
open dataset e_file for output in text mode.
lOOP AT it_datatab......
transfer it_datatab to e_file.
ENDLOOP.
close dataset e_file.
Thanks,
Sriram Ponna.