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

abap

1.What is the diff between AtNew and OnChange?

2.What is the script events

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 08:29 AM

    on change of works same like at-new but the diff is it can

    be used out side of a loop,like select and endselect,case

    endcase.

    we can use onchange of out side the loop

    and on at new the left side feild change the event

    trigers and the values become 0 and *

    The Major difference between the two is that AT NEW can be

    used ONLY for INTERNAL TABLES, while on change of can be

    used for any loop processing i.e do..enddo, while..endwhile

    and loop..endloop also.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 08:35 AM

    on change of declares a variable called global auxillary varaible it will be set to 0 for the first time in loop it will not show any effect.

    it triggers when contrl level changes

    u cant use it outside loop as global auxillary varaible is not valid outside loop

    at new triggers when control level changes

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 08:42 AM

    hi

    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.

    . ... |{END OF} comp 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. Within these statement blocks, the statement SUM can be specified to total numeric components of a group level. In the case of output behavior result, the same applies as for LOOP AT. So that group level processing can be executed correctly, the following rules should be noted: After LOOP there should be no limiting condition cond specified. The internal table must not be modified within the LOOP loop. The work area wa specified in the LOOP statement after the INTO addition must be compatible with the line type of the table. The content of a work area wa specified in the LOOP statement after the INTO addition must not be modified. 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 each time the loop is run through. 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 group key will remain unchanged. All components with a character-type, flat data type to the right of the current group key are set to character "*" at that position. All the other components to the right of the current group 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. If the INTO addition is used in the LOOP statement, a field symbol can be specified outside of the classes after AT |{END OF}. The appropriate component of the work area wa is assigned to this field symbol.

    ... |{END OF} comp

    Beginning or end of a group of lines with the same content in the component comp1 comp2 ... and in the components to the left of comp1 comp2 .... The components comp1 comp2 ... can be specified, as described in the section Specification of Components, with the limitation that access to object attributes is not possible here.

    ON CHANGE OF has become obsolete in latest sap versions.

    Better use AT NEW statement

    It will do the same function.

    see the doc

    All this AT NEW, AT FIRST, AT END OF and AT LAST are called control break statements of Internal tables and are used to calculate the TOTALS based on sertain key fields in that internal table

    FIrst to use these statements the ITAB has to be sorted by the key fields on whcih you need the SUM of the fields.

    Some time you will get * when mopving data from this int table to other table using these commands

    so you have to use

    READ TABLE ITAB INDEX SY-TABIX in AT..ENDAT..if you are using other fields between them

    DATA: sflight_tab TYPE SORTED TABLE OF sflight

    WITH UNIQUE KEY carrid connid fldate,

    sflight_wa LIKE LINE OF sflight_tab.

    SELECT *

    FROM sflight

    INTO TABLE sflight_tab.

    sort sflight by carrid connid.

    LOOP AT sflight_tab INTO sflight_wa.

    AT NEW connid.

    WRITE: / sflight_wa-carrid,

    sflight_wa-connid.

    ULINE.

    ENDAT.

    WRITE: / sflight_wa-fldate,

    sflight_wa-seatsocc.

    AT END OF connid.

    SUM.

    ULINE.

    WRITE: / 'Sum',

    sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

    SKIP.

    ENDAT.

    AT END OF carrid.

    SUM.

    ULINE.

    WRITE: / 'Carrier Sum',

    sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

    NEW-PAGE.

    ENDAT.

    AT LAST.

    SUM.

    WRITE: / 'Overall Sum',

    sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

    ENDAT.

    ENDLOOP.

    Use the CALL TRANSACTION USING statement

    Summary: With CALL TRANSACTION USING, the system processes the data more quickly than with batch input sessions. Unlike batch input sessions, CALL TRANSACTION USING does not automatically support interactive correction or logging functions.

    Your program prepares the data and then calls the corresponding transaction that is then processed immediately.

    The most important features of CALL TRANSACTION USING are:

    Synchronous processing

    Transfer of data from an individual transaction each time the statement CALL TRANSACTION USING is called

    You can update the database both synchronously and asynchronously

    The program specifies the update type

    Separate LUW (logical units of work) for the transaction

    The system executes a database commit immediately before and after the CALL TRANSACTION USING statement

    No batch input processing log

    Create a session on the batch input queue.

    Summary: Offers management of sessions, support for playing back and correcting sessions that contain errors, and detailed logging.

    Your program prepares the data and stores it in a batch input session. A session is a collection of transaction data for one or more transactions. Batch input sessions are maintained by the system in the batch input queue. You can process batch input sessions in the background processing system.

    Your program must open a session in the queue before transferring data to it, and must close it again afterwards. All of these operations are performed by making function module calls from the ABAP program.

    The most important aspects of the session interface are:

    Asynchronous processing

    Transfers data for multiple transactions

    Synchronous database update

    During processing, no transaction is started until the previous transaction has been written to the database.

    A batch input processing log is generated for each session

    Sessions cannot be generated in parallel

    The batch input program must not open a session until it has closed the preceding session.

    Hope this is helpful, DO reward.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 08:45 AM

    hI IGNORE THAT call transaction and session ONE SORRY

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.