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

extract dataset to internal table


Is it possible to transfer data in an extract field group to an internal table in a loop and how?

Thx in advance,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Oct 28, 2010 at 01:13 PM

    Simply Loop at extract and move corresponding values to internal table. Example

    TABLES: spfli, sflight, sbook.
    "define extract without their structure
    FIELD-GROUPS: header,
    "define structure of each record in extract
    INSERT: spfli-cityfrom spfli-cityto                    INTO header,       "sort by cities
            spfli-deptime spfli-arrtime                    INTO travel_time,
            sflight-carrid sflight-connid sflight-price    INTO flight_detail.
    "output table to transfer data to
    DATA    it_out_spfli TYPE TABLE OF spfli WITH HEADER LINE.
    GET spfli.
      "fill records of extract with data
      EXTRACT: header, travel_time.
    GET sflight.
      EXTRACT flight_detail.
      "sort the extract by the key determined in header field group
        AT NEW spfli-cityfrom.
          WRITE: /'Connections from:', spfli-cityfrom.
        "connection must have details, flight_detail record must be found after this one
        AT travel_time WITH flight_detail.
          WRITE: /30 spfli-cityto, spfli-deptime, spfli-arrtime.
       "move data to your table
          MOVE-CORRESPONDING spfli TO it_out_spfli.
        AT flight_detail.   "if record of field-group fligth_detail reached
          WRITE: sflight-carrid, sflight-connid, sflight-price.
       "move data to your table
          MOVE-CORRESPONDING sflight TO it_out_spfli.
        AT END OF spfli-cityfrom.
          WRITE: /80'Total cities travel', cnt(spfli-cityto).
        APPEND it_out_spfli.

    You need also make sure that all fields in IT_OUT_SPFLI are correcly provided. In my example there are some gaps but this is just a matter of supplying rest of the fields.



    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.