CONTROL BRK EVENTS

what is the AT EVENT in CONTROL BRK EVENTS

Hi,
Check this out -
AT - Control breaks with internal tables
Variants:
AT NEW f.
AT END OF f.
AT FIRST.
AT LAST.
Effect
In a LOOP which processes an internal table, you can use special control structures for control break processing. All these structures begin with AT and end with ENDAT. The sequence of statements which lies between them is then executed if a control break occurs.
You can use these key words for control break processing with internal tables only if a loop is actively processing an internal table and reference is to the innermost currently active loop.
The control level structure with internal tables is static. It corresponds exactly to the sequence of columns in the internal table (from left to right). In this context, the criteria according to which you sort the internal table are unimportant.
At the start of a new control level (i.e. immediately after AT), the following occurs in the output area of the current LOOP statement:
All character type fields (on the right) are filled with "*" after the current control level key.
All other fields (on the right) are set to their initial values after the current control level key.
Between AT and ENDAT, you can use SUM to insert the appropriate control totals in the numeric fields (see also ABAP Number Types) of the LOOP output area (on the right) after the current control level key. Summing is supported both at the beginning of a control level ( AT FIRST, AT NEW f) and also the end of a control level ( AT END OF f, AT LAST).
At the end of the control level processing (i.e. after ENDAT), the old contents of the LOOP output area are restored.
Notes
   1. When calculating totals, you must ensure that the totals are inserted into the same sub-fields of the LOOP output area as those where the single values otherwise occur. If there is an overflow, processing terminates with a runtime error.
   2. If an internal table is processed only in a restricted form (using the additions FROM, TO and/or WHERE with the LOOP statement), you should not use the control structures for control level processing because the interaction of a restricted LOOP with the AT statement is currenly not properly defined.
   3. With LOOPs on extracts, there are also special control break control structures you can use.
Note
Non-Catchable Exceptions:
SUM_OVERFLOW: Overflow when calculating totals with SUM.
Variant 1
AT NEW f.
Variant 2
AT END OF f.
Compatible Work Area with Control Level Processing and Field Symbols Not Allowed as Control Level Criterion.
Effect
f is a sub-field of an internal table processed with LOOP. The sequence of statements which follow it is executed if the sub-field f or a sub-field in the current LOOP line defined (on the left) before f has a different value than in the preceding ( AT NEW) or subsequent (AT END OF) table line.
Example
TYPES: BEGIN OF COMPANIES_TYPE,
        NAME(30),
        PRODUCT(20),
        SALES TYPE I,
      END   OF COMPANIES_TYPE.
DATA: COMPANIES TYPE STANDARD TABLE OF COMPANIES_TYPE WITH
                     NON-UNIQUE DEFAULT KEY INITIAL SIZE 20,
      WA_COMPANIES TYPE COMPANIES_TYPE.
LOOP AT COMPANIES INTO WA_COMPANIES.
  AT NEW NAME.
    NEW-PAGE.
    WRITE / WA_COMPANIES-NAME.
  ENDAT.
  WRITE: / WA_COMPANIES-PRODUCT, WA_COMPANIES-SALES.
  AT END OF NAME.
    SUM.
    WRITE: / WA_COMPANIES-NAME, WA_COMPANIES-SALES.
  ENDAT.
ENDLOOP.
The AT statements refer to the field COMPANIES-NAME.
Notes
   1. If a control break criterion is not known until runtime, you can use AT NEW (name) or AT END OF (name) to specify it dynamically as the contents of the field name. If name is blank at runtime, the control break criterion is ignored and the sequence of statements is not executed. If name contains an invalid component name, a runtime error occurs.
   2. By defining an offset and/or length, you can further restrict control break criteria - regardless of whether they are specified statically or dynamically.
   3. A field symbol pointing to the LOOP output area can also be used as a dynamic control break criterion. If the field symbol does not point to the LOOP output area, a runtime error occurs.
