TYPES statement in abap class to include structure

hi ,
i have declared following in a abap class...
TYPES:
      zts_alv_line TYPE zmat_pr_costest_alv.
     TYPES:BEGIN OF ts_alv_line,
            include type zts_alv_line,
            matkl type mara-matkl,
            t023t type t023t-wgbez,
            lvorm type mara-lvorm,
            end of ts_alv_line.
     TYPES: tt_alv_data TYPE STANDARD TABLE OF ts_alv_line WITH DEFAULT KEY.
     DATA:
      alv_data TYPE tt_alv_data.
now while refering to alv_data-matnr the sap is giving error that this component does not have matnr.
please help.
Edited by: Suhas Saha on Feb 3, 2012 1:11 PM

TYPES: zts_alv_line TYPE zmat_pr_costest_alv.
TYPES:BEGIN OF ts_alv_line,
            include type zts_alv_line,
            matkl type mara-matkl,
            t023t type t023t-wgbez,
            lvorm type mara-lvorm,
            end of ts_alv_line.
Actually by defining this you've defined include as field of ts_alv_line. Actually ts_alv_line is a nested structure.
I think you need to re-define the structure definition as:
TYPES:BEGIN OF ts_alv_line.
      INCLUDE TYPE zts_alv_line.
TYPES: matkl TYPE mara-matkl,
       t023t TYPE t023t-wgbez,
       lvorm TYPE mara-lvorm.
TYPES: END OF ts_alv_line.
BR,
Suhas

