Extract Statement

Hi experts!!!
Can you please tell me
What does an extract statement do in the ABAP program? 
Thanks in Advance,
Logu

Hi,
Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements: EXTRACT . When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset EXTRACT HEADER. When you extract the data, the record is filled with the current values of the corresponding fields. As soon as the system has processed the first EXTRACT statement for a field group , the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs. By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
give the logical database name as F1S in the attributes of the program
NODES: spfli, sflight.
FIELD-GROUPS: header, flight_info, flight_date.
INSERT: spfli-carrid spfli-connid sflight-fldate
        INTO header,
        spfli-cityfrom spfli-cityto
        INTO flight_info.
START-OF-SELECTION.
GET spfli.
  EXTRACT flight_info.
GET sflight.
  EXTRACT flight_date.
end-of-selection.
loop.
write:/ spfli-carrid,spfli-connid,sflight-fldate.
endloop.
rgds,
bharat.

Similar Messages

  • Extract statement and insert statement

    can anyone explain me the use of this insert statement and extract statement.
    INSERT lfa1-name1 INTO fg01
    extract fg01.
    thanks
    phyrose

    Hi,
           From f1 help....
    EXTRACT
    Basic form
    EXTRACT fg.
    Effect
    Writes all fields of the field group fg (FIELD-GROUPS) as an entry in asequential dataset. If you have defined a field group HEADER,its fields precede each entry as a sort key. Afterwards, you canuse SORT and LOOP ... ENDLOOP to sort or process the datasetrespectively. No further EXTRACT statements are possible afterthis.
    Notes
    General:
    As soon as you have extracted a dataset using EXTRACT, you canno longer extend the field group using INSERT. In particular, you cannot change the HEADERfield group at all after the first EXTRACT (regardless of thefield group to which it applied).
    Large extract datasets are not stored in main memory. Instead, theyare kept in an external auxiliary file. You can set the directory inwhich this file is created using the SAP profile parameterDIR_EXTRACT. The default directory is the SAP data directory(SAP profile parameter DIR_DATA).
    Notes
    Runtime errors:
    EXTRACT_AFTER_SORT/LOOP: EXTRACT after SORT, orLOOP. EXTRACT_BUFFER_NO_ROLL: Unable to create the required main
    EXTRACT_FIELD_TOO_LARGE: Occupied length of a field is toolarge.
    EXTRACT_HEADER_NOT_UNIQUE: Field group HEADER wasmodified after an EXTRACT statement.
    EXTRACT_OPEN_EXTRACTFILE_OPEN:
    Error opening the external extract dataset file.
    EXTRACT_RESOURCEHANDLER_FAILED: Error deleting the externalextract dataset file.
    EXTRACT_TOO_LARGE: Total length of the entry for extraction(including HEADER fields) is too large.
    Additional help
    Filling anExtract with Data
    Extracts
    Since internal tables have fixed line structures, they are not suited to handle data sets with varying structures. Instead, you can use extract datasets for this purpose.
    An extract is a sequential dataset in the memory area of the program. You can only address the entries in the dataset within a special loop. The index or key access permitted with internal tables is not allowed. You may only create one extract in any ABAP program. The size of an extract dataset is, in principle, unlimited. Extracts larger than 500KB are stored in operating system files. The practical size of an extract is up to 2GB, as long as there is enough space in the filesystem.
    An extract dataset consists of a sequence of records of a pre-defined structure. However, the structure need not be identical for all records. In one extract dataset, you can store records of different length and structure one after the other. You need not create an individual dataset for each different structure you want to store. This fact reduces the maintenance effort considerably.
    In contrast to internal tables, the system partly compresses extract datasets when storing them. This reduces the storage space required. In addition, you need not specify the structure of an extract dataset at the beginning of the program, but you can determine it dynamically during the flow of the program.
    You can use control level processing with extracts just as you can with internal tables. The internal administration for extract datasets is optimized so that it is quicker to use an extract for control level processing than an internal table.
    Procedure for creating an extract:
    Define the record types that you want to use in your extract by declaring them as field groups. The structure is defined by including fields in each field group.
    Defining an Extract
    Fill the extract line by line by extracting the required data.
    Filling an Extract with Data
    Once you have filled the extract, you can sort it and process it in a loop. At this stage, you can no longer change the contents of the extract.
    Processing Extracts
    INSERT Statement
    The INSERT statement is used to insert values into a single database table.
    <insert statement> ::= INSERT INTO <table name> <insert column list> <insert source>.
    <insert source> ::= VALUES '(' <value> ( ',' <value> )* ')'
                                | <query specification>.
    <value> ::= <value expression>
                    | <dynamic parameter specification>
                    | NULL.
    <insert column list> ::= '(' <column name> ( ',' <column name> )* ')'.
    In Open SQL the <insert column list> is not optional.
    You cannot specify string literals as values for CLOB columns. Hex literals are not supported in Open SQL.
    Examples
    INSERT INTO employees (employee_id, employee_name)
                  VALUES (4711, 'John Smith')
    Inserting Values. A new row is inserted into the table employees with the values 4711 and 'John Smith' for the columns employee_id and employee_name respectively.
    INSERT INTO well_paid_employees (employee_id, salary)
                 SELECT employee_id, salary
                                FROM employees
                                WHERE salary > ?
    Inserting the Result of a Query.  The employee_idand the salaryof all employees from table employeeswith a salary exceeding a certain value are inserted into the table well_paid_employees.
    Regards

  • What is the Extract statement? Please give me some sample code.?

    What is the Extract statement? Please give me some sample code.?

    Hello ,
    Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements: EXTRACT . When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset EXTRACT HEADER. When you extract the data, the record is filled with the current values of the corresponding fields. As soon as the system has processed the first EXTRACT statement for a field group , the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs. By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
    Sample program:
    REPORT  ZSPFLI  LINE-SIZE 132 LINE-COUNT 65(3)
                                                 NO STANDARD PAGE HEADING.
    TABLES:SPFLI,SCARR, SFLIGHT, SBOOK.
    SELECT-OPTIONS: MYCARRID FOR SPFLI-CARRID.
    FIELD-GROUPS: HEADER, SPFLI_FG, SFLIGHT_FG, SBOOK_FG.
    INSERT:
            SPFLI-CARRID
            SPFLI-CONNID
            SFLIGHT-FLDATE
            SBOOK-BOOKID
           INTO HEADER,
            SPFLI-CARRID
            SPFLI-CONNID
            SPFLI-CITYFROM
            SPFLI-AIRPFROM
            SPFLI-CITYTO
            SPFLI-AIRPTO
            SPFLI-DEPTIME
            SCARR-CARRNAME
          INTO SPFLI_FG,
            SFLIGHT-FLDATE
            SFLIGHT-SEATSMAX
            SFLIGHT-SEATSOCC
            SFLIGHT-PRICE
          INTO SFLIGHT_FG,
            SBOOK-BOOKID
            SBOOK-CUSTOMID
            SBOOK-CUSTTYPE
            SBOOK-SMOKER
           INTO SBOOK_FG.
    SELECT * FROM SPFLI WHERE CARRID IN MYCARRID.
      SELECT SINGLE * FROM SCARR WHERE CARRID = SPFLI-CARRID.
      EXTRACT SPFLI_FG.
      SELECT * FROM SFLIGHT
       WHERE CARRID = SPFLI-CARRID AND  CONNID = SPFLI-CONNID.
        EXTRACT SFLIGHT_FG.
        SELECT * FROM SBOOK
               WHERE CARRID = SFLIGHT-CARRID AND
               CONNID = SFLIGHT-CONNID AND FLDATE = SFLIGHT-FLDATE.
          EXTRACT SBOOK_FG.
          CLEAR SBOOK.
        ENDSELECT.
        CLEAR SFLIGHT.
      ENDSELECT.
      CLEAR SPFLI.
    ENDSELECT.
    SORT.
    LOOP.
      AT SPFLI_FG.
        FORMAT COLOR COL_HEADING.
        WRITE: / SCARR-CARRNAME,
                 SPFLI-CONNID, SPFLI-CITYFROM,
                 SPFLI-AIRPFROM, SPFLI-CITYTO, SPFLI-AIRPTO, SPFLI-DEPTIME.
        FORMAT COLOR OFF.
      ENDAT.
      AT SFLIGHT_FG.
        WRITE: /15 SFLIGHT-FLDATE, SFLIGHT-PRICE, SFLIGHT-SEATSMAX,
                   SFLIGHT-SEATSOCC.
      ENDAT.
      AT SBOOK_FG.
        WRITE: /30 SBOOK-BOOKID, SBOOK-CUSTOMID,
                     SBOOK-CUSTTYPE, SBOOK-SMOKER.
      ENDAT.
    ENDLOOP.

  • Dynamic insert statement

    Hi all
    I had problem in insert statement.
    I know the column of the table, tablename and the value to be insert.
    My code:
    Data: column(20) type c.   -
    >refer to the tablecolumn
    Data: tablename(20) type c.  -
    >refer to table name
    Data: value(20) type c.          -
    >value to be insert to the column in the table
    column = 'Admino'.
    tablename = 'Student'.
    value = '123456'.
    <b>insert <column> into <tablename> values <value>.</b>
    i know there something wrong with my insert statement. How to do it in abap insert code where i can put in all the parameter in the insert statement.
    Anycode or sample to show. Many thank.

    From f1 help....
    EXTRACT
    Basic form
    EXTRACT fg.
    Effect
    Writes all fields of the field group fg (FIELD-GROUPS) as an entry in asequential dataset. If you have defined a field group HEADER,its fields precede each entry as a sort key. Afterwards, you canuse SORT and LOOP ... ENDLOOP to sort or process the datasetrespectively. No further EXTRACT statements are possible afterthis.
    Notes
    General:
    As soon as you have extracted a dataset using EXTRACT, you canno longer extend the field group using INSERT. In particular, you cannot change the HEADERfield group at all after the first EXTRACT (regardless of thefield group to which it applied).
    Large extract datasets are not stored in main memory. Instead, theyare kept in an external auxiliary file. You can set the directory inwhich this file is created using the SAP profile parameterDIR_EXTRACT. The default directory is the SAP data directory(SAP profile parameter DIR_DATA).
    Notes
    Runtime errors:
    EXTRACT_AFTER_SORT/LOOP: EXTRACT after SORT, orLOOP. EXTRACT_BUFFER_NO_ROLL: Unable to create the required main
    EXTRACT_FIELD_TOO_LARGE: Occupied length of a field is toolarge.
    EXTRACT_HEADER_NOT_UNIQUE: Field group HEADER wasmodified after an EXTRACT statement.
    EXTRACT_OPEN_EXTRACTFILE_OPEN:
    Error opening the external extract dataset file.
    EXTRACT_RESOURCEHANDLER_FAILED: Error deleting the externalextract dataset file.
    EXTRACT_TOO_LARGE: Total length of the entry for extraction(including HEADER fields) is too large.
    Additional help
    Filling anExtract with Data
    Extracts
    Since internal tables have fixed line structures, they are not suited to handle data sets with varying structures. Instead, you can use extract datasets for this purpose.
    An extract is a sequential dataset in the memory area of the program. You can only address the entries in the dataset within a special loop. The index or key access permitted with internal tables is not allowed. You may only create one extract in any ABAP program. The size of an extract dataset is, in principle, unlimited. Extracts larger than 500KB are stored in operating system files. The practical size of an extract is up to 2GB, as long as there is enough space in the filesystem.
    An extract dataset consists of a sequence of records of a pre-defined structure. However, the structure need not be identical for all records. In one extract dataset, you can store records of different length and structure one after the other. You need not create an individual dataset for each different structure you want to store. This fact reduces the maintenance effort considerably.
    In contrast to internal tables, the system partly compresses extract datasets when storing them. This reduces the storage space required. In addition, you need not specify the structure of an extract dataset at the beginning of the program, but you can determine it dynamically during the flow of the program.
    You can use control level processing with extracts just as you can with internal tables. The internal administration for extract datasets is optimized so that it is quicker to use an extract for control level processing than an internal table.
    Procedure for creating an extract:
    Define the record types that you want to use in your extract by declaring them as field groups. The structure is defined by including fields in each field group.
    Defining an Extract
    Fill the extract line by line by extracting the required data.
    Filling an Extract with Data
    Once you have filled the extract, you can sort it and process it in a loop. At this stage, you can no longer change the contents of the extract.
    Processing Extracts
    INSERT Statement
    The INSERT statement is used to insert values into a single database table.
    <insert statement> ::= INSERT INTO <table name> <insert column list> <insert source>.
    <insert source> ::= VALUES '(' <value> ( ',' <value> )* ')'
    | <query specification>.
    <value> ::= <value expression>
    | <dynamic parameter specification>
    | NULL.
    <insert column list> ::= '(' <column name> ( ',' <column name> )* ')'.
    In Open SQL the <insert column list> is not optional.
    You cannot specify string literals as values for CLOB columns. Hex literals are not supported in Open SQL.
    Examples
    INSERT INTO employees (employee_id, employee_name)
    VALUES (4711, 'John Smith')
    Inserting Values. A new row is inserted into the table employees with the values 4711 and 'John Smith' for the columns employee_id and employee_name respectively.
    INSERT INTO well_paid_employees (employee_id, salary)
    SELECT employee_id, salary
    FROM employees
    WHERE salary > ?
    Inserting the Result of a Query. The employee_idand the salaryof all employees from table employeeswith a salary exceeding a certain value are inserted into the table well_paid_employees.
    Please reward points if helpful.

  • '/soap:Envelope ' in extract throws invalid token error

    I'm receiving xml via webservice/soap and placing in an XMLTYPE table. Upon trying to execute a test query:
    SELECT
    EXTRACTVALUE(VALUE(d),'Destinations/CountryID') AS ID
    FROM X_TEST p,
    TABLE (xmlsequence(EXTRACT(p.object_value,'/soap:Envelope/soap:Body/GetUserDestinationResponse/GetUserDestinationResult/DestinationResults/DestinationsList//Destinations'))) d
    I get an error similar to: (note path here in error is diff than above extract statement)
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: 'soap:Envelope/soap:Body/GetUserDestinationResponse/GetUserDestinationResult/DestinationResults/DestinationsList/Destinations/DestinationList/Destination//Provider'
    Without the soap:Envelope/soap:Body there is no error. Is there a problem using the ':' here?
    Here's a snippet of the stored xml:
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <GetUserDestinationsResponse xmlns="http://xxx.xxx.xxx.xx/somesite_ws/">
    <GetUserDestinationsResult>
    <DestinationResults>
    <DestinationsList>
    <Destinations>
    <CountryID>101</CountryID>
    <CountryDescription>Indonesia</CountryDescription>
    </Destinations>
    </DestinationList>
    </DestinationResults>
    </GetUserDestinationsResult>
    </GetUserDestinationsResponse>
    </soap:Body>
    </soap:Envelope>

    Thanks,
    that set me in the right direction - I had tried the third parm before but must not have been just right being that there are multiple namespaces given. Appears I have to always use the namespace parm to accurately obtain the data. To conclude - this is what I ended up with to get this returning data properly:
    SELECT
    EXTRACTVALUE(VALUE(d),'/Destination/DestinationId', 'xmlns="http://xxx.xxx.xxx.xx/some_ws/"') AS ID,
    Get_Point(EXTRACTVALUE(VALUE(d),'/Destination/Longitude', 'xmlns="http://xxx.xxx.xxx.xx/some_ws/"'),
    EXTRACTVALUE(VALUE(d),'/Destination/Latitude', 'xmlns="http://xxx.xxx.xxx.xx/some_ws/"')) AS geom,
    EXTRACTVALUE(VALUE(p),'/Provider/ProviderName', 'xmlns="http://xxx.xxx.xxx.xx/some_ws/"') AS provider_name,
    EXTRACTVALUE(VALUE(p),'/Provider/ProviderSpecific/HospitalInformation/whoAvainFlu', 'xmlns="http://xxx.xxx.xxx.xx/some_ws/"') AS avaianflu,
    VALUE(p) AS xmlb
    FROM X_MEDAIRE xml
    ,TABLE (xmlsequence(EXTRACT(xml.object_value,
    '/soap:Envelope/soap:Body/*', 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'
    ))) e
    ,TABLE (xmlsequence(EXTRACT(VALUE(e),
    '/long/path/after/soap', 'xmlns="http://xxx.xxx.xxx.xx/some_ws/"' ))) d
    ,TABLE (xmlsequence(EXTRACT(VALUE(d),
    '/Destination/ProviderList/Provider', 'xmlns="http://xxx.xxx.xxx.xxx/some_ws/"' ))) p
    WHERE
    EXTRACTVALUE(VALUE(p),'/Provider/ProviderType', 'xmlns="http://xxx.xxx.xxx.xxx/some_ws/"') = 'Hospital'

  • Use of Extract datasets

    Hello,
    Having seen various instances of the EXTRACT command in some legacy code I've got around to trying out this command but I can't get it to work properly. Here's some condensed test code I've put together:
    TABLES: VBAK, VBAP.
    FIELD-GROUPS: HEADER, TOP, DETAIL.
    INSERT: VBAK-VBELN VBAP-POSNR INTO HEADER,
                 VBAK-ERDAT VBAK-ERNAM VBAK-KUNNR INTO TOP,
                 VBAP-MATNR VBAP-CHARG VBAP-NETWR VBAP-WAERK INTO DETAIL.
    PARAMETERS P_VKORG TYPE VBAK-VKORG.
    SELECT *
      FROM VBAK
      WHERE VKORG = P_VKORG.
      EXTRACT TOP.
      SELECT *
        FROM VBAP
        WHERE VBELN = VBAK-VBELN.
            EXTRACT DETAIL.
        ENDSELECT.
    ENDSELECT.
    CLEAR: VBAK, VBAP.
    SORT.
    LOOP.
      WRITE:/ VBAK-VBELN, VBAP-POSNR, VBAK-ERDAT, VBAK-ERNAM, VBAK-KUNNR, VBAP-MATNR.
    ENDLOOP.
    OK, forget about the nested selects and other bad stuff, but how come I get the following output, and how should it be corrected:
    1360043260 000000 06.05.2008 CARTEM2 304393 <<< extraneous line that doesn't exist
    1360043260 000010 06.05.2008 CARTEM2 304393 34123376
    1360043260 000020 06.05.2008 CARTEM2 304393 50492316
    1360043260 000030 06.05.2008 CARTEM2 304393 50406766
    Use of extracts seems a bit wierd and there's not a lot out there to properly explain how to use them (apart from examples using a logical database).
    Thanks,
    Chris.

    Hi,
    When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset.
    So instead of extract, modify the above code in two ways:
    1) Select-End Select, Comment out the extract statement and fetch in a work area if data is fetched in workarea append it to an internal table.
    2) Use Select into table, where in you can fetch all the data into an internal table and then use it for processing.
    For better performance, use the second method. Below is how you can change.
    SELECT *
      FROM VBAK
      INTO TABLE LT_VBAK
      WHERE VKORG = P_VKORG.
      SELECT *
        FROM VBAP
    INTO TABLE LT_VBAP
    FOR ALL ENTRIES IN LT_VBAK   
    WHERE VBELN = VBAK-VBELN.
    LOOP AT LT_VBAP INTO LS_VBAP.
    READ TABLE LT_VBAK WITH KEY VBELN = LS_VBAP-VBELN
    IF SY-SUBRC EQ 0.
      WRITE:/ LS_VBAK-VBELN, LS_VBAP-POSNR, LS_VBAK-ERDAT, LS_VBAK-ERNAM, LS_VBAK-KUNNR, LS_VBAP-MATNR.
    ENDIF.
    ENDLOOP.
    Hope this helps you
    Regards
    Shiva

  • Regarding field extracts

    Hi to all,
    What are the field extracts and conversion exit in ABAP.
    Thanks..

    Hi,
    You are asking about the EXTRACT statement in ABAP.
    it is used in the context of Field Groups: when the data is huge, internal tables are not useful
    so we use field groups and use the commands like HEADER, EXTRACT, GET etc.
    see the sample code:
    REPORT demo_extract.
    NODES: spfli, sflight.
    FIELD-GROUPS: header, flight_info, flight_date.
    START-OF-SELECTION.
      INSERT: spfli-carrid spfli-connid sflight-fldate
                INTO header,
              spfli-cityfrom spfli-cityto
                INTO flight_info.
    GET spfli.
      EXTRACT flight_info.
    GET sflight.
      EXTRACT flight_date.
    END-OF-SELECTION.
      SORT STABLE.
      LOOP.
        AT FIRST.
          WRITE / 'Flight list'.
          ULINE.
        ENDAT.
        AT flight_info WITH flight_date.
          WRITE: / spfli-carrid , spfli-connid, sflight-fldate,
                   spfli-cityfrom, spfli-cityto.
        ENDAT.
        AT flight_date.
          WRITE: / spfli-carrid , spfli-connid, sflight-fldate.
        ENDAT.
        AT LAST.
          ULINE.
          WRITE: cnt(spfli-carrid), 'Airlines'.
          ULINE.
        ENDAT.
      ENDLOOP.
    Conversion exits are used to pass the values correctly to the fun modules, for ex:
    Kunnr field value is '64564', but the fun module wont take as it is: you have to pass '0000064564', to convert this we use conversion exits for the fields.
    reward if useful
    regards,
    ANJI

  • Extracts in ABAP

    Hi
    I executed the following code.
    NODES: spfli, sflight.
    FIELD-GROUPS: header, flight_info, flight_date.
    INSERT: spfli-carrid spfli-connid sflight-fldate
            INTO header,
            spfli-cityfrom spfli-cityto
            INTO flight_info.
    START-OF-SELECTION.
    GET spfli.
      EXTRACT flight_info.
    GET sflight.
      EXTRACT flight_date.
    Now, my question is where is the data stored internally. The size of the Internal Table is restricted to size of the App Server. Hence we go for Extracts to process Large Data. How is the Data stored and Managed internally in Extracts.

    Hi,
    Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:
    EXTRACT <fg>.
    When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset.
    Each extract record contains exactly those fields that are contained in the field group <fg>, plus the fields of the field group HEADER (if one exists). The fields from HEADER occur as a sort key at the beginning of the record. If you do not explicitly specify a field group <fg>, the
    EXTRACT
    statement is a shortened form of the statement
    EXTRACT HEADER.
    When you extract the data, the record is filled with the current values of the corresponding fields.
    As soon as the system has processed the first EXTRACT statement for a field group <fg>, the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups <fg> and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.
    By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
    Check this link,
    <u>http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db9f0535c111d1829f0000e829fbfe/frameset.htm</u> Hope it helps u.
    Thanks&Regards,
    Ruthra.R

  • Using Extracts in Reports

    How to use extracts in report Programming?

    Writes all fields of the field group fg (see FIELD-GROUPS) as one record to a sequential dataset (paging). If a field group HEADER has been defined, its fields prefix each record to form a sort key. You can then sort this dataset using SORT and process it with LOOP ... ENDLOOP. After this, EXTRACT cannot be executed again.
    As soon as the first dataset for a field group has been extracted with EXTRACT, the field group cannot be expanded using INSERT. The field group HEADER, in particular, cannot be expanded after the first EXTRACT (regardless of field group).
    Large extract datasets are not kept in main memory; instead, they are written to an external help file. You can specify the directory in which this file is to be stored using the SAP profile parameter DIR_EXTRACT. By default, the system uses the SAP file directory SAP profile parameter DIR_DATA).
    Filling an Extract with Data
    Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:
    EXTRACT <fg>.
    When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset.
    Each extract record contains exactly those fields that are contained in the field group <fg>, plus the fields of the field group HEADER (if one exists). The fields from HEADER occur as a sort key at the beginning of the record. If you do not explicitly specify a field group <fg>, the
    EXTRACT
    statement is a shortened form of the statement
    EXTRACT HEADER.
    When you extract the data, the record is filled with the current values of the corresponding fields.
    As soon as the system has processed the first EXTRACT statement for a field group <fg>, the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups <fg> and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.
    By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
    Assume the following program is linked to the logical database F1S.
    REPORT demo_extract_extract.
    NODES: spfli, sflight.
    FIELD-GROUPS: header, flight_info, flight_date.
    INSERT: spfli-carrid spfli-connid sflight-fldate
            INTO header,
            spfli-cityfrom spfli-cityto
            INTO flight_info.
    START-OF-SELECTION.
    GET spfli.
      EXTRACT flight_info.
    GET sflight.
      EXTRACT flight_date.
    There are three field groups. The INSERT statement assigns fields to two of the field groups. During the GET events, the system fills the extract dataset with two different record types. The records of the field group FLIGHT_INFO consist of five fields: SPFLI-CARRID, SPFLI-CONNID, SFLIGHT-FLDATE, SPFLI-CITYFROM, and SPFLI-CITYTO. The first three fields belong to the prefixed field group HEADER. The records of the field group FLIGHT_DATE consist only of the three fields of field group HEADER. The following figure shows the structure of the extract dataset:

  • Data Extract Design

    Hi All,
    I have a requirement where I have to extract data from various different tables-->Only particular columns.
    The requirements are same for different databases, hence I thought to have a single generic approach and reuse the same code to perform the extract and create an ascii file.
    Below is the typical scenarion i want to achieve, hence need your expertise inputs to start off..
    a) Define the required columns -- This should be configurable, i.e., add or remove columns in future.
    b) Extract the column names from the database for those that are defined in the step a) above.
    c) Extract the data from relevent tables/columns for various conditions based on step a and b above.
    d) Create an ascii file for all the data extracted.
    I'm unsure if there is anything wrong or please suggest the best approach.
    Regs,
    R

    user10177353 wrote:
    I'm unsure if there is anything wrong or please suggest the best approach.
    The first thing to bear in mind is that developing a generic, dynamic solution is considerably more more complicated than writing a set of extract statements. So you need to be sure that the effort you're about to expend willl save you more time than writing a script and copying/editing it for subsequent re-use.
    You'll probably need three tables:
    1. Extracts - one record per extract definition (perhaps including info such as target file name)
    2. Extract tables - tableges for each extract
    3. Extract columns - columns for each extracted column.
    I'm writing this as though you'll be extracting more than one table per run.
    The writing to file is the trickiest bit. Choose a good target. Remember that although we called them CSV files, commas actually make a remarkably poor choice of separator, as way too much data contains them. Go for soemthing really unlikely, ideally a multi-character separator like ||¬.
    Also remember text files only take strings, so you need to convert your data to text. Use the data dictionary ALL_TAB_COLUMNS view to get the metatdata for the extracted columns, and apply explicit masks to date and numeric columns. You may want to allow date columns to have masks which include or exclude the time element.
    Consider what you want to do with complex data types (LOBs, UDTs, etc).
    Finally, you need to address the problem of the extract file's location. PL/SQL has a lot of utilities to wrangle files but they only work on the server side. So if you want to write to a local drive you'll need to use SPOOL.
    One last thought: how will you import the data? It would probably be a good idea to use this mechanism to generate DDL for a matching external table.
    Cheers, APC
    Edited by: APC on May 4, 2012 1:08 PM

  • Extract s/m

    Hi,
    What does an extract statement do in the ABAP program?
    Rai...

    Hi,
    Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:
    EXTRACT <fg>.
    When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset.
    Each extract record contains exactly those fields that are contained in the field group <fg>, plus the fields of the field group HEADER (if one exists). The fields from HEADER occur as a sort key at the beginning of the record. If you do not explicitly specify a field group <fg>, the
    EXTRACT
    statement is a shortened form of the statement
    EXTRACT HEADER.
    When you extract the data, the record is filled with the current values of the corresponding fields.
    As soon as the system has processed the first EXTRACT statement for a field group <fg>, the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups <fg> and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.
    By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
    Assume the following program is linked to the logical database F1S.
    REPORT demo_extract_extract.
    NODES: spfli, sflight.
    FIELD-GROUPS: header, flight_info, flight_date.
    INSERT: spfli-carrid spfli-connid sflight-fldate
            INTO header,
            spfli-cityfrom spfli-cityto
            INTO flight_info.
    START-OF-SELECTION.
    GET spfli.
      EXTRACT flight_info.
    GET sflight.
      EXTRACT flight_date.
    There are three field groups. The INSERT statement assigns fields to two of the field groups. During the GET events, the system fills the extract dataset with two different record types. The records of the field group FLIGHT_INFO consist of five fields: SPFLI-CARRID, SPFLI-CONNID, SFLIGHT-FLDATE, SPFLI-CITYFROM, and SPFLI-CITYTO. The first three fields belong to the prefixed field group HEADER. The records of the field group FLIGHT_DATE consist only of the three fields of field group HEADER
    with regards,
    sowjanyagosala

  • Extract

    hi,
    What does an extract statement do in the ABAP program?
    thnks.

    HI,
    Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:
    EXTRACT .
    When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset
    EXTRACT HEADER.
    When you extract the data, the record is filled with the current values of the corresponding fields.
    As soon as the system has processed the first EXTRACT statement for a field group , the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.
    By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
    Cheers,
    Chandra Sekhar.

  • Fastest way to extract data out of xml with following constraints.

    10.2 on linux
    xml files are being dropped off into a queue. in the queue the documents must be stored as clobs so that control can be given back to the client as soon as possible.
    once in the queue we would like to extract all the data from the xml and place it in relational staging tables. the data is then moved from these tables into production.
    the only thing that can change is what happens between the queue and the staging tables. currently i am just using extract statements to pull the data out of the clob.
    the files are around 20mb and currently take over 20 minutes to process which is way too long.
    i looked at DBMS_XMLSTORE but we cannot alter the xml format.
    i looked at Oracle text but if i understand it correctly, we would have to rebuild the entire index after every new queue item.
    i have very little experience with xml so i want to make sure i know all my options.
    from what i can tell my only option is to take the clob and let xml db parse it into o-r tables. ...but even that seems like a horrible waste.
    is there anything else i can do? any pointers?
    thanks for any help!
    by the way...this forum has been of great help. my only problem is that i don't seem to ask the right questions at the right time.

    Chris
    Most people seem to find that allow XML DB to persist the XML using the object based storage and nested tables and then using insert as select operations is the most effective way to do what you want. There are a number of threads on how to best do this..
    The question to ask is do you really need the relational staging tables. If you read through the forum you'll see that once the XML has been persisted as objects, and the XML objects have been stored using a nested table storage models you can easily create relational views to represent the staging tables.
    This process will work very well if there are no updates to the staging tables. Effectively you will process the XML once, when you insert into the Schema based tables, and then use the relational views as the source for the migration from staging to production.
    If you haven't already done so, reading the following posts will help you with this
    XMLType column based on XML Schema: several questions
    http://forums.oracle.com/forums/thread.jspa?threadID=347820&tstart=0
    problem with sql/xml
    XML Query Performance on Nested Tables
    Basically you'll need an XML Schema that describes your XML and you'll need to set up nested table storage for each of the collections in your XML Schema in order to the required performance when using the views.
    The easiest way will be to use the default table that is creted when registering the XML Schema and the annotation xdb:storeVarrayAsTable="true" and then ensure that you sequence each collection correctly.

  • Extracts

    What is meant by extracts

    HI
    An extract is a sequential dataset in the memory area of the program. Greater than 500 KB are stored on O/s
    Writes all fields of the field group fg (see FIELD-GROUPS) as one record to a sequential dataset (paging). If a field group HEADER has been defined, its fields prefix each record to form a sort key. You can then sort this dataset using SORT and process it with LOOP ... ENDLOOP. After this, EXTRACT cannot be executed again.
    As soon as the first dataset for a field group has been extracted with EXTRACT, the field group cannot be expanded using INSERT. The field group HEADER, in particular, cannot be expanded after the first EXTRACT (regardless of field group).
    Large extract datasets are not kept in main memory; instead, they are written to an external help file. You can specify the directory in which this file is to be stored using the SAP profile parameter DIR_EXTRACT. By default, the system uses the SAP file directory SAP profile parameter DIR_DATA).
    Filling an Extract with Data
    Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:
    EXTRACT <fg>.
    When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset.
    Each extract record contains exactly those fields that are contained in the field group <fg>, plus the fields of the field group HEADER (if one exists). The fields from HEADER occur as a sort key at the beginning of the record. If you do not explicitly specify a field group <fg>, the
    EXTRACT
    statement is a shortened form of the statement
    EXTRACT HEADER.
    When you extract the data, the record is filled with the current values of the corresponding fields.
    As soon as the system has processed the first EXTRACT statement for a field group <fg>, the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups <fg> and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.
    By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
    Assume the following program is linked to the logical database F1S.
    REPORT demo_extract_extract.
    NODES: spfli, sflight.
    FIELD-GROUPS: header, flight_info, flight_date.
    INSERT: spfli-carrid spfli-connid sflight-fldate
    INTO header,
    spfli-cityfrom spfli-cityto
    INTO flight_info.
    START-OF-SELECTION.
    GET spfli.
    EXTRACT flight_info.
    GET sflight.
    EXTRACT flight_date.
    There are three field groups. The INSERT statement assigns fields to two of the field groups. During the GET events, the system fills the extract dataset with two different record types. The records of the field group FLIGHT_INFO consist of five fields: SPFLI-CARRID, SPFLI-CONNID, SFLIGHT-FLDATE, SPFLI-CITYFROM, and SPFLI-CITYTO. The first three fields belong to the prefixed field group HEADER. The records of the field group FLIGHT_DATE consist only of the three fields of field group HEADER. The following figure shows the structure of the extract dataset:
    You can have only one extract per program
    Check this out -
    http://help.sap.com//saphelp_470/helpdata/EN/9f/db9ed135c111d1829f0000e829fbfe/content.htm
    Regards Rk
    Message was edited by:
            Rk Pasupuleti

  • Help on reports

    1)What does an extract statement do in the ABAP program?
    2)What is the meaning of ABAP editor integrated with ABAP  data dictionary?
    3)WHAT IS THE TRANSPORT REQUEST NUMBER?
    4)Where do you give technical properties for a table?
    5)What is the difference between clear and refresh?
    6)How does check, continue and exit commands work
         In loop and End Loop.
    7)What is a hard break Point?
    8)What is the difference between Initialization and
          parameters ?
    9)What is Performance tuning?
    10)What is the difference between Primary key and Unique Key?
    11)What are the ways to find out the tables used in the program?
    12)Difference between SY-TABIX and SY-INDEX? Where it is used?

    Please try searching the forum first.  Thanks
    Regards,
    Rich Heilman

