Skip to Content
author's profile photo Former Member
Former Member

OPEN DATASET

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 13, 2008 at 04: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.

    ... TEXT MODE encoding [linefeed]
    . 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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 13, 2008 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 13, 2008 at 06: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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.