What is the use of at new statement?

What is the use of at new statement?

Hi,
AT - itab
Syntax
LOOP AT itab result ...
  [AT FIRST.
   ENDAT.]
    [AT NEW comp1.
     ENDAT.
       [AT NEW comp2.
       ENDAT.
       AT END OF comp2.
       ENDAT.]
     AT END OF comp1.
     ENDAT.]
  [AT LAST.
  ENDAT.]
ENDLOOP.
Extras:
1. ...  FIRST
2. ... |{END OF} compi
3. ...  LAST
Effect
The statement block of a LOOP loop can contain control structures for control level processing. The respective control statement is AT. The statements AT and ENDAT define statement blocks that are executed at control breaks, that is, when the control structure is changed. The additions to the AT statements determine the control break at which their statement blocks are executed. Within these statement blocks, the statement SUM can be specified to add together the numeric components of a control level. For the output behavior result, the same applies as for LOOP AT.
The prerequisite for control level processing is that the internal table is sorted in exactly the same sequence as the component of its line type - that is, first in accordance with the first component, then in accordance with the second component, and so on. The line structure and the corresponding sorting sequence gives a group structure of the content of the internal table, whose levels can be evaluated using AT statements. The AT- ENDAT control structures must be aligned one after the other, in accordance with the group structure.
The statement blocks within the AT- ENDAT control structures are listed if an appropriate control break is made in the current table line. Statements in the LOOP- ENDLOOP control structure that are not executed within an AT- ENDAT control structure are executed in each pass of the loop.
In order that control level processing is carried out properly, the following rules must be observed:
After LOOP, a restricting condition cond can only be specified if this selects a consecutive line block of the internal table. Otherwise, the behavior of control level processing is undefined.
The internal table cannot be modified within the LOOP loop.
A work area wa specified in the LOOP statement after the addition INTO must be compatible with the line type of the table.
The content of a work area wa specified after the addition INTO in the LOOP statement must not be modified.
If the INTO addition is used in the LOOP statement to assign the content of the current line to a work area wa, its content is changed upon entry into the AT-ENDAT control structure as follows:
The components of the current control key remain unchanged.
All components with a character-type, flat data type to the right of the current control key are set to character "*" in every position.
All the other components to the right of the current control key are set to their initial value.
When the AT-ENDAT control structure is exited, the content of the current table line is assigned to the entire work area wa.
Addition 1
... FIRST
Effect
The control level is defined by the first line of the internal table. The control break takes place when this line is read.
Note
In the group level AT FIRST, the current group key contains no components and all character-type components of the work area wa are filled with "*" and all remaining components are set to their initial value.
Addition 2
... |{END OF} compi/>
Effect
: Control levels are defined by the beginning or end of a group of lines with the same content in the component compi (where i = 1, 2, and so on) and in the components to the left of compi. The control breaks take place when the content of the component compi or another component to the left of compi changes.
The compi components can be specified as described in Specification of Components, with the limitation that access to object attributes is not possible here.
Note
If the INTO or ASSIGNING additions are used in the LOOP statement, a field symbol can be entered after AT |{END OF} outside classes, to which the corresponding component of the work area wa or the field symbol <fs> is assigned. This form of dynamic component specification is obsolete and has been replaced by specification in the format (name).
Addition 3
... LAST
Effect
: The control level is defined by the last line of the internal table. The control break takes place when this line is read.
Note
In the group level AT LAST, the current group key contains no components and all character-type components of the work area wa are filled with "*" and all remaining components are set to their initial value.
Regards,
Prashant