Maybe you are looking for

  • How much ram can my MacBook Pro 15 Inch, Early 2008 2.4 Core Duo 2 Take? 3 or 4 GB?

    My MacBook Pro 15 Inch is a early 2008 model. It is a 2.4 Core 2 Duo. I'm confused if it can take a max of 3 or 4 GB RAM.  Right now it has 2 GB. First question:  Can it take 3 or 4? Second question:  Will I notice an increase in speed? BTW - I check

  • Push data from BW 3.5 to XI 3.0

    Hi SDN, I have to design an interface to push data from an Infospoke of BW to XI which does the necessary mapping and forwards it to a FTP server. I am using ABAP proxies to communicate with BW. Can somebody suggest me the approach to push data from

  • Help.required.spaces&some.letters.'ot.worki'g

    please.help. as.you.ca.see.my.spaces.ad.the.letter.after.comig.after.m.i.the.alphabet.ist.wor kig.ad.some.others. ahhhhh i.tried.a.plug.i.keyboard.but.o.differece. i.have.a.imac

  • Updating from OS X 10.5.4 to 10.5.8

    Hi I'm new to Mac and recently my brother gave me his old Power Mac G5 with IBM based dual core 2.0 ghz. Before giving it to me, my brother updated the Max OS X software to 10.5.4. It's working great except computer is keep telling me to update the s

  • What does writing video mean

    Hey guys, I'm new to FCP so bear with me. When I leave a project up for a while it begins to "write video". I'm just curious as to what this means; the project has already been saved and runs fine when I pull it up, why does it need to take 8 hours t