Similar Messages

  • Red TYPE statement in ABAP

    has anyone seen this format in ECC 5.0 ...
    TYPE pernr#TYPE pa0000-pernr. "Personnel number
    In the editor it is displayed in red.
    many thanks, john

    Wow,  you wouldn't think that you could use a reserved word in a macro def.  This really is not a good thing.  I'm with Neil,  it could be a macro.
    report zrich_0001.
    data: pernr#type(10) type c,
          pa0000-pernr type pa0000-pernr.
    define type.
    write:/ &1, &2.
    end-of-definition.
    pernr#type = 'This'.
    pa0000-pernr = '123456'.
    TYPE pernr#TYPE pa0000-pernr.
    Regards,
    Rich Heilman

  • ABAP Classes & Macros ( CNTN02 & CNTN03 )

    Good day
    Background:
    Inside a Workflow BADI (def BBP_WFL_APPROV_BADI ) implementation. I need get approval agents by to evaluating Rule (eg: AC9000001).
    I found SAP Help (link below) which says I can use <CNTN02> & <CNTN03> "To use the macros in ABAP classes, the include files <CNTN02> and <CNTN03> must be included. In the Class Builder, include the include file <CNTN02> by choosing Goto >> Class Local Types >> Macros. Include the include file <CNTN03> by choosing Goto >> Class Local Types >> Local Class Definitions/Types."
    [SAP Help -- To use the macros in ABAP classes|http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4b130453d11d189430000e829fbbd/frameset.htm]
    Problem:
    The option Goto >> Class Local Types >> Macros  is greyed out. Means I cannot include <CNTN02>
    The option Goto >> Class Local Types >> Local Class Definitions/Types is available and I can enter <CNTN03> as per SAP Help
    Question:
    Has anyone come across this problem? How did you get past it?
    System:
    SAP_ABA      640 level 18
    SAP_BASIS   640 level 18

    Hi,
    This is still the approved method so stick with this.
    It works perfectly ok so there is no view to changing it.
    Cheers
    Colin

  • Error on extended check for types include structure statements

    Hi All ,
                  On Extended check im getting error :
    Program:  ZFIR_VALUATE_OBSOLETE_STOCK  Include:  ZFIR_VALUATE_OBSOLETE_STOCK_F  Row:   1205
    The current ABAP command is obsolete
    Within classes and interfaces, you can only use "TYPE" to refer to ABAP Dictionary
    types, not "LIKE" or "STRUCTURE".
    Internal Message Code: MESSAGE G/B
    (The message cannot be hidden using pseudo-comment "#EC .., bzw. durch SET
    EXTENDED CHECK OFF/ON)
    The error is in below line :
    TYPES: BEGIN OF t_fttax.
              INCLUDE STRUCTURE fttax.
      TYPES: END OF t_fttax.
    and fttax is a dictionary strucuture . i made internal table and work area using it .
    DATA: i_fttax TYPE STANDARD TABLE OF t_fttax,
            wa_fttax TYPE t_fttax.
    Need Help ,what i should do to remove this error ?
    Regards

    declare as :
    DATA: i_fttax TYPE STANDARD TABLE OF fttax,
               wa_fttax TYPE fttax.
    No need to declare as :
    TYPES: BEGIN OF t_fttax.
              INCLUDE STRUCTURE fttax.
      TYPES: END OF t_fttax.

  • ABAP Coding:The included type has no structure

    Hi All,
    When i tried to write following code, i 'm getting error like "*The included type has no structure *"
    TYPES:
          BEGIN OF it_datapak1.
                INCLUDE STRUCTURE RESULT_PACKAGE.
        TYPES:
             alpha(18) TYPE c,
          END OF it_datapak1.
    Any guesses?

    Hi
    Check in SE11 wether you have any structure with name RESULT_PACKAGE.
    Regards
    Srilaxmi

  • Include in ABAP class for Workflow

    Hi,
    In order to use BOR macros inside ABAP class, (From SAP help) came to know that we need to use include <cntn02> .
    How to add this include to ABAP class for workflow?
    Regds,
    Akshay

    Hi Akshay,
    Slight difference, I said "keeping the class clean of BOR <i>code</i>". By all means use BO's in the class: basically create a ZCL_MATERIAL, and use BUS1001 as an attribute (I use a naming convention BO_* for these). As long as it's the right type (SIBFLPORB I think - no system handy right now), and the key values are populated correctly the system will instantiate it as necessary. So in WF I can refer to ZCL_MATERIAL.BO_MATERIAL whenever I need any of the BO's functionality.
    You are correct though, creating a proper business class which you can instantiate such as material does involve a fair bit of effort and coding to set up. e.g. my last project I ended up creating one ZBOR subtype because all I needed was one new attribute - definitely not worthwhile creating a new class for. (USR01.zEmailAddress for what it's worth).
    I've said before somewhere, it's not without pain, so if you're under time pressure etc, then it may be better to do whatever's quickest. There's nothing wrong with using BOR macros, it will still work for quite a few versions. I just meant to say that pure class(y) code is a preferred way to go if it makes sense to do so. This is not always the case.
    Hope that helps,
    Mike

  • Include in ABAP class

    Hi all,
    Would like to know how to use a INCLUDE in ABAP class.
    Regrdas,
    Akshay

    Like any other INCLUDE.   See below:
    CLASS lcl_event_receiver_g1 DEFINITION.
      PUBLIC SECTION.
        include zr_snax_class_defs.
      PRIVATE SECTION.
    ENDCLASS.
    CLASS lcl_event_receiver_g1 IMPLEMENTATION.
      METHOD handle_toolbar.
        include zr_snax_class_info2.
      ENDMETHOD.
      METHOD handle_user_command.
        DATA: lt_rows TYPE lvc_t_row.
        data: Proceed.
        data: l_cnt type i.
        Perform Clear_Refr_Variables .
    get selected row
        CALL METHOD grid1->get_selected_rows
                 IMPORTING et_index_rows = lt_rows.
        CALL METHOD cl_gui_cfw=>flush.
        assign P1[] to <TheGrid>.
        Refresh_G1 = 'Y'.
        include zr_snax_class_info3.
        unassign <TheGrid>.
      ENDMETHOD.                           "handle_user_command
    ENDCLASS.

  • Table type with include structure

    Hi All,
    How to declare a table type with include structure
    i am declaraing it in the following way its giving epc check of obselete statement,
    could any one tell me how to declare a table type and internal table for the following code.
    DATA:BEGIN OF TY_OUTPUT OCCURS 0.
    DATA:PS_PSP_PNR TYPE EKKN-PS_PSP_PNR.
    INCLUDE STRUCTURE ST_ZCDTT0005.
    DATA:END OF TY_OUTPUT.
    Thanks in advance.

    Hi
    TYPES: BEGIN OF TY_OUTPUT,
             PS_PSP_PNR TYPE EKKN-PS_PSP_PNR.
             INCLUDE STRUCTURE ST_ZCDTT0005.
    TYPES: END OF TY_OUTPUT.
    TYPES: TY_T_OUTPUT TYPE TABLE OF TY_OUTPUT.
    Max

  • Message Mapping of type ABAP Class not being shown

    Hi all,
    I have been trying to follow the given blog:
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    Even after doing the changes mentioned in the blog, i do not see the ABAP Class in the list of Message Mapping types.
    Do i need to do anyother configuration. Pls guide.
    Regards
    Neetu

    Hi Neetu,
    You will have to enable your ABAP mapping first.
    Do the following steps, pay carefull attention to the values you enter,
    In
    IntegrationBuilder ->IntegrationBuilder.Repository -> com.sap.aii.repository.mapping.additionaltypes
    enter the value of
    R3_ABAP|Abapclass;R3_XSLT|XSL (ABAP Engine)
    If the above doesnt work, try Abap-class instead of Abapclass in the above line.
    And then follow the remaining steps, make sure that the above value is correct. Your ABAP mapping should appear in your Integration Repository.'
    I suggest you go through these links:
    https://websmp101.sap-ag.de/~sapdownload/011000358700003082332004E/HowToABAPMapping.pdf
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    ABAP Mapping Vs Java Mapping.
    Refer to following SDN Demo which explains the need and how to do the ABAP mapping.
    https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/110ff05d-0501-0010-a19d-958247c9f798#jdi [original link is broken]
    This document will help you to create ABAP Mapping.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how%20to%20use%20abap-mapping%20in%20xi%203.0.pdf
    Regards,
    Abhy

  • How to include structure in Types Definition ???

    Hello All,
          I want a declaration like this in BSP :-
    DATA : BEGIN OF imkop OCCURS 100.
                   INCLUDE STRUCTURE mkop.
    DATA :   waers LIKE mepro-waers.      
    DATA : END OF imkop.
    <b>In BSP: Type Definitions</b>
    I wrote like this :-
    Types : BEGIN OF imkop.
                    INCLUDE STRUCTURE mkop.
    Types :   waers type mepro-waers.      
    Types : END OF imkop. 
                   I'm getting an error saying that I can't use structures in this .
    Now what should I do ?
    Can anyone help me out ?
    Regards,
    Deepu.K

    deepu,
    we can declare structures as below.
    DATA:  event_data      TYPE REF TO cl_htmlb_event.
    TYPES: BEGIN OF row_iid_type,
           row_iid  TYPE hap_row_iid,
           END OF row_iid_type.
    DATA:
           t_row             TYPE STANDARD TABLE OF row_iid_type,
           t_row_wa          TYPE row_iid_type,
           t_message  TYPE STANDARD TABLE OF bal_s_msg .
    DATA:
           lw_body_element   TYPE hap_s_body_elements,
           lw_body_column    TYPE hap_s_body_columns,
           lw_body_cell      TYPE hap_s_body_cells,
           lw_return         TYPE bal_s_msg,
           warning TYPE i.
    regards,
    manasa

  • Include structure in TYPES declaration

    Hello All:
    Many forum posts have discussed similar topics, but I couldn't exactly find one answering my requirement. Apologies if I have missed out reading some.
    Instead of creating a type as below (as suggested in few forum posts)
    TYPES begin of types ty_itab
                         include type BISEG
                         xxxx type xxx
                         xxxx type xxx
                End of types ty_itab
    I need to create the type with include structure after the additonal fields.
    TYPES begin of types ty_itab
                         <fld1> type <ty1>
                         <fld2> type <ty2>
                         include type <struc>
                End of types ty_itab
    Can someone give the right syntax?
    Please help,
    Fred.

    Hello Fred
    If you are using the extended syntax you should not encounter any problems:
    TYPES: begin of types ty_itab.
    TYPES:                     <fld1> type <ty1>.
    TYPES:                     <fld2> type <ty2>.
                         include type <struc>.
    TYPES: End of types ty_itab
    Regards
      Uwe

  • Including structure in TYPES-- urgent

    hi
    this is an itab with header line
    data: begin of xdb_mchb occurs 0.
            include structure mchb.
    data:   vrfmg      like v01fdk-vrfmg.
    data:   cuobj      like inob-cuobj.
    data:   lifnr      like mkol-lifnr.
    data:   sobkz      like mkol-sobkz.
    data:   lobm_bprio like bfstock-lobm_bprio.
    data: end of xdb_mchb.
    and i want to define an explicit work area  so i have done it like this :
    types :       BEGIN OF ts_xdb_mchb ,
           <b>include structure mchb,</b>
            vrfmg      TYPE v01fdk-vrfmg,
            cuobj      TYPE inob-cuobj,
            lifnr      TYPE mkol-lifnr,
            sobkz      TYPE mkol-sobkz,
            lobm_bprio TYPE bfstock-lobm_bprio,
           END OF ts_xdb_mchb.
    but i m getting error. as ""," expected after "INCLUDE"."
    can we include structure in TYPES please let me know..
    thnx<b></b><b></b><b></b><b></b>

    Hi neha,
    After INCLUDE don't put " , " instead put " . "
    So that you can errors.
    It will work try.OK
    types : BEGIN OF ts_xdb_mchb ,
                 vrfmg TYPE v01fdk-vrfmg,
                 cuobj TYPE inob-cuobj,
                 lifnr TYPE mkol-lifnr,
                 sobkz TYPE mkol-sobkz,
                 lobm_bprio TYPE bfstock-lobm_bprio,
                 <b>include structure mchb.</b>
    END OF ts_xdb_mchb.
    If helps, reward.
    regards,
    V.Raghavender.

  • In a server proxy how can I use a INCLUDE STRUCTURE?

    Hi people!!, how can I put an internal table with an INCLUDE statement in a server proxy in abap. If I put the next code the system present me this error: Within classes and interfaces, you can only use "TYPE" to refer to ABAP     , Dictionary types, not "LIKE" or "STRUCTURE".
    The problem is that I need the STRUCTURE to make a APPEND.
    Thanks for the help.
    DATA: BEGIN OF bdc_tab .
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdc_tab.

    Hi Carlos,
    Yes. It mainly accepts TYPE statements.
    You can use this as:
    DATA: BDC_LINE type bdcdata.
    DATA: BDC_TAB type table of bdcdata.
    When you want to use,
    Fill the BDC_LINE.
    Then:
    Append BDC_LINE to BDC_TAB.
    Or:
    Loop at BDC_TAB into BDC_LINE.
    Cheers,
    Bhanu

  • Regarding types statement in ECC 6.0...plz reply..urgent

    Hi,
    I am copying a program which is in<b> 4.7 to ECC 6.0,</b>i am facing error regarding <b>structures with types<b>...
    The following code in<b> 4.7</b>
    <b>DATA:BEGIN OF W_BMM00.
            INCLUDE STRUCTURE BMM00.
    DATA:END OF W_BMM00.
    DATA:BEGIN OF W_BMMH1.
            INCLUDE STRUCTURE BMMH1.
    DATA:END OF W_BMMH1.
    DATA:BEGIN OF W_BMMH7.
            INCLUDE STRUCTURE BMMH7.
    DATA:END OF W_BMMH7.
    DATA : BEGIN OF TAB_TLINE OCCURS 0.
            INCLUDE STRUCTURE TLINE.
    DATA : END OF TAB_TLINE.</b>
    i have written the same in <b>ECC6.0</b> as below
    <b>TYPES:BEGIN OF tw_bmm00.
            INCLUDE STRUCTURE bmm00.
    TYPES:END OF tw_bmm00 ,
          tt_bmm00 TYPE STANDARD TABLE OF tw_bmm00.
    TYPES:BEGIN OF tw_bmmh1.
            INCLUDE STRUCTURE bmmh1.
    TYPES:END OF tw_bmmh1 ,
              tt_bmmh1 TYPE STANDARD TABLE OF tw_bmmh1.
    TYPES:BEGIN OF tw_bmmh7.
            INCLUDE STRUCTURE bmmh7.
    TYPES:END OF tw_bmmh7 ,
          tt_bmmh7  TYPE STANDARD TABLE OF tw_bmmh7.
    TYPES:BEGIN OF tw_TAB_TLINE.
            INCLUDE STRUCTURE TLINE.
    TYPES:END OF tw_TAB_TLINE,
          tt_tab_tline TYPE STANDARD TABLE OF tw_tab_tline.
    lw_bmm00 TYPE tw_bmm00,
          lt_bmm00 TYPE tt_bmm00,
          lw_bmmh1 TYPE tw_bmmh1,
          lt_bmmh1 TYPE tt_bmmh1,
          lw_bmmh7 TYPE tw_bmmh7,
          lt_bmmh7 TYPE tt_bmmh7,
          lw_tab_thead TYPE tw_tab_thead,
          lt_tab_thead TYPE tt_tab_thead,</b>....
    when i check SLIN errors i am getting the following errors<b>...plz resolve</b>..
    <b>The current ABAP command is obsolete
    <b>Within classes and interfaces, you can only use "TYPE" to refer to ABAP Dictionary
    types (not "LIKE" or "STRUCTURE").</b></b>
    <b></b>

    include strture not allowed.
    rules.
    ABAP Development under Unicode
    Prior to Unicode the length of a character was exactly one byte, allowing implicit typecasts or memory-layout oriented programming. With Unicode this situation has changed: One character is no longer one byte, so that additional specifications have to be added to define the unit of measure for implicit or explicit references to (the length of) characters.
    Character-like data in ABAP are always represented with the UTF-16 - standard (also used in Java or other development tools like Microsoft's Visual Basic); but this format is not related to the encoding of the underlying database.
    A Unicode-enabled ABAP program (UP) is a program in which all Unicode checks are effective. Such a program returns the same results in a non-Unicode system (NUS) as in a Unicode system (US). In order to perform the relevant syntax checks, you must activate the Unicode flag in the screens of the program and class attributes.
    In a US, you can only execute programs for which the Unicode flag is set. In future, the Unicode flag must be set for all SAP programs to enable them to run on a US. If the Unicode flag is set for a program, the syntax is checked and the program executed according to the rules described in this document, regardless of whether the system is a US or a NUS. From now on, the Unicode flag must be set for all new programs and classes that are created.
    If the Unicode flag is not set, a program can only be executed in an NUS. The syntactical and semantic changes described below do not apply to such programs. However, you can use all language extensions that have been introduced in the process of the conversion to Unicode.
    As a result of the modifications and restrictions associated with the Unicode flag, programs are executed in both Unicode and non-Unicode systems with the same semantics to a large degree. In rare cases, however, differences may occur. Programs that are designed to run on both systems therefore need to be tested on both platforms.
    Other Changes
    1. Bit Statements
    2. Adding Field Sequences
    3. Loops with VARY and VARYING
    4. Creating Subroutines
    5. Saving Programs
    6. Assigning Types for GET/SET PARAMETER
    7. Unreachable Statements
    8. Function Modules with Incorrect Parameter Names
    1. Bit Statements
    Previously, the system checked for the bit statements SET BIT i OF f [TO g] and GET BIT i OF f [INTO g]whether the field f is character-type; X fields, X strings, and flat structures are usually regarded as character-type. For Unicode programs this is no longer useful, because the types X and XSTRING no longer count as character-type and the bit by bit access to character-type fields or structures is no longer platform-independent. Therefore, with these operations in Unicode programs, the field f must be type X or XSTRING.
    For the bit mask operations f O x, f Z x, and f M x you could previously use all number-type and hence all character-type types for the left operand f. In Unicode programs, the f operand must now be type X or XSTRING.
    2. Adding Field Sequences
    When adding field sequences, restrictions apply to the following statements in Unicode:
    ADD n1 THEN n2 UNTIL nz [ ACCORDING TO sel ] GIVING m ...
    ADD n1 THEN n2 UNTIL nz TO m [ RANGE str ].
    1. The operands n1, n2, and nz must be type-compatible with one another.
    2. The distance between nz and n1 must be an integral multiple of the distance between n2 and n1.
    3. A syntax or runtime error occurs if the fields n1, n2, and nz are not in a structure. This structure must be recognizable statically or its valid area must be marked explicitly using the RANGE addition.
    4. At runtime, the system ensures that the RANGE area is not left.
    ADD n1 FROM i1 GIVING m [ RANGE str ].
    1. Field n1 must be within the structure. The structure must be explicitly defined using the RANGE addition if it is not recognizable statically.
    2. For this variant, the system also checks at runtime whether n1 and the addressed values are within the structure.
    3. Loops
    Loops with the VARY or VARYING addition are also problematic in Unicode, since a type-a access to memory contents cannot be ensured and memory can be overwritten inadvertently.
    DO ... VARYING f FROM f1 NEXT f2.
    For this statement, the fields f, f1, and f2 must be type-compatible with each other. To prevent memory contents being overwritten, a RANGE for valid accesses is introduced implicitly or explicitly for the following statements:
    DO ... TIMES VARYING f FROM f1 NEXT f2 [ RANGE f3 ].
    WHILE ... VARY f FROM f1 NEXT f2 [ RANGE f3 ].
    A syntax or runtime error is caused if f1 or f2 are not included in f3. If the RANGE addition is missing, it is defined implicitly from FROM f1 NEXT f2 as follows:
    1. If both f1 and f2 are statically recognizable components of the same structure, the valid RANGE area is defined from the smallest structure that comprises f1 and f2.
    2. A syntax error is triggered if it is recognizable statically that f1 and f2 are not part of the same structure.
    3. A valid area must be defined explicitly using the RANGE addition if the connection between f1 and f2 is not recognizable statically.
    If you specify a deep structure as the RANGE addition, the system checks for every loop pass that there are no field references, object references, tables, or strings in the area read.
    4. Creating Subroutines
    When automatically generating subroutines using the statement GENERATE SUBROUTINE POOL itab NAME name, the generated program inherits the content of the Unicode flag of the generating program.
    5. Saving Programs
    When automatically generating programs using the statement INSERT REPORT prog FROM itab, default values are set for the TRDIR entry as before. Amongst other things, this statement has the new addition UNICODE ENABLING uc, with which the Unicode flag of the inserted report receives the value of uc. If this addition is missing, the following applies:
    1. A Unicode program creates a Unicode program.
    2. A non-Unicode program in turn creates a non-Unicode program.
    3. A non-Unicode program becomes a Unicode program if it is overwritten by a Unicode program.
    4. A Unicode program remains a Unicode program if it is overwritten by a non-Unicode program.
    6. Assigning Types for GET/SET PARAMETER
    For the statements GET PARAMETER ID pid FIELD f and GET PARAMETER ID pid FIELD f, f must be character-type. You can use the EXPORT and IMPORT statements for storing non-character-type fields and structures.
    7. Unreachable Statements
    In Unicode programs, unreachable statements cause a syntax error. In non-Unicode programs, there was previously only a syntax warning.
    8. Function Modules with Incorrect Parameter Names
    In Unicode programs, calling a function module, whose parameter names are specified statically as a literal or constant, causes an exception that can be handled if an incorrect parameter name was specified. This only applies to function modules that are not called via Remote Function Call. In non-Unicode programs, an incorrect name was previously ignored.
    http://service.sap.com/instguides
    --> SAP Business Suite Applications
    --> SAP ERP
    --> mySAP ERP 2005
    --> Upgrade
    --> Upgrade Documentation - mySAP ERP 2005 SR2
    There choose your database and operating system.
    If you're looking for functional details check
    http://service.sap.com/releasenotes

  • SQL Statements in ABAP and meaning

    Hello Friends,
    Please, can anybody provide me a documentation on the different ABAP SQL statements and there usage/meanings.
    Thanks,
    Shreekant

    hi,
    goto abapdocu->abap Database access->open Sql you will get examples.
    for documnetation got se38->specify the command and press F1.
    SELECT:
    Put the curson on that word and press F1 . You can see the whole documentation for select statements.
    SELECT result
    FROM source
    INTO|APPENDING target
    [[FOR ALL ENTRIES IN itab] WHERE sql_cond]
    Effect
    SELECT is an Open-SQL-statement for reading data from one or several database tables into data objects.
    The select statement reads a result set (whose structure is determined in result ) from the database tables specified in source, and assigns the data from the result set to the data objects specified in target. You can restrict the result set using the WHERE addition. The addition GROUP BY compresses several database rows into a single row of the result set. The addition HAVING restricts the compressed rows. The addition ORDER BY sorts the result set.
    The data objects specified in target must match the result set result. This means that the result set is either assigned to the data objects in one step, or by row, or by packets of rows. In the second and third case, the SELECT statement opens a loop, which which must be closed using ENDSELECT. For every loop pass, the SELECT-statement assigns a row or a packet of rows to the data objects specified in target. If the last row was assigned or if the result set is empty, then SELECT branches to ENDSELECT . A database cursor is opened implicitly to process a SELECT-loop, and is closed again when the loop is ended. You can end the loop using the statements from section leave loops.
    Up to the INTO resp. APPENDING addition, the entries in the SELECTstatement define which data should be read by the database in which form. This requirement is translated in the database interface for the database system´s programming interface and is then passed to the database system. The data are read in packets by the database and are transported to the application server by the database server. On the application server, the data are transferred to the ABAP program´s data objects in accordance with the data specified in the INTO and APPENDING additions.
    System Fields
    The SELECT statement sets the values of the system fields sy-subrc and sy-dbcnt.
    sy-subrc Relevance
    0 The SELECT statement sets sy-subrc to 0 for every pass by value to an ABAP data object. The ENDSELECT statement sets sy-subrc to 0 if at least one row was transferred in the SELECT loop.
    4 The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.
    8 The SELECT statement sets sy-subrc to 8 if the FOR UPDATE addition is used in result, without the primary key being specified fully after WHERE.
    After every value that is transferred to an ABAP data object, the SELECT statement sets sy-dbcnt to the number of rows that were transferred. If the result set is empty, sy-dbcnt is set to 0.
    Notes
    Outside classes, you do not need to specify the target area with INTO or APPENDING if a single database table or a single view is specified statically after FROM, and a table work area dbtab was declared with the TABLES statement for the corresponding database table or view. In this case, the system supplements the SELECT-statement implicitly with the addition INTO dbtab.
    Although the WHERE-condition is optional, you should always specify it for performance reasons, and the result set should not be restricted on the application server.
    SELECT-loops can be nested. For performance reasons, you should check whether a join or a sub-query would be more effective.
    Within a SELECT-loop you cannot execute any statements that lead to a database commit and consequently cause the corresponding database cursor to close.
    SELECT - result
    Syntax
    ... lines columns ... .
    Effect The data in result defines whether the resulting set consists of multiple rows (table-like structure) or a single row ( flat structure). It specifies the columns to be read and defines their names in the resulting set. Note that column names from the database table can be changed. For single columns, aggregate expressions can be used to specify aggregates. Identical rows in the resulting set can be excluded, and individual rows can be protected from parallel changes by another program.
    The data in result consists of data for the rows lines and for the columns columns.
    SELECT - lines
    Syntax
    ... { SINGLE }
    | { { } } ... .
    Alternatives:
    1. ... SINGLE
    2. ... { }
    Effect
    The data in lines specifies that the resulting set has either multiple lines or a single line.
    Alternative 1
    ... SINGLE
    Effect
    If SINGLE is specified, the resulting set has a single line. If the remaining additions to the SELECT command select more than one line from the database, the first line that is found is entered into the resulting set. The data objects specified after INTO may not be internal tables, and the APPENDING addition may not be used.
    An exclusive lock can be set for this line using the FOR UPDATE addition when a single line is being read with SINGLE. The SELECT command is used in this case only if all primary key fields in logical expressions linked by AND are checked to make sure they are the same in the WHERE condition. Otherwise, the resulting set is empty and sy-subrc is set to 8. If the lock causes a deadlock, an exception occurs. If the FOR UPDATE addition is used, the SELECT command circumvents SAP buffering.
    Note
    When SINGLE is being specified, the lines to be read should be clearly specified in the WHERE condition, for the sake of efficiency. When the data is read from a database table, the system does this by specifying comparison values for the primary key.
    Alternative 2
    Effect
    If SINGLE is not specified and if columns does not contain only aggregate expressions, the resulting set has multiple lines. All database lines that are selected by the remaining additions of the SELECT command are included in the resulting list. If the ORDER BY addition is not used, the order of the lines in the resulting list is not defined and, if the same SELECT command is executed multiple times, the order may be different each time. A data object specified after INTO can be an internal table and the APPENDING addition can be used. If no internal table is specified after INTO or APPENDING, the SELECT command triggers a loop that has to be closed using ENDSELECT.
    If multiple lines are read without SINGLE, the DISTINCT addition can be used to exclude duplicate lines from the resulting list. If DISTINCT is used, the SELECT command circumvents SAP buffering. DISTINCT cannot be used in the following situations:
    If a column specified in columns has the type STRING, RAWSTRING, LCHAR or LRAW
    If the system tries to access pool or cluster tables and single columns are specified in columns.
    Note
    When specifying DISTINCT, note that you have to carry out sort operations in the database system for this.
    SELECT - columns
    Syntax
    | { {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ... }
    | (column_syntax) ... .
    Alternatives:
    1. ... *
    2. ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    3. ... (column_syntax)
    Effect
    The input in columns determines which columns are used to build the resulting set.
    Alternative 1
    Effect
    If * is specified, the resulting set is built based on all columns in the database tables or views specified after FROM, in the order given there. The columns in the resulting set take on the name and data type from the database tables or views. Only one data object can be specified after INTO.
    Note
    If multiple database tables are specified after FROM, you cannot prevent multiple columns from getting the same name when you specify *.
    Alternative 2
    ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    Effect
    A list of column labels col1 col2 ... is specified in order to build the resulting list from individual columns. An individual column can be specified directly or as an argument of an aggregate function aggregate. The order in which the column labels are specified is up to you and defines the order of the columns in the resulting list. Only if a column of the type LCHAR or LRAW is listed does the corresponding length field also have to be specified directly before it. An individual column can be specified multiple times.
    The addition AS can be used to define an alternative column name a1 a2 ... with a maximum of fourteen digits in the resulting set for every column label col1 col2 .... The system uses the alternative column name in the additions INTO|APPENDING CORRESPONDING FIELDS and ORDER BY. .
    http://help.sap.com/saphelp_nw04/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/content.htm

Maybe you are looking for