Control break events

Hi sdn,
i have a problem when i grouping the materials under the same invoice.
EX:
date   address  invoice  material
    1         apple
                                    tomato
                                    banana
     2         apple
                                    orange
when i use at new statement o/p coming like above, bcoz address have so many lines.
To avoid this i skip material to upper position.
Then,
date   address  invoice  material
    1         apple
               tomato
               banana
     2         apple
                orange
Here also no problem, but when ever the page  
changes how can i move this material to  upper  page
please suggest me.

Hi Ramya,
Please create new internal table like this.
DATA: BEGIN OF ITAB2 OCCURS 0,
        CC_GL LIKE ...
        COST_CENTER LIKE ...
        GL_ACCOUNT LIKE ...
        MATERIAL LIKE ...
        PRICE LIKE ...
DATA: END OF ITAB2.
DATA: WA_ITAB2 LIKE ITAB2.
SORT ITAB1.
LOOP AT ITAB1.
  MOVE ITAB1-COST_CENTER TO ITAB2-CC_GL(4).
  MOVE ITAB1-GL_ACCOUNT  TO ITAB2-CC_GL+4(10).
  MOVE-CORRESPONDING ITAB1 TO ITAB2.
  APPEND ITAB2.
ENDLOOP ITAB1.
SORT ITAB2.
LOOP ITAB2 INTO WA_ITAB2.
   AT NEW CC_GL.
   ENDAT.