If you use AT within a LOOP with an explicitly-specified output area, the area must be compatible with the line type of the internal table so that it can be initialized properly (as described above) at the start of a new control level.
You can restrict control break criteria further, regardless of whether they were defined statically or dynamically, by specifying offset and/or length.
Note
Non-Catchable Exceptions:
AT_BAD_PARTIAL_FIELD_ACCESS: Invalid sub-field access when dynamically specifying the control break criterion.
AT_ITAB_FIELD_INVALID: When dynamically specifying the control break criterion via a field symbol, the field symbol does not point to the LOOP output area.
ITAB_ILLEGAL_COMPONENT: When dynamically specifying the control break criterion via (name) the field (name) does not contain a valid sub-field name.
Variant 3
AT FIRST.
Variant 4
AT LAST.
Effect
Executes the appropriate sequence of statements once during the first ( AT FIRST) or last (AT LAST) loop pass.
Example
TYPES: BEGIN OF COMPANIES_TYPE,
        NAME(30),
        PRODUCT(20),
        SALES TYPE I,
      END   OF COMPANIES_TYPE.
DATA: COMPANIES TYPE STANDARD TABLE OF COMPANIES_TYPE WITH
                     NON-UNIQUE DEFAULT KEY INITIAL SIZE 20,
      WA_COMPANIES TYPE COMPANIES_TYPE.
LOOP AT COMPANIES INTO WA_COMPANIES.
  AT FIRST.
    SUM.
    WRITE:    'Sum of all SALES:',
           55 WA_COMPANIES-SALES.
  ENDAT.
  WRITE: / WA_COMPANIES-NAME, WA_COMPANIES-PRODUCT,
        55 WA_COMPANIES-SALES.
ENDLOOP.
ashish

