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

Using opendata set to output a file

Hi,

I have a query in using open dataset command.

let us consider this scenario as an example.

I need to select 5 fields from mara table and I want to display the output in a flat file.Later, I have to read the data from the flat file and to display the output in sap screen.

Can someone help me on doing this and also if you send me the code , it will be useful for me to understand.

Thanks,

Stal.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jan 30, 2008 at 06:58 PM

    READ DATASET (reading) and TRANSFER (writing)

    OPEN DTASET <dataset name> for <input output appending> in <binary text > mode at POSITION <position> MESSAGE <field>

    READ DATASET <dataset name > INTO <field>

    CLOSE DATASET <dataset name>

    DELETE DATASET <dataset name>

    TRANSFER <field> to <dataset name>

    select the required data and place in internal table

    use DATASET to write into application server.

    when ever u want READ the DATASET and write into flatfile/

    regards.

    santhosh reddy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:10 PM

    Hi Stalin,

    Download data to a unix file :

    1) Declare parameter p_file LIKE rlgrap-filename OBLIGATORY.

    (convert logical file to physical file using FM file_get_name)

    2) Declare internal table and work area

    3) OPEN DATASET <dsn> FOR OUTPUT

    4) Retrieve data and store in internal table

    5) For each record use statemet Transfer <f> to <dsn>

    Upload data from unix file :

    1) OPEN DATASET <dsn> FOR INPUT IN TEXT MODE.

    2) Within statement Do... Enddo use READ DATASET <dsn> INTO internal table

    3) Using internal table display the data in screen

    With Regards,

    Gandhi Subramani

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for your reply Gandhi.

      Since I started learning now, i couldnt able to follow it clearly.

      Can you please send me a code for this task .

      my task is to select first 5 fields from mara keeping matnr as selection-screen and make an output in a flat file.

      And then, read in a internal table and display the output in a sap screen.

      I really appreciate if you could send me the code for this.

      Help me.

      Thanks,

      Stalin

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.