ENDLOOP.
Please check the syntax ... and hope this will help.
Regards,
Ferry Lianto

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

  • 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.

  • ALV Control break events

    Hi all,
    I have a requirement in ALV ,
    100 abc
    100 xyz
    using control break statement how we remove two hundreds and display output only one 100 ,names
    100 abc
        xyz.
    regrads,
    Praveen

    Hi,
    with the help of sort option you can get that. just check this sample.
    REPORT  ZTEST_ALV1                              .
    TYPE-POOLS: SLIS.
    DATA:
      LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      LT_SORT     TYPE SLIS_T_SORTINFO_ALV,
      LS_SORT     TYPE SLIS_SORTINFO_ALV.
    DATA: BEGIN OF ITAB OCCURS 0,
           VBELN LIKE VBAK-VBELN,
           POSNR LIKE VBAP-POSNR,
          END OF ITAB.
    ITAB-VBELN  = '12345'.
    ITAB-POSNR = '10'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12345'.
    ITAB-POSNR = '11'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12345'.
    ITAB-POSNR = '12'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12356'.
    ITAB-POSNR = '10'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12356'.
    ITAB-POSNR = '11'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12356'.
    ITAB-POSNR = '12'.
    APPEND ITAB.
    CLEAR ITAB.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        I_PROGRAM_NAME         = SY-REPID
        I_INTERNAL_TABNAME     = 'ITAB'
        I_INCLNAME             = SY-REPID
      CHANGING
        CT_FIELDCAT            = LT_FIELDCAT
      EXCEPTIONS
        INCONSISTENT_INTERFACE = 1
        PROGRAM_ERROR          = 2
        OTHERS                 = 3.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LS_SORT-FIELDNAME = 'VBELN'.
    LS_SORT-UP        = 'X'.
    *ls_sort-group = 'UL'.  "using this you can get new lines
    APPEND LS_SORT TO LT_SORT.
    CLEAR LS_SORT.
    LS_SORT-FIELDNAME = 'POSNR'.
    LS_SORT-UP        = 'X'.
    *ls_sort-group = '*'."using this you get new pages
    APPEND LS_SORT TO LT_SORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        IT_FIELDCAT = LT_FIELDCAT
        IT_SORT     = LT_SORT
      TABLES
        T_OUTTAB    = ITAB.
    Regards
    vijay

  • Doubts with control break statements on internal table loops (AT/ENDAT)

    Hi, i've had a couple of doubts for a long while which I hope someone can clarify today:
    1) I know how to use the AT statements, however, i'm not sure I get correctly what this part of help regarding this commands means:
    <i>"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."</i>
    I've always sorted the internal table before the control break and it works that way. For example:
    SORT ITAB BY EBELN EBELP.
    LOOP AT ITAB.
      AT NEW EBELN.
    *   Code for the order header
      ENDAT.
    ENDLOOP.
    If I <b>don't</b> sort the internal table, it doesn't work! (i get dupplicated processing). In the example, if i have more than one register with the same EBELN and they're not consecutive, the header gets processed twice. I really don't get that part of the help text.
    2) I know this: <i>"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."</i>
    My doubt is: WHY is that this way? Because sometimes (most times) I need those fields INSIDE the statement! So when that happened i've solved it in one of three ways:
    LOOP AT ITAB INTO WA_ITAB.
      WA_ITAB_AUX = WA_ITAB.
      AT NEW FIELD.
        WA_ITAB = WA_ITAB_AUX.
    *   ...Rest of the code for the first register
      ENDAT.
    ENDLOOP.
    LOOP AT ITAB INTO WA_ITAB.
      AT NEW FIELD.
        READ TABLE ITAB INDEX SY-TABIX INTO WA_ITAB.
    *   ...Rest of the code for the first register
      ENDAT.
    ENDLOOP.
    * (Without AT)
    LOOP AT ITAB INTO WA_ITAB.
      IF WA_ITAB-FIELD <> FIELD_AUX.
        FIELD_AUX = WA_ITAB_FIELD.
    *   ...Rest of the code for the first register
      ENDIF.
    ENDLOOP.
    Is there any problem with this way of coding? Can be done better?
    Thank you very much in advance.

    Hi..,
    1)
    See if u sort the table on a field on which u r using AT ENDAT .. then all the records which are having the same value for that field will form a group or those reocrds will be at one place.. so when u sort the table for all the records  AT ENDAT  will get executed onli once..
    If u dont sort this table on this field then all these records will be at different places and in between there may be records with different value for this field.. so this AT ENDAT will get executed for each record !!
    2)
    No u cannot use the Right hand fields of the field in the table .. Because these AT events work as Group based operations... So till that field on which AT ENDAT is working it breaks that record into two groups.. One is the left hand fields including that field.. and right hand fields as another group.. and makes the right hand group as stars ****.  Thats y u can observe that even any one field in the left hand group changes the AT ENDAT will get executed  !!!!
    Hope u understood !!!
    regards,
    sai ramesh

  • Control Break Statements ----- Please Help me

    I have some idea about the control-break statements(AT-ENDAT). Can any one please give me the example ?
    Thanks in Advance. Points will be rewarded immediately.

    sample program for AT events
    Using AT FIRST , AT NEW, AT THE END OF , AT LAST.
    DATA: BEGIN OF ITAB OCCURS 0,
    F1 TYPE I,
    F2(6) TYPE C,
    F3(10) TYPE N,
    F4(16) TYPE P DECIMALS 2,
    END OF ITAB.
    DATA: SUB_TOT(10) TYPE P DECIMALS 3.
    **--1
    ITAB-F1 = 1.
    ITAB-F2 = 'ONE'.
    ITAB-F3 = 10.
    ITAB-F4 = '1000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 1.
    ITAB-F2 = 'ONE'.
    ITAB-F3 = 20.
    ITAB-F4 = '2000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 1.
    ITAB-F2 = 'ONE'.
    ITAB-F3 = 30.
    ITAB-F4 = '3000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    *--2
    ITAB-F1 = 2.
    ITAB-F2 = 'TWO'.
    ITAB-F3 = 10.
    ITAB-F4 = '1000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 2.
    ITAB-F2 = 'TWO'.
    ITAB-F3 = 20.
    ITAB-F4 = '2000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 3.
    ITAB-F2 = 'THREE'.
    ITAB-F3 = 10.
    ITAB-F4 = '1000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 3.
    ITAB-F2 = 'THREE'.
    ITAB-F3 = 20.
    ITAB-F4 = '2000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    SORT ITAB BY F1.
    LOOP AT ITAB.
    AT FIRST.
    WRITE: /35 ' MATERIAL DETAILS:'.
    ULINE.
    ENDAT.
    AT NEW F1.
    WRITE: / 'DETAILS OF MATERIAL:' COLOR 7 , ITAB-F1.
    ULINE.
    ENDAT.
    WRITE: / ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.
    SUB_TOT = SUB_TOT + ITAB-F4.
    AT END OF F1.
    ULINE.
    WRITE: / 'SUB TOTAL :' COLOR 3 INVERSE ON, SUB_TOT COLOR 3 INVERSE ON.
    CLEAR SUB_TOT.
    ENDAT.
    AT LAST.
    SUM.
    ULINE.
    WRITE: 'SUM:', ITAB-F4.
    ULINE.
    ENDAT.
    ENDLOOP.
    Reward points if helpful.
    Rgds,
    Abhishek

  • Control Break in Smartform

    Dear all,
       How to write control break statement in smart form while printing multiple line items in loop.
    like at new at last etc.....
    For eg; multiple lines having same material  with different batch, how to total all batches for the same material  and print it for single material.
    Thanks in advance.
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Nov 5, 2008 11:15 AM

    Hi
    Make use of the Calculations tab
    select accordingly the operation required ( TOTAL)
    Give the field name which you want to total
    Give the Target field name where you want the total to be and use this field to display the Total
    Give the time for total also
    i.e After Loop etc.
    if you want SUBTOTALS
    then print this value in the Event which you created as I mentioned in the previous Post
    If GrandTotal
    Then in the Footer area of the table print this value.
    in the conditions tab remove the check box AT PAGE BREAK if you want only at end of all the  data
    http://help.sap.com/saphelp_nw70/helpdata/EN/a5/de6838abce021ae10000009b38f842/frameset.htm
    regards
    Prasanth

  • Control break statements in smart forms

    Hi,
    Can we use control break statements(at new,at end of) in smart forms?
    if no why?
    if yes, how?
    Regards,
    Sonika

    you can use control block statements in smartforms by using the SORT events.
    In TABLES go to to the SORT section.Here you can give the field by which you want the table to be sorted.There are two radio buttons available for sort : SORT BEGIN and SORT end.
    On selecting any one sort event are generated automatically and event nodes are created in smartforms.Inside these event nodes you can add text nodes or code nodes and write your code.
    SORT BEGIN works like AT NEW
    SORT END works like AT END OF.

  • Control break statments

    Hi all
         in control break statments AT NEW COMMAND will provide astrik and blank in the out put in  right side of the column.why!
        in the case of on change of  it will not give astrik and blank on the right side of the column in the out put . why!
    regards
    Nagendra.

    Control Break Statements:
    1. At First
    2. At last
    3. At New
    4. At End of
    5. on change.
    *at first, at last, at new, at end of are also called as at
    events and these will be used in loop.....endloop of an
    internal table.
    *'on change' can be used in out side of the loop...endloop.
    1.At first event will be executed only for the first
    iteration of the loop...endloop. This event is used for
    writing headings.
    2. At last event will be triggered for the last iteration
    of the loop...endloop.
    3. At new event will be triggered for every new value
    enters in to the field.
    4. event at end of will be triggered if the current running
    value is the last value.
    5. on change will be triggered for any change in the
    specified field value.

  • Control break urgent

    difference between on change and at first.
    in which scenario which control break statement
    we have to use

    Hi Sunil!!
    ON CHANGE OF f.
    Addition:
    ... OR f1
    This statement is not allowed in an ABAP Objects context. See Prohibit ON CHANGE OF - ENDON.
    Effect
    Executes the processing block enclosed by the "ON CHANGE OF f" and "ENDON" statements whenever the contents of the field f change (control break processing).
    Normally, you use the statement to manipulate database fields during GET events or SELECT/ENDSELECT processing.
    Note
    There are special control structures for processing control breaks in LOOP s on internal tables or extract datasets (AT).
    ON CHANGE OF is unsuitable for recognizing control levels in loops of this type because it always creates a global auxiliary field which is used to check for changes. This global auxiliary field is only changed in the relevant ON CHANGE OF statement. It is not reset when the processing enters loops or subroutines, so unwanted effects can occur if the loop or subroutine is executed again. Also, since it is set to its initial value when created (like any other field), any ON CHANGE OF processing will be executed after the first test, unless the contents of the field concerned happen to be identical to the initial value.
    Example
    DATA T100_WA TYPE T100.
    SELECT * FROM T100
             INTO T100_WA
             WHERE SPRSL = SY-LANGU AND
                             MSGNR < '010'
                       ORDER BY PRIMARY KEY.
      ON CHANGE OF T100_WA-ARBGB.
        ULINE.
        WRITE: / '**', T100_WA-ARBGB, '**'.
      ENDON.
      WRITE: / T100_WA-MSGNR, T100_WA-TEXT.
    ENDSELECT.
    Displays all messages with their numbers in the logon language, provided the number is less than '010'.
    Each time the message class changes, it is output.
    Addition
    ... OR f1
    Effect
    Also executes the code whenever the contents of the field f1 changes.
    You can use this addition several times.
    Example
    Logical database F1S
    NODES: SPFLI, SFLIGHT, SBOOK.
    GET SBOOK.
      ON CHANGE OF SPFLI-CARRID   OR
                   SPFLI-CONNID   OR
                   SFLIGHT-FLDATE.
        ULINE.
        WRITE: /5 SPFLI-CARRID, SPFLI-CONNID,
                5 SFLIGHT-FLDATE, SPFLI-FLTIME,
                5 SFLIGHT-SEATSMAX, SFLIGHT-SEATSOCC.
      ENDON.
      WRITE: / SBOOK-CUSTOMID.
    The code between ON CHANGE OF and ENDON is executed only if at least one of the fields SPFLI-CARRID, SPFLI-CONNID or SFLIGHT-FLDATE has changed, i.e. there is a different flight connection (which also has bookings).
    Notes
    Between ON CHANGE OF and ENDON, you can use ELSE for case distinction.
    You can also use ELSEIF statements in conjunction with special implementation of ON, but should always try to avoid this because they may not be supported in future.
    Related
    AT - control breaks with internal tables
    AT - control breaks with extracts
    AT FIRST.
    Effect
    The variants AT FIRST make sense within a LOOP.
    The processing block between AT FIRST and ENDAT is executed before the individual lines are processed; the processing block between AT LAST and ENDAT is executed after all the individual lines have been processed.
    In AT FIRST or AT LAST ... ENDAT processing, all argument fields are filled with "*" (internal tables).
    When you are processing extract datasets, a control total SUM(n) can only be processed with AT END OF or AT LAST.
    Example
    DATA: BEGIN OF COMPANIES OCCURS 20,
            NAME(30),
            PRODUCT(20),
            SALES TYPE I,
          END   OF COMPANIES.
    LOOP AT COMPANIES.
      AT FIRST.
        SUM.
        WRITE:    'Sum of all SALES:',
               55 COMPANIES-SALES.
      ENDAT.
      WRITE: / COMPANIES-NAME, COMPANIES-PRODUCT,
            55 COMPANIES-SALES.
    ENDLOOP.
    kindly reward if useful

  • Proble with control breaks

    Hi,
    When i use control breaks  and write a output i get astreix(*) in the output.
    I even tried with a local vriable but the value is not displayed in the output. i need to output the material description in the output.
    My code is as follows:
    LOOP AT lt_output INTO wa_output.
        AT NEW matnr.
          CLEAR: lv_matdesc.
          MOVE: wa_output-maktx TO lv_matdesc.
          WRITE: / '|',  wa_output-matnr, 30(40) lv_matdesc, 80(5)
                 wa_output-cocode, 86(4) wa_output-valarea, 93  '|'.
        ENDAT.
          AT END OF matnr.
          WRITE: / '|', 2(91) sy-uline, 93 '|'.
          WRITE: / '|', '*', 4(15) wa_output-matnr, 93 '|'.
          WRITE:/'|', 48(10) lv_mat_qty, 59(4) wa_output-bum, 70(15)
                lv_mat_amt, 85 wa_output-curr, 93 '|'.
          WRITE: / '|', 2(91) sy-uline, 93 '|'.
          CLEAR: lv_mat_qty, lv_mat_amt.
        ENDAT.
        AT LAST.
          WRITE: / '|', 2(91) sy-uline , 93 '|'.
          WRITE: / '|', '***', 5(15) 'Total', 93 '|'.
          WRITE:/'|', 48(10) lv_total_qty, 59(4) wa_output-bum, 70(15)
                lv_total_amt, 85 wa_output-curr, 93 '|'.
          WRITE: / '|', 2(91) sy-uline, 93 '|'.
        ENDAT.
      ENDLOOP.
    The output looks like this:
    9M27W8.X9B.0               ****************************************          ****  ****
    WE 4700001289   001  04/10/2002                  1.000  PC              31,667.65 CAD
    WE 4700001454   001  07/29/2002                  1.000  PC              30,074.63 CAD
    WE 4700001455   001  07/29/2002                  1.000  PC              30,074.63 CAD
    WE 4700001457   001  07/29/2002                  1.000  PC              30,513.47 CAD
    *9M27W8.X9B.0
    4.000  ****           122,330.38 *****
    **Total
    1,441.000  ****        38,926,097.05 *****

    Hi,
    LOOP AT lt_output INTO wa_output.
    wa_out = wa_output.    " and use this variable in the events to print the data instead of wa_output.
    AT NEW matnr.
    CLEAR: lv_matdesc.
    MOVE: wa_output-maktx TO lv_matdesc.
    WRITE: / '|', wa_output-matnr, 30(40) lv_matdesc, 80(5)
    wa_output-cocode, 86(4) wa_output-valarea, 93 '|'.
    ENDAT.
    AT END OF matnr.
    WRITE: / '|', 2(91) sy-uline, 93 '|'.
    WRITE: / '|', '*', 4(15) wa_output-matnr, 93 '|'.
    WRITE:/'|', 48(10) lv_mat_qty, 59(4) wa_output-bum, 70(15)
    lv_mat_amt, 85 wa_output-curr, 93 '|'.
    WRITE: / '|', 2(91) sy-uline, 93 '|'.
    CLEAR: lv_mat_qty, lv_mat_amt.
    ENDAT.
    AT LAST.
    WRITE: / '|', 2(91) sy-uline , 93 '|'.
    WRITE: / '|', '***', 5(15) 'Total', 93 '|'.
    WRITE:/'|', 48(10) lv_total_qty, 59(4) wa_output-bum, 70(15)
    lv_total_amt, 85 wa_output-curr, 93 '|'.
    WRITE: / '|', 2(91) sy-uline, 93 '|'.
    ENDAT.
    ENDLOOP.

  • 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

  • ANY SY-INDEX REFLECT CHANGES WHEN CONTROL BREAK STATEMENT PROCESS

    Dear Guru's,
                     I have a requirement where i have to move the values to variable when control break (AT END OF) process. So i want to move the values according to the end of Vendor so for that  i want to know is there any sy-index available which reflects changes when Control break (AT end of) process.
    LIKE Sy-subrc = 0 when select statement fetches record or sy-tabix is like counter for loop.
    Hope to get reply soon.
    Regards,
    Himanshu Rangappa

    Hi,
    There is no system Fields for it.
    But your requirement can be done with 'AT NEW' and 'AT END' statement.
    Refer this sample example,
    loop at otab.
        at new module.
          move otab-module to otab2-module.
        ENDAT.
          at END OF effort.
          sum.               "Do your calculations here
          move otab-count to otab2-count.
          append otab2.
        endat.
      endloop.

  • Problem with the control break statement  - AT END OF

    data : IT_DATA   TYPE STANDARD TABLE OF /BIC/OH0SPA_OHD WITH  KEY /B28/S_D1DVOX5 ,
    FIELD-SYMBOLS :   <ls_data> TYPE any,
    SELECT * FROM (c_open_hub) INTO TABLE IT_DATA .
    *IF sy-subrc = 0.
    *ENDIF.
    Create the GUID for header
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        EV_GUID_32 = LV_GUID.
    TRY.
        CALL METHOD CL_GDT_CONVERSION=>GUID_OUTBOUND
          EXPORTING
            IM_GUID_C = LV_GUID
          IMPORTING
            EX_VALUE  = LV_UUID.
      CATCH CX_GDT_CONVERSION  INTO go_exc .
        gv_text = go_exc->get_text( ).
    Application log for errors
        IF gv_text IS NOT INITIAL.
          PERFORM add_msg_to_log CHANGING lt_return.
          CALL FUNCTION '/SPA/APPL_LOG'
            EXPORTING
              LV_OBJECT    = '/SPA/APPL'
              LV_SUBOBJECT = '/SPA/ESOA'
              IT_RETURN    = lt_return.
        ENDIF.
    ENDTRY.
    OUTPUT-TRADE_PROMOTION_CRMBULK_CREATE-MESSAGE_HEADER-ID-CONTENT = LV_GUID.
    OUTPUT-TRADE_PROMOTION_CRMBULK_CREATE-MESSAGE_HEADER-UUID-CONTENT = LV_UUID.
    SELECT * FROM DD03T INTO TABLE lt_dd03t WHERE TABNAME = c_open_hub AND DDLANGUAGE = 'E' AND AS4LOCAL = 'A'.
    *IF sy-subrc = 0.
    *ENDIF.
    Sort the delta table
    SORT it_data.
    populate the output structure
    LOOP AT IT_DATA ASSIGNING <ls_data>.
    READ TABLE lt_dd03t INTO ls_dd03t with KEY DDTEXT = c_keyfigures.
    ASSIGN COMPONENT ls_dd03t-FIELDNAME OF STRUCTURE <ls_data> to <l_keyfigures>.
    READ TABLE lt_dd03t INTO ls_dd03t with KEY DDTEXT = c_signdata.
    ASSIGN COMPONENT ls_dd03t-FIELDNAME OF STRUCTURE <ls_data> to <l_signdata>.
    READ TABLE lt_dd03t INTO ls_dd03t with KEY DDTEXT = c_bbtype.
    ASSIGN COMPONENT ls_dd03t-FIELDNAME OF STRUCTURE <ls_data> to <l_bbtype>.
    READ TABLE lt_dd03t INTO ls_dd03t with KEY DDTEXT = c_customer.
    ASSIGN COMPONENT ls_dd03t-FIELDNAME OF STRUCTURE <ls_data> to <l_customer>.
    READ TABLE lt_dd03t INTO ls_dd03t with KEY DDTEXT = c_product.
    ASSIGN COMPONENT ls_dd03t-FIELDNAME OF STRUCTURE <ls_data> to <l_product>.
    READ TABLE lt_dd03t INTO ls_dd03t with KEY DDTEXT = c_territory.
    ASSIGN COMPONENT ls_dd03t-FIELDNAME OF STRUCTURE <ls_data> to <l_territory>.
    READ TABLE lt_dd03t INTO ls_dd03t with KEY DDTEXT = c_time.
    ASSIGN COMPONENT ls_dd03t-FIELDNAME OF STRUCTURE <ls_data> to <l_time>.
      CASE <l_keyfigures>.
        WHEN c_sd.
          PERFORM DATE_CALC USING <l_signdata> CHANGING  LV_DATE.
          ls_period_term-start_date = lv_date.
        WHEN c_ed.
          PERFORM DATE_CALC USING <l_signdata> CHANGING  LV_DATE.
          ls_period_term-end_date = lv_date.
        WHEN c_uplift.
          LS_PRODUCT_KF-ID-CONTENT = c_uplift_qyts.
          LS_PRODUCT_KF-VALUE = <l_signdata>.
         LS_PRODUCT_KF-YEAR = lv_week(4).
         LS_PRODUCT_KF-CALENDAR_PERIOD_ORDINAL_NUMBER = lv_week+4.
          APPEND LS_PRODUCT_KF TO LT_PRODUCT_KF.
        WHEN OTHERS.
        PERFORM DATE_CALC USING <l_signdata> CHANGING  LV_DATE.
         ls_period_term-start_date = lv_date.
    Get week
         CALL FUNCTION 'DATE_GET_WEEK'
           EXPORTING
             DATE = LS_PERIOD_TERM-START_DATE
           IMPORTING
             WEEK = LV_WEEK.
    append Keyfigure
          LS_PRODUCT_KF-ID-CONTENT = <l_keyfigures> .
          LS_PRODUCT_KF-VALUE = <l_signdata>.
         LS_PRODUCT_KF-YEAR = lv_week(4).
         LS_PRODUCT_KF-CALENDAR_PERIOD_ORDINAL_NUMBER = lv_week+4.
          APPEND LS_PRODUCT_KF TO LT_PRODUCT_KF.
    append tradespend
          SELECT SINGLE * FROM /SPA/SPEND_MAP INTO CORRESPONDING FIELDS OF LV_/SPA/SPEND_MAP
                 WHERE KEY_FIGURE = <l_keyfigures>.
          IF sy-subrc = 0.
            LS_TRADE_SPEND-TYPE_CODE-CONTENT = LV_/SPA/SPEND_MAP-SPEND_TYPE.
            LS_TRADE_SPEND-CATEGORY_CODE-CONTENT = LV_/SPA/SPEND_MAP-SPEND_CATEGORY.
            LS_TRADE_SPEND-METHOD_CODE-CONTENT = LV_/SPA/SPEND_MAP-SPEND_METHOD.
            APPEND LS_TRADE_SPEND TO LT_TRADE_SPEND.
          else.
            lv_flg = 'X'.
          ENDIF.
      ENDCASE.
    AT END OF /B28/S_D1DVOX5.   "
        SELECT SINGLE * FROM  /SPA/SO_TER_MAP INTO LS_/SPA/SO_TER_MAP WHERE TERRITORY = <l_territory>.
        IF sy-subrc = 0 AND lv_flg IS INITIAL.
    Create the GUID for TP's
          CALL FUNCTION 'GUID_CREATE'
            IMPORTING
              EV_GUID_32 = LV_GUID_MESSAGE.
          TRY.
              CALL METHOD CL_GDT_CONVERSION=>GUID_OUTBOUND
                EXPORTING
                  IM_GUID_C = LV_GUID_MESSAGE
                IMPORTING
                  EX_VALUE  = LV_UUID_MESSAGE.
            CATCH CX_GDT_CONVERSION .
          ENDTRY.
    populate the product
          LS_PRODUCT-ID-CONTENT = <l_product>.
          LS_CUSTOMER-ID-CONTENT = '300022'.
          LS_CUSTOMER-ROLE_CODE = '00000105'.
          LS_PRODUCT-KEY_FIGURE = LT_PRODUCT_KF.
          APPEND LS_PRODUCT TO LT_PRODUCT.
          APPEND LS_CUSTOMER TO LT_CUSTOMER.
          APPEND LS_DESCRIPTION TO LT_DESCRIPTION.
          APPEND LS_PERIOD_TERM TO LT_PERIOD_TERM.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-SALES_AREA-ORGANISATIONAL_CENTRE_ID = LS_/SPA/SO_TER_MAP-SALES__ORG.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-SALES_AREA-DISTRIBUTION_CHANNEL_CODE-CONTENT = LS_/SPA/SO_TER_MAP-DIST_CHANNEL.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-PLANNING_ACCOUNT-CUSTOMER_INTERNAL_ID = <l_customer>.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-PLANNING_PROFILE_GROUP_CODE-CONTENT = '4TPM'.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-TYPE_CODE-CONTENT = 'Z002'.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-UPLIFT_ACTIVE_INDICATOR = 'X'.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-PLANNING_INFORMATION-MARKETING_PROJECT_PLANNING_PRO = '5'.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-PLANNING_INFORMATION-CALENDAR_UNIT_CODE = 'WEE'.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-TRADE_SPEND = LT_TRADE_SPEND.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-PARTY = LT_CUSTOMER.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-DESCRIPTION = LT_DESCRIPTION.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-PLANNING_INFORMATION-PRODUCT = LT_PRODUCT.
          LS_TRADE_PROMOTION-TRADE_PROMOTION-PERIOD_TERM = LT_PERIOD_TERM.
          LS_TRADE_PROMOTION-MESSAGE_HEADER-ID-CONTENT = LV_GUID_MESSAGE.
          LS_TRADE_PROMOTION-MESSAGE_HEADER-UUID-CONTENT = LV_UUID_MESSAGE.
          LS_/SPA/REPORT_TAB-SPA_TP_ID = <l_bbtype>.
          LS_/SPA/REPORT_TAB-MESSAGE_ID = LV_GUID_MESSAGE.
          LS_/SPA/REPORT_TAB-CREATE_DATE = SY-DATUM.
          INSERT /SPA/REPORT_TAB FROM LS_/SPA/REPORT_TAB.
          APPEND LS_TRADE_PROMOTION TO LT_TRADE_PROMOTION.
          OUTPUT-TRADE_PROMOTION_CRMBULK_CREATE-TRADE_PROMOTION_CRMCREATE_REQU = LT_TRADE_PROMOTION.
          CLEAR : LT_DESCRIPTION, LT_PERIOD_TERM,LT_CUSTOMER, LT_PRODUCT, LT_PRODUCT_KF, LT_TRADE_SPEND,LS_/SPA/HEADER_TAB.
        ENDIF.
        CLEAR lv_flg .
      ENDAT.
    ENDLOOP.
    My problem is AT-END OF STATEMENT IS executing for each and every record of same /B28/S_D1DVOX5.
    Please help me from this problem

    Hello,
    First of all to know clearly about AT END.
    Let's say In IT_DATA fields are F1 F2 F3 /B28/S_D1DVOX5 F5.
    then AT END of /B28/S_D1DVOX5 means for each new value of this field at the end it will trigger.
    Please ensure thet IT_DATA is sorted by this field and then used Control break.
    Thanks,
    Pramod

Maybe you are looking for

  • Stutter in iMovie 5 & 6 - causes and workarounds

    This topic discusses the problem of stutter in the playback of iMovie 5/6 projects — where the playback pauses repeatedly. The cause of the stutter is discussed here, with possible workarounds. Over the last several weeks I've examined several stutte

  • Workshop for weblogic 8.1

    Hi, I need to setup j2EE development environment in weblogic workshop 8.1. I cannot find a link for it in Oracle website. How can i download it? Thanks

  • Need help projecting keynote from my iPod....??

    Ok so I purchased keynote for my iPod it's great and all but I cannot seem to project it on my wall. I have a projector and I video cord but no picture lol I read a lot about "Presenters  notes" and "presenters display" but dont find where to play fr

  • 2 hour DVD with 2 different chapters?

    I've never tried this, but I'm wondering if I can create with iDVD 5 a 2 hour DVD with two different movies in it? Essentially, I shot two dance shows and in order to save money, I'm hoping to fuse the two into one DVD whereby viewers can select Show

  • Botched 10.5.8 install?

    I am brand new to using my macbook pro, and have had some issues with changing my desktop background. The system preferences pane freezes then "quits unexpectedly" when i open desktop/screensaver. I have run across some suggested fixes, but none of t