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

How to read datasets with delimiters

Hi,

we are trying to read a file from <b>Application server</b> in to an internal table using datasets.

The structure of internal table is

DATA : BEGIN OF IT_FILE_DATA OCCURS 10,

OBDNO(10), "OBD NO

BUDAT(10), "DATE

QTY(17), "QTY

UNIT(3), "UNIT

STOCKTYP(1), "STOCK TYPE

END OF IT_FILE_DATA.

And the data in flat file in Application server looks like

8010915223.02.20052MT1 , ie separated by ~ .

Is there any way by which by a single "read dataset" command , we can get the fields from file in to corresponding fields of the work area?

Thanx in advance ,

Regards,

Sriram.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Feb 23, 2005 at 11:40 AM

    Hi Sriram!

    Use read dataset with a text variable (e.g. char50).

    Then use split text at '~' into it_file_data-obdno it_file_data-budat...

    This should do the job.

    Regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 23, 2005 at 11:45 AM

    Hi,

    Here's an example:

    READ DATASET DSIN INTO WA.

    SPLIT WA AT '~' INTO TABLE SPTAB.

    LOOP AT SPTAB.

    IDX = IDX + 1.

    ASSIGN COMPONENT IDX OF STRUCTURE IT_FILE_DATA TO <FS1>.

    If sy-subrc = 0.

    <FS1> = SPTAB-field.

    Endif.

    Endloop.

    Regards Andreas

    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.