Similar Messages

  • What is the use of additon in up to 1 rows in SELECT statement

    Hi All,
             What is the use of up to 1 rows in select statement.
    for example
    SELECT kostl
          FROM pa0001
          INTO y_lv_kostl UP TO 1 ROWS
          WHERE pernr EQ pernr
          AND endda GE sy-datum.
        ENDSELECT.
    I'm unable to get in wat situations we hav to add up to 1 rows
    please help me out...
    Thanks,
    santosh.

    Hi,
    Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.
    The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
    The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.
    Regards,
    Bhaskar

  • What is the use of creating a new calendar group in iCal?

    Hi All!
    Still new to this. What is the use of creating a new calendar group in iCal? Enlighten me please.
    Cheers,
    John

    john from marayong wrote:
     What is the use of creating a new calendar group in iCal? Enlighten me please.
    You may create own calendars for special purposes as e.g. Sport's, secret events, hobby's and so on.
    As iCal allows to share calendars, you want eventually not share family events to others or if you manage a circle you may only share the "Homebrew" calendar with them.
    Lupunus

  • What is the use of for all entries in select statement

    what is the use of for all entries in select statement

    hi,
    FOR ALL ENTRIES is an effective way of doing away with using JOIN on two tables.
    You can check the below code -
    SELECT BUKRS BELNR GJAHR AUGDT
    FROM BSEG
    INTO TABLE I_BSEG
    WHERE BUKRS = ....
    SELECT BUKRS BELNR BLART BLDAT
    FROM BKPF
    INTO TABLE I_BKPF
    FOR ALL ENTRIES IN I_BSEG
    WHERE BUKRS = I_BSEG-BUKRS
    AND BELNR = I_BSEG-BELNR
    AND BLDAT IN SO_BLDAT.
    *******************************8
    look another example
    what is the use of FOR ALL ENTRIES
    1. INNER JOIN
    DBTAB1 <----
    > DBTAB2
    It is used to JOIN two DATABASE tables
    having some COMMON fields.
    2. Whereas
    For All Entries,
    DBTAB1 <----
    > ITAB1
    is not at all related to two DATABASE tables.
    It is related to INTERNAL table.
    3. If we want to fetch data
    from some DBTABLE1
    but we want to fetch
    for only some records
    which are contained in some internal table,
    then we use for alll entries.
    1. simple example of for all entries.
    2. NOTE THAT
    In for all entries,
    it is NOT necessary to use TWO DBTABLES.
    (as against JOIN)
    3. use this program (just copy paste)
    it will fetch data
    from T001
    FOR ONLY TWO COMPANIES (as mentioned in itab)
    4
    REPORT abc.
    DATA : BEGIN OF itab OCCURS 0,
    bukrs LIKE t001-bukrs,
    END OF itab.
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    itab-bukrs = '1000'.
    APPEND itab.
    itab-bukrs = '1100'.
    APPEND itab.
    SELECT * FROM t001
    INTO TABLE t001
    FOR ALL ENTRIES IN itab
    WHERE bukrs = itab-bukrs.
    LOOP AT t001.
    WRITE :/ t001-bukrs.
    ENDLOOP.
    Hope this helps!
    Regards,
    Anver
    <i>if hlped pls mark points</i>

  • What are the uses of portal

    Hi,
    Iam new to Enterprise portal.
    Can anybody tel me what are the uses of portal
    correct me if iam wrong " EP can be used from anywhere where the internet conncetion is available and anybody who is authorised to view the content"
    Thanks in advance
    SAI

    Hi,
    Your statement is correct. To be crisp, the portal offers a single point of access to SAP and non-SAP information sources, enterprise applications, information repositories, databases and services in and outside your organization—all integrated into a single user experience. It provides you the tools to manage this knowledge, to analyze and interrelate it, and to share and collaborate on the basis of it.
    With its role-based content, and personalization features, the portal enables users—from employees and customers to partners and suppliers—to focus exclusively on data relevant to daily decision-making processes
    To read more visit,
    http://help.sap.com/saphelp_nw04/helpdata/en/a9/76bd3b57743b09e10000000a11402f/frameset.htm
    Regards
    Srinivasan T

  • Use of AT NEW  statement

    Hi,
      In my program have written the code as
        SORT gt_bsik BY lifnr belnr  gjahr buzei.
        DATA : gv_count TYPE i VALUE 0.
        IF sy-subrc = 0.
          LOOP AT gt_bsik.
        AT NEW lifnr .
              READ TABLE gt_lfb1 WITH KEY lifnr = gt_bsik-lifnr BINARY
              SEARCH.
              CLEAR lt_vendors.
              lt_vendors-lifnr = gt_lfb1-lifnr.
            ENDAT.
            AT NEW belnr.
              gv_new_invoice_ind = 'X'.
              gt_bsik_copy-lifnr = gt_bsik-lifnr.
              gt_bsik_copy-belnr = gt_bsik-belnr.
           gt_bsik_copy-gjahr = gt_bsik-gjahr.
              gt_bsik_copy-buzei = gt_bsik-buzei.
              gv_count = gv_count + gt_bsik-buzei .
            ENDAT.
    the value of gt_bsik-buzei is coming as *** after passing tho AT NEW belnr stmt.Before that the value is correct only after passing tho it showing wrong value but the other fields are showing  correct value .Whats the reason for this?

    HI,
    Between AT NEW and endat statements you would have the field contents as **** after the field for which you have used in AT NEW statement. For example if you have used the 3rd field in AT NEW statement then between AT NEW and ENDAT statements you can access the first 3 fields contents only.If you want  to access any field after 3rd field then you have  to take  a Back Up of those fields before you enter in to AT statement. In your case declare a WA_BSIK of type GT_BSIK.
    Data : wa_bsik LIKE gt_bsik.
    Before you enter in to AT NEW statement transfer contents of gt_bsik to wa_bsik.
    WA_BSIK = GT_BSIK.
    Between AT NEW and  ENDAT use the field contents of wa_bsik and not gt_bsik.
    AT NEW belnr.
    gv_new_invoice_ind = 'X'.
    wa_bsik_copy-lifnr = wa_bsik-lifnr.
    wa_bsik_copy-belnr = wa_bsik-belnr.
    wa_bsik_copy-gjahr = wa_bsik-gjahr.
    wa_bsik_copy-buzei = wa_bsik-buzei.
    gv_count = gv_count + wa_bsik-buzei .
    ENDAT.

  • What is the use of control breaks in reoprts?how can we use them in report?

    hello all
    what is the use of control breaks in reoprts? and how can we use them in reports?

    hi,
    check this sample program using control break statements.
    *& Report  Y777_CBSTABLE
    REPORT  Y777_CBSTABLE1.
    TYPES:
    BEGIN OF S_MARKS,
         ROLLNO    TYPE I,
         SCODE(3)  TYPE C,
        ROLLNO    TYPE I,
         SNAME(10) TYPE C,
         MARKS     TYPE I,
    END OF S_MARKS.
    DATA : C TYPE I,
           D(3) TYPE C,
           TOT TYPE I,
           STU TYPE I,
           MARKS TYPE STANDARD TABLE OF S_MARKS,
           WA_MARKS TYPE S_MARKS.
    WA_MARKS-ROLLNO = 1.
    WA_MARKS-SCODE  = 'MAT'.
    WA_MARKS-SNAME  = 'MATHS'.
    WA_MARKS-MARKS  = 65.
    APPEND WA_MARKS TO MARKS.
    CLEAR WA_MARKS.
    WA_MARKS-ROLLNO = 1.
    WA_MARKS-SCODE  = 'SCI'.
    WA_MARKS-SNAME  = 'SCIENCE'.
    WA_MARKS-MARKS  = 85.
    APPEND WA_MARKS TO MARKS.
    CLEAR WA_MARKS.
    WA_MARKS-ROLLNO = 1.
    WA_MARKS-SCODE  = 'COM'.
    WA_MARKS-SNAME  = 'COMPUTER'.
    WA_MARKS-MARKS  = 90.
    APPEND WA_MARKS TO MARKS.
    CLEAR WA_MARKS.
    WA_MARKS-ROLLNO = 2.
    WA_MARKS-SCODE  = 'MAT'.
    WA_MARKS-SNAME  = 'MATHS'.
    WA_MARKS-MARKS  = 55.
    APPEND WA_MARKS TO MARKS.
    CLEAR WA_MARKS.
    WA_MARKS-ROLLNO = 2.
    WA_MARKS-SCODE  = 'SCI'.
    WA_MARKS-SNAME  = 'SCIENCE'.
    WA_MARKS-MARKS  = 75.
    APPEND WA_MARKS TO MARKS.
    CLEAR WA_MARKS.
    WA_MARKS-ROLLNO = 2.
    WA_MARKS-SCODE  = 'COM'.
    WA_MARKS-SNAME  = 'COMPUTER'.
    WA_MARKS-MARKS  = 80.
    APPEND WA_MARKS TO MARKS.
    CLEAR WA_MARKS.
    RETRIVAL ************************************
    SORT MARKS BY SCODE .
    LOOP AT MARKS INTO WA_MARKS.
        AT FIRST .
           ULINE.
           FORMAT COLOR 6 ON.
           WRITE:/ 'SUBJECT CODE', 65 ' ' .
           FORMAT RESET.
           FORMAT COLOR 6 ON INTENSIFIED OFF.
           WRITE:/20 'ROLL NO',
                  40 'SUBJECT NAME',
                  55 'MARKS',
                  65 ' '.
           FORMAT RESET.
           ULINE.
        ENDAT.
        ON CHANGE OF WA_MARKS-SCODE.
           IF SY-TABIX NE 1.
               NEW-LINE.
               ULINE 40(25).
               FORMAT COLOR 5 ON INVERSE ON INTENSIFIED ON.
               TOT = TOT / STU.
               WRITE:/40 'AVERAGE MARKS =', TOT.
               FORMAT RESET.
               CLEAR TOT.
               CLEAR STU.
           ENDIF.
          FORMAT COLOR 6 ON INTENSIFIED ON.
          WRITE:/ WA_MARKS-SCODE.
          FORMAT RESET.
        ENDON.
        FORMAT COLOR 6 ON INTENSIFIED OFF.
        WRITE:/20 WA_MARKS-ROLLNO,
               40 WA_MARKS-SNAME,
               55 WA_MARKS-MARKS,
               65 ' '.
        FORMAT RESET.
        STU = STU + 1.
        TOT = TOT + WA_MARKS-MARKS.
        C = STU.
        AT LAST.
               NEW-LINE.
               ULINE 40(25).
               FORMAT COLOR 5 ON INVERSE ON INTENSIFIED ON.
               TOT = TOT / STU.
               WRITE:/40 'AVERAGE MARKS =', TOT.
               FORMAT RESET.
               CLEAR TOT.
               CLEAR STU.
             ULINE.
             FORMAT COLOR 6 ON INVERSE ON INTENSIFIED ON.
             WRITE:/ ' TOTAL STUDENTS : ', C.
             FORMAT RESET.
        ENDAT.
    ENDLOOP.
    reward points if hlpful.

  • What is the use of Alternative Calculation Type =2 and 4

    Dear Friends
    In pricing procedure in gross value, Net value for Item and Net value has Alternative calucation type is 2.
    What is the use of it?
    Without using it these value line are also fetching net value then what is the work of it. Please give me detail information with its effects in pricing condition tab page in sales document.
    Thanking You
    Arun

    Arun biswal,
    Correct Biswal. We have at varoius stages within Pricing procedure the "net value" which is calculated. Not only the alternative calculation type "2" is used if you notice carefully they are stored as subtotals at various levels.
    For Ex Gross Value  --> Subtotal =1 --> Calc type = 2
    similarly for Net value for Item --> Subtotal =2 --> Calc type = 2
    Net value 2 --> Subtotal =3 --> Calc type = 2
    See, these are used to calculate the net value at various levels in pricing. The calculation Type has got a set of routines that will facilitate us in pricing. SAP has provided certain clauclated formulas or routines to facilitate us during calculation within pricing . Here the "2" is used for calculation without tax and store it as subtotal and display it or use it for further calculations.
    We can use this "netvalue" amount for further calculations. It is used for clarity purpose when you issue a statement to customer. (like Confirmation order) at various levels like discount amt involved, Freight involved, Rebate amount invloved.....
    Even without this Calc type or using sub total u can proceed....
    Finally we have  TOTAL  --> Subtotal =A --> Calc type = 4
    In the above line we have Calc type as 4, which means when you use TAX this calc type is used .
    Routines are used to facilitate your process....
    Regards
    Sathya

  • What is the use of HTTPS 8181 port

    Hi,
    I am wondering what is the use of the port 8181 on the EE5 application server.
    the second question. Why the application server open so many port on the same local machine. I agree that for security raison it is a good idea. But does application serveur use tcp connection to communicate between the server thread ?
    So it is possible to add a thread in the serveur application to process some internal work. And of course it is possible to include this new thread in the communication process of the server ?
    Can we have the map of all the tcp trhead use by the server application.
    Regards
    Herve Terrolle.

    Your app has to run as root to listen on ports up to 1024,
    also, some other app (apache?) may already be listening on port 443.
    AFAICT port 8181 is just arbitrarily chosen, it might as well have been port 4430, or any other free port above 1024.

  • What is the use of commit work and rollback work

    hao friends,
    what is the use of commitwork and rollback work where we can use these open sql statements .
    thanks,
    anji

    hi all
    i have written the following code in my development system to change the records of my database.
    SELECT * FROM zyikostl INTO TABLE itab.
      LOOP AT itab INTO wtab.
        tabix = sy-tabix.
        DO.
          READ TABLE itab INTO ktab WITH KEY kostl_alt = wtab-kostl_neu.
          IF sy-subrc = 0.
            wtab-kostl_neu = ktab-kostl_neu.
            MODIFY itab FROM wtab INDEX tabix.
            CONTINUE.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
      ENDLOOP.
    MODIFY zyikostl FROM TABLE itab.
    In the development system i have only few records its working fine,but when it is been moved to test system there are 2500 records in the database so the report is taking much time(more than 5 hours )
    i sthere any solution for this ....
    thanks,
    vaasu.

  • What is the use of access level

    Hi Experts,
    What is the access level and what is use of each option in access level
    1  Application
    2  Superior component
    3. Top Component
    4. Sap
    5. Global
    and in Details section what is the use Properties tab
    1. Application Component
    2. Software Component
    3. Development Package
    4. Settings Class
    Please explain Each option use.
    Thank you in advance,
    Srini M.

    Hi Srini,
    just read the documentation (although the current status on SAP Help Portal isn't really up-to-date):
    1. [Entry point|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cc/85414842c8470bb19b53038c4b5259/frameset.htm]
    2. [Setting an Access Level|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/32/6aba9c49fd41a5a14f710e121220f1/content.htm]
    W/r to "Application Component" etc., docu on Help Portal is definitely not sufficient. Here, the following applies:
    An application offers attributes for the application component and the software component. The application component and software component have to be the same as defined for the development package. Application and software component are automatically derived from the development package if they are not set explicitly.
    For the definition of the development package, application component, and software component, we recommend that you choose the same values that are in effect for the software solution that you want to enhance by a new BRFplus application. This simplifies all activities related to the software infrastructure, especially transports.
    CU
    Claus

  • Why do we use open URL in default browser function? What are the uses of it?

    Why do we use "open URL in default browser" function?  What are the uses of it?

    kdm7 wrote:
    Okay.
    So can we keep a web button to access the www.ni.com ? So that web site opens only when button pressed?
    P.S  I,m a newbie.
    Yes, you can also, e.g. include a help file or manual as html and open that in the browser.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • What are the uses of diffrent concepts in data warehousing

    What are the uses of diffrent concepts in data warehousing? Why?
    naveen

    Hi,
    Your statement is correct. To be crisp, the portal offers a single point of access to SAP and non-SAP information sources, enterprise applications, information repositories, databases and services in and outside your organization—all integrated into a single user experience. It provides you the tools to manage this knowledge, to analyze and interrelate it, and to share and collaborate on the basis of it.
    With its role-based content, and personalization features, the portal enables users—from employees and customers to partners and suppliers—to focus exclusively on data relevant to daily decision-making processes
    To read more visit,
    http://help.sap.com/saphelp_nw04/helpdata/en/a9/76bd3b57743b09e10000000a11402f/frameset.htm
    Regards
    Srinivasan T

  • What is the use of initial value in a database table?

    Hi can anyone help me in knowing what is the use of initial value which is present besides primary key while creating a table?

    Initial Value:
    Indicator that NOT NULL is forced for this field
    Use
    Select this flag if a field to be inserted in the database is to be filled with initial values. The initial value used depends on the data type of the field.
    Please note that fields in the database for which the this flag is not set can also be filled with initial values.
    When you create a table, all fields of the table can be defined as NOT NULL and filled with an initial value. The same applies when converting the table. Only when new fields are added or inserted, are these filled with initial values. An exception is key fields. These are always filled automatically with initial values.
    Restrictions and notes:
    The initial value cannot be set for fields of data types LCHR, LRAW, and RAW. If the field length is greater than 32, the initial flag cannot be set for fields of data type NUMC.
    If a new field is inserted in the table and the initial flag is set, the complete table is scanned on activation and an UPDATE is made to the new field. This can be very time-consuming.
    If the initial flag is set for an included structure, this means that the attributes from the structure are transferred. That is, exactly those fields which are marked as initial in the definition have this attribute in the table as well.
    hope it helps,
    Saipriya

  • What is the use of Storage loc.ref.in LE-WM Interface to Inventory Managemt

    Hi Guys
    What is the use of below fields
    Special movement indicator for warehouse management and Storage loc. ref.
    In the WM configaration LE-WM Interface to Inventory Management
    How we can do the below scenario with this configaration
    I have 3 scenarios all scenarios have MIGO and placing stock to WM
    2 scenarios requres Immediate TO creation after MIGO 101 mvt type
    But last scenario does not want Immediate TO ,it is having another Z transaction to create TO
    But problem is for the last scenario also creating Immdiate TO after MIGI 101
    How to avoid this Immdiate TO for this scenario
    And How to allow it for first 2 scenarios
    How we can to with that configaration

    Hello ,
    It is not possible directly in customising as all three cases are using the same Mvt Type.
    Alternate Solution :
    You may try an by creating a new Mvt Type 901 i.e making a copy of 101.
    Thereafter try to link a new Ref Mvt Type to the same .You should use this case for the third scenario.
    This may resolve your problem.
    Regards
    Ramesh Ch

Maybe you are looking for

  • Convert short[] to float[]

    Hi, I'm trying to convert a short[] to a float[]. The following code works fine, but when I try to convert between arrays I get "cannot resolve symbol" error. Can anyone tell me the cause of this error? Thanks. short s=2; float f; f = new Float(s).fl

  • Error while creating datasource from view ZBSIS_VIEW

    Hi all, I could not create  the datasource on the database table BSIS as it said "Invalid extract structure template BSIS of Datasource". I had suggestions that I should create a view and then create the Datasource on it. So I created the view and tr

  • I have a LaCie external hard drive. I cannot locate all of my pictures once I download them from my Macbook Pro. How do I find them on the LaCie ar25u3?

    I have over 5,000 pictures that I put on my LaCie external HD. When I open the LaCie I can only find some of my images. Where exactly would I find them on my hard drive?

  • Lightbox Gallery widget 1.0

    Does anyone know if there is a variable to make the gallery move from the last image and wrap around to the first image instead of ending the gallery? or modifying the java script? Roz http://www.bigbroncocc.com/products.html

  • Volume discount for whole month

    Hello sir's I am having one querry, i maintain the time dependent condition Volume discount (zvls), For EX: I want to calculate the zvls for aspecific period, suppose i created 10 nos of purchase order, post a GR and also settled the payment for that