Similar Messages

  • In alv report can i use control break events? if no .whay?

    Hi all,
    in alv report can i use control break events? if no .whay?

    hi,
    you can use control break statements in ALV report.
    for example: if one PO is having more than one line item, that time you need to display PO only once.

  • Smartforms, how to use control break events

    Please help with this requirement.
    Purchase Docu No.111
    Pur Item No       Mat no       Quantity 
    1                        2356      2000
    2                     1256      2000
    3                     8556      2000
    Purchase Docu No.112
    Pur Item No    Mat no    Quantity 
    1                      9656      2000
    2                      7356      2000
    3                      1356      2000
    Purchase Docu No.113
    Pur Item No    Mat no    Quantity 
    1                      5356      2000
    2                      8356      2000
    This i have to design for the smartform.
    1 header data then its item data.
    like is Script i can call the WIndow elements using control break events in the driver prog but how to get this kind of output in Smartforms.???????
    Thanks

    I dont want trigger new page.
    In the same page i want like this
    I have purchase docu data in only 1 internal table.
    So, for every new VBELN, under this i want its corresponding item details.
    I have created the command node for the main window with 2 rows, in the 1st row i am giving VBELN and in the 2nd row i am giving in item details like item no, matnr etc etc and in the condition its askng Field name and Comparison Value.
    How shold i give condition.??????
    Thanks
    Edited by: Jalaaluddin Syed on May 1, 2008 5:03 PM

  • A JAVA PROGRAM TO CONTROL SYSTEM EVENTS OF WIDOWS XP

    Hello everyone.
    The question is: can I develop a java program that can control system events of a windows environment? For example a program to shut down the computer, log off or open and close windows applications?
    If so, how can i do that??
    please help me. Your help is appreciated in advance.
    thanks.
    Wakariuki

    Hi,
    If you want to make native calls, you can use JNI (Java Native Interface).
    Using JNI, you call call any C/C++ funtions.
    Please visit, http://java.sun.com/docs/books/jni/ for JNI structure. To program using JNI, read the book given in the link. It is very useful for beginners.

  • A JAVA PROGRAM TO CONTROL SYSTEM EVENTS OF WIDOWS environment

    Hello everyone.
    The question is: can I develop a java program that can control system events of a windows environment? For example a program to shut down the computer, log off or open and close windows applications?
    If so, how can i do that??
    please help me. Your help is appreciated in advance.
    thanks.
    Wakariuki

    Hi,
    If you want to make native calls, you can use JNI (Java Native Interface).
    Using JNI, you call call any C/C++ funtions.
    Please visit, http://java.sun.com/docs/books/jni/ for JNI structure. To program using JNI, read the book given in the link. It is very useful for beginners.

  • Help for Control Level Events

    Dear Friends
    i had an internal Table Itab_emp
    before saving from belowcode i want to check for a particular field
    i had itab_otime which had value as time format for particular ids
    so i want to add them for a id and check condition
    output of itab_emp is
    PERID Date OTIME 
    1      01.10.2007 013000
    1      03.10.2007 001000
    2      04.10.2007 000030
    2      05.10.2007 001000
    i want to add values for perid 1 and 2 and see the sum of that in a field in itab only so that i can apply condition
    Hope u got my problem
    Reflect changes in below code
    i think control level events will help but How i dont know
    SORT ITAB_EMP BY PERID.
      LOOP AT ITAB_EMP WHERE MARK = 'X' .
        IF SY-SUBRC = 0.
    MOVE-CORRESPONDING ITAB_EMP TO ITAB_OTAPP .
          ITAB_OTAPP-OBJID = 1.
          ITAB_OTAPP-TODTE = ZHR_PR_M_OTAPP-TODTE.
          ITAB_OTAPP-FRDTE = ZHR_PR_M_OTAPP-FRDTE.
          ITAB_OTAPP-IMMHD = ZHR_PR_M_OTAPP-IMMHD.
          ITAB_OTAPP-CRETM = SY-UZEIT.
          ITAB_OTAPP-CREON = SY-DATUM.
          ITAB_OTAPP-CREBY = SY-UNAME.
          APPEND ITAB_OTAPP.
        ENDIF.
      ENDLOOP.
      LOOP AT ITAB_OTAPP INTO WA_ITAB_OTAPP.
        MODIFY ZHR_PR_M_OTAPP FROM WA_ITAB_OTAPP.
      ENDLOOP.
    Hope will get answer as soon as possible
    Please Help Out Genius
    With Best Regards
    Ruby

    Dear Friends
    i had an internal Table Itab_emp
    before saving from belowcode i want to check for a particular field
    i had itab_otime which had value as time format for particular ids
    so i want to add them for a id and check condition
    output of itab_emp is
    PERID Date OTIME 
    1      01.10.2007 013000
    1      03.10.2007 001000
    2      04.10.2007 000030
    2      05.10.2007 001000
    i want to add values for perid 1 and 2 and see the sum of that in a field in itab only so that i can apply condition
    Hope u got my problem
    Reflect changes in below code
    i think control level events will help but How i dont know
    SORT ITAB_EMP BY PERID.
      LOOP AT ITAB_EMP WHERE MARK = 'X' .
        IF SY-SUBRC = 0.
    MOVE-CORRESPONDING ITAB_EMP TO ITAB_OTAPP .
          ITAB_OTAPP-OBJID = 1.
          ITAB_OTAPP-TODTE = ZHR_PR_M_OTAPP-TODTE.
          ITAB_OTAPP-FRDTE = ZHR_PR_M_OTAPP-FRDTE.
          ITAB_OTAPP-IMMHD = ZHR_PR_M_OTAPP-IMMHD.
          ITAB_OTAPP-CRETM = SY-UZEIT.
          ITAB_OTAPP-CREON = SY-DATUM.
          ITAB_OTAPP-CREBY = SY-UNAME.
          APPEND ITAB_OTAPP.
        ENDIF.
      ENDLOOP.
      LOOP AT ITAB_OTAPP INTO WA_ITAB_OTAPP.
        MODIFY ZHR_PR_M_OTAPP FROM WA_ITAB_OTAPP.
      ENDLOOP.
    Hope will get answer as soon as possible
    Please Help Out Genius
    With Best Regards
    Ruby

  • Bdc on vk11 using control break events

    hi
    have any one done bdc for vk11 using control break events.my flat file is
    ZTAX     X     IN     1000     1200     2000     A0
    ZTAX     X     IN     1000     1210     3000     A1
    ZTAX     X     US     7676     01     4000     L3
    ZTAX     X     US     7676     02     5000     s1
    i need the logic for this any sample code will be useful

    hi, check the sample code using Control break statements.
      LOOP AT IT_MAIN.
    WRITE : IT_MAIN.
    C_TABIX = SY-TABIX.
    <b>AT NEW LIFNR_001.</b>
    READ TABLE IT_MAIN INDEX C_TABIX.
    REFRESH IT_BDC.
    perform bdc_dynpro      using 'SAPMM06E' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RM06E-BSTNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'EKKO-LIFNR'
                                  IT_MAIN-LIFNR_001.
    perform bdc_field       using 'RM06E-BSART'
                                  IT_MAIN-BSART_002.
    perform bdc_field       using 'RM06E-BEDAT'
                                  IT_MAIN-BEDAT_003.
    perform bdc_field       using 'EKKO-EKORG'
                                  IT_MAIN-EKORG_004.
    perform bdc_field       using 'EKKO-EKGRP'
                                  IT_MAIN-EKGRP_005.
    perform bdc_field       using 'RM06E-LPEIN'
                                  IT_MAIN-LPEIN_006.
    perform bdc_field       using 'RM06E-WERKS'
                                  IT_MAIN-WERKS_007.
    MOVE 1 TO CNT.
    <b>ENDAT.</b>
    perform bdc_dynpro      using 'SAPMM06E' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EKPO-TXZ01(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    CONCATENATE 'EKPO-EMATN(' CNT ')' INTO FLD.
    perform bdc_field       using FLD IT_MAIN-EMATN_01_008.
    CONCATENATE 'EKPO-TXZ01(' CNT ')' INTO FLD.
    perform bdc_field       using FLD IT_MAIN-TXZ01_01_009.
    CONCATENATE 'EKPO-MENGE(' CNT ')' INTO FLD.
    perform bdc_field       using FLD IT_MAIN-MENGE_01_010.
    perform bdc_dynpro      using 'SAPMM06E' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RM06E-EBELP'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    CNT = CNT + 1.
           IF CNT = 6.
            CNT = 1.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                                  '=P+'.
           ENDIF.
    <b>AT END OF LIFNR_001.</b>
    READ TABLE IT_MAIN INDEX C_TABIX.
    RECORD = IT_MAIN.
    perform bdc_dynpro      using 'SAPLSPO1' '0100'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    CALL TRANSACTION 'ME21' USING IT_BDC MODE 'A' MESSAGES INTO IT_MESSAGES.
      clear: cnt, C_tabix .
    <b>ENDAT.</b>
    ENDLOOP.

  • Control which events are synced with iPad?

    I have iCloud set up on my Mac/iPad, and it is successfully syncing my calendar events.
    However, I don't want minor recurring events that I have on my Mac calendar to be popping up alarms and cluttering up the calendar on my iPad.
    How do I control which events are synced with the iPad?
    Thanks.

    Hi,
    You could either make a calendar under "On My Mac" to take the events you do not want synced to iCloud.
    Alternatively make a calendar under "iCloud" for them and uncheck it on the calendar list on your iPad.
    Best wishes
    John M

  • How to control the tab control using event structure?

    Hi,
    I am using tab control and event structure in the program.
    When i run the application event is not happening for the active page.
    When user switches from active page to the other page then event is taking place for all pages
    So, how to get the event trigger for the active page when the application is started
    For more clarification i am attaching the code "Test Control Tab using Event Structure.vi"
    Attachments:
    Test Control Tab using Event Structure.vi ‏52 KB

    You have a basic misunderstanding of dataflow. Maybe you should start with some tutorials or study some of the examples that ship with LabVIEW.
    The event structure belongs inside the while loop, and not vice versa. RIght now, the event structure only runs exactly once and never again.
    If the stop is pressed first, the VI will stop. Game over.
    If the tab control is changed (from any state to any other state!), the inner loop will spin forever as fast as the CPU allows, either executing one or the other case. It just reads the tab terminal to decide which case to execute. Changing tab never triggers any events. The VI is trapped inside the event until stop is pressed to stop the VI.
    you were closer to a reasonable program in the other thread:
    http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=287905
    Have you tried execution highlighting? Maybe things would become more clear of you do.
    LabVIEW Champion . Do more with less code and in less time .

  • Workflow error in fork step, process control, wait event

    I am using fork step in workflow which has 2 parallel branches. In 1st branch i have a user decision step followed by a task for posting PO document in case of approval. In the 2nd branch of fork step I have a wait step to wait for an event followed by the same task for posting document with a process control step after that in the end to cancel the workitem(workitem generated by user decision step in the 1st branch of fork). I created the event by using a custom BOR object.
    After the fork step is triggered, i have both a wait event running and workitem generated. When i raise the wait event from SWUE by entering the event, object key etc it works fine i.e., the workitem in the other branch is set of logically deleted and workflow ends.
    But if the wait event is triggered from the program i.e., using FM SWW_WI_CREATE_VIA_EVENT, both get an error message in workflow log(SWIA). The message is: Error when executing the binding between work item 000000XXXXXX and flow item 000000XXXXXX where workitem number is the workitem id of the posting document task and flow item id is the workflow parent id

    hi,
    message is self explanatory.
    Activate the event trace SWELS, then do the event with SWUE and within your program (als please use SAP_WAPI function modules).
    Now compare the 2 events in SWEL to see what the differences are .
    Kind regards, Rob Dielemans

  • UI5 Table control Cellclick event exception

    Hi,
    I have rendered "Table" control with the data. After populating the data when I clicked on Table Cell getting the below error in the Chrome browser console. (In the code I haven't hook CellClick event to the table control)
    Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: tabbable sap-ui-core.js:27
    i4.errorsap-ui-core.js:27
    i4.selectors.filter.PSEUDOsap-ui-core.js:27
    y4sap-ui-core.js:27
    i4.compilesap-ui-core.js:27
    B4sap-ui-core.js:27
    i4sap-ui-core.js:27
    $.findjquery-mobile-custom.js:15
    $.find.matchesSelectorjquery-mobile-custom.js:15
    Q.extend.filtersap-ui-core.js:27
    A1sap-ui-core.js:27
    Q.fn.extend.filtersap-ui-core.js:27
    sap.ui.table.Table._enterActionModeTable.js:107
    sap.ui.table.Table.onmouseupTable.js:70
    a._callEventHandlessap-ui-core.js:134
    a._handleEventsap-ui-core.js:134
    U._handleEventsap-ui-core.js:134
    psap-ui-core.js:16
    Q.event.dispatchsap-ui-core.js:27
    v3.handle
    When I tried to add the attachCellClick event to the table control getting the following error, and data also not populating.
    Uncaught TypeError: Object [object Object] has no method 'attachCellClick' First.view.js:66
    sap.ui.jsview.createContentFirst.view.js:66
    (anonymous function)JSView.js:6
    d.runWithPreprocessorssap-ui-core.js:134
    sap.ui.core.mvc.JSView.onControllerConnectedJSView.js:6
    sap.ui.core.mvc.View._initCompositeSupportView.js:6
    E.extend.constructorsap-ui-core.js:134
    M.extend.constructorsap-ui-core.js:134
    E.extend.constructorsap-ui-core.js:134
    fsap-ui-core.js:122
    fsap-ui-core.js:122
    osap-ui-core.js:116
    sap.ui.viewView.js:6
    o.(anonymous function)sap-ui-core.js:116
    (anonymous function)
    Can someone advice on this.
    Thanks,
    Rakesh

    Hi,
    There's no cellClick event in Table, because of which you are getting the error.
    Regards,
    Kiran

  • Find Control in Event Structure doesn't show the object when it is not in the frontmost Tab page [Bug Report, LabVIEW 2012]

    When you are looking for the control/indicator handled by a case in the Event structure, you can use the contextual menu item "Find Control" (doesn't distinguish between control and indicator, BTW).
    The result is that the control/indicator is highlighted on the FP. The problem is, if that control is in a Tab and specifically in a page of that Tab that happens to not be the frontmost, the only thing you'll see is marching ants, but no control:
    <=========== the wrong TAB page was shown. LV did not bother to switch to the relevant one....
    In other words, "Find Control" in the Event Structure doesn't switch the tab to the owning page. This is contrary to what happens if you right-click, say, the terminal of this control: the FP will switch to the owning Tab page.
    I'd call this a bug and this is definitely an annoyance (which most likely has been around since the creation of the Event Structure).

    I did not. Is there any better chance for it to be caught there by a NI eye than it is in the LV forum? I though these threads were deemed to gather bugs/features that had been already acknowledged by NI with a CAR number.
    I (and others!) wished there was something like this: http://bugs.sun.com/ or http://bugs.python.org/ for LabVIEW...
    I am just coming back from a short conference of scientists who quite uninamously ended up with the conclusion that LabVIEW was to be disregarded as a lab development environment because of maintenance problems (which could have been argued for any language in my opinion, although I think they meant spaghetti diagrams are the natural tendency of students who could not care less as they are not going graduate because of their LV skills or lack thereof), but I guess I could have added my grain of salt and added the complete opacity on bug and feature handling by NI.

  • Strange behavior of stop control with events

    I have found some strange behavior while using stop controls. I have a main vi which has two while loops. One of them is used to continuosly acquire the images. The other while loop has event structure that has several booleans which trigger different events. Both the while loops are operated using the same stop. My problem is this. None of the events get triggered when I press the buttons for them. However if I keep the stop value true( which stops the acquisition) and then click the event buttons all of them work fine. so every time I want an event to run I first change this stop value to true and then press the button for the event to fire. I want to know what is causing this? Why is th stop button influencing the behavior
    of other events?

    If your while loops are completely independent then it whould work. I've attached a simple example in LabVIEW 6.1 that shows a while loop with an event structure and another running continuously. A single stop button stops both but until then, the event structure will respond to clicking on two other Booleans in the VI.
    Attachments:
    Two_While_Loops.vi ‏24 KB

  • Worklist - Task Control Factory Event Handler Issue

    I am developing a worklist application, which requires to create Task (Approval Process) for each user in a group.I have created a Task Control Factory in a "For Each" loop which creates multiple Tasks and i can see them through the default "worklist GUI" provided also "complete" the tasks. The Issue is the "onTaskCompleted" event does not get captured. It just gets lost.
    FYI, I have followed the BEA guidelines (http://e-docs.bea.com/wli/docs81/worklist/advanced.html#1076366)for creating Task Control Factories.
    Any kind of help will be really appreciated

    I am only guessing here, but since your process is creating multiple tasks, the completion of any single task can't be captured by your process. Once you start creating multiple tasks your ability to monitor a single task probably gets lost.
    One possibility to fix this is for your process to have a parallel branch: one branch will call a sub process for each task that you need completed and one branch will receive the call backs from the sub process. In this way you will be able to have multiple tasks created simultaneously while still capturing the individual onTaskCompleted events.
    Hope this helps.

  • Programmatically change GUI controls/ prevent event firing

    Hi,
    I often construct GUIs where user input in one control automatically changes other controls.
    A (simple) example:
    A GUI contains controls A and B. When the user changes control A the value of control B has to be adjusted, and the other way round. So the event handler of A tells B to change its value. An event is fired, and the event handler of B tells A to change its value. An event is fired... and you have an endless event handling loop.
    Please believe me, though the example is simple: this happens frequently in real life, too. Since setting Swing controls programmatically most often triggers events, I need a mechanism to prevent event handling loops. What I do so far is
    o set a "deaf" flag
    o change the control
    o the listener gets informed about the change, but since the "deaf" flag is set it does nothing
    o reset the "deaf" flag
    Another, equally awkward way, is removing event listeners before the change and reattaching them afterwards.
    Is there any elegant way to handle this? How do you handle this kind of problem, which can't be too rare in the GUI world (although a rather extensive search with Google did not find much)?
    Chris

    Personally, I usually choose the same approach as you did, implementing a flag which I'll check when events are fired. If you do this, however, be sure to make the flag volatile, otherwise it might (very rarely) happen that a thread caches the value (even though this points to faulty code on your side, it is well near impossible to debug). I would strongly recomment not to remove and readd the listeners since it will create a lot of overhead and is rather hard to maintain.

Maybe you are looking for