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

data upload and download

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

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 02:51 AM

    DATA: BEGIN OF T_MARA OCCURS 0,

    MATNR TYPE MARA-MATNR,

    END OF ITAB.

    DATA : BEGIN OF T_MARA OCCURS 0,

    LINE(75)TYPE C,

    END OF ITAB.

    SELECT MATNR FROM MARA INTO TABLE T_MARA .

    OPEN DATA SET W_FILE_NAME FOR OUT PUT IN TEXT MODE ENCODING DEFAULT.

    LOOP AT T_MARA.

    TRANSFER T_MARA.

    ENDLOOP.

    CLOSE DATA SET.

    NOW ALL THE DATA IS TRANSFERD TO APPP SERVER.

    NOW IF U WANT TO READ....

    OPEN DATASET W_FILENAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.

    IF SY-SUBRC NE 0.

    MESSAGE E000 WITH 'FILE NOT FOUND'.

    ELSE.

    DO .

    READ DATA SET W_FILE NAME INTO T_ITAB2.

    IF SY-SUBRC NE 0.

    EXIT .

    ENDIF.

    END DO.

    CLOSE DATA SET.

    *********NOW ALL THE DATA IS PRESENT IN T_ITAB2.

    LOOP AT T_ITAB2.

    *******SUPOOSE IF U R HAVING MORE FIELDS MEANS ***USE SPLIT.

    SPLIT AT ',' T_ITAB2 INTO T_MARA-MATNR.

    APPEND T_MARA.

    ENDLOOP.

    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.