How can I use control break statement in my requirement

Hi ABAPers,
In my requirement, I have 4 fields in sorted internal table, (audat, prdha, ipnum, netwr). In that i need to do summation of netwr field falling under same prdha(BU) for the same month
internal table fields :
audat  prdha  ipnum  netwr
02      abc     1      100
02      abc     2      200
02      xyz     3      300
03      abc     4      100
03      xyz     5      300
03      xyz     6      200
i need output like this:
audat  prdha  ipnum  netwr
02      abc     1,2      300
02      xyz     3         300
03      abc     4         100
03      xyz     5,6      500
Can anyone suggest me logic for this by using control break statements
Thanks in advance,
Ankita
Moderator Message: Duplciate Post.
Edited by: kishan P on Apr 14, 2011 3:03 PM

Hi ABAPers,
In my requirement, I have 4 fields in sorted internal table, (audat, prdha, ipnum, netwr). In that i need to do summation of netwr field falling under same prdha(BU) for the same month
internal table fields :
audat  prdha  ipnum  netwr
02      abc     1      100
02      abc     2      200
02      xyz     3      300
03      abc     4      100
03      xyz     5      300
03      xyz     6      200
i need output like this:
audat  prdha  ipnum  netwr
02      abc     1,2      300
02      xyz     3         300
03      abc     4         100
03      xyz     5,6      500
Can anyone suggest me logic for this by using control break statements
Thanks in advance,
Ankita
Moderator Message: Duplciate Post.
Edited by: kishan P on Apr 14, 2011 3:03 PM

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.

  • What happen if i use controll break statement in between select & endselect

    Hi all,
    what happen if i use controll break statement in between select & endselect ?
    Thanks in Advance
    KR

    Hi for reference u can go through this code example
    data:
      fs_tab like sflight.
      data:
       t_tab like standard table of fs_tab.
       select * from sflight into table t_tab.
       loop at t_tab into fs_tab.
         write: / fs_tab-carrid.
       endloop.
       refresh t_tab.
       clear fs_tab.
       select * from sflight into fs_tab.
         at new fs_tab-carrid.
           append fs_tab to t_tab.
         endat.
       endselect.

  • How can i use one SQL statement to solve problem?

    How can i use one SQL statement to solve the question below?
    For a Table named A, there is a column named F(char type).
    Now select all the records where F like '%00' and update their F value to '%01'
    Just one SQL statement.Do not use PL/SQL block.
    How to do that?
    Thanks.

    What is the data volume for this table?
    Do you expect lots of rows to have '%00' as their value?
    Following two statements come to mind. Other experts would be able to provide better alternatives:
    If you have index on SUBSTR(f, 2):
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) || '01'
    WHERE  substr(f,
                  -2) = '00';If most of the rows have pattern '%00':
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) ||
               DECODE(SUBSTR(f,
                             -2),
                      '00',
                      '01',
                      SUBSTR(f,
                             -2));

  • How can I use a READ statement for the checking date =sydatum?

    Hello,
         I need use a READ statement on an internal table ITAB (with feild var1) and check whether feild var1<= sydatum(i.e. var1 greater than or equal to sy-datum)....how can I implement this??
    Regards,
    Shashank.

    Hi,
    try this short example.
    DATA: BEGIN OF ITAB OCCURS 0,
            DATE LIKE SY-DATUM,
          END   OF ITAB.
    ITAB-DATE = '20000101'. APPEND ITAB.
    ITAB-DATE = '20010101'. APPEND ITAB.
    ITAB-DATE = '20020101'. APPEND ITAB.
    ITAB-DATE = '20030101'. APPEND ITAB.
    ITAB-DATE = '20040101'. APPEND ITAB.
    ITAB-DATE = '20050101'. APPEND ITAB.
    ITAB-DATE = '20060101'. APPEND ITAB.
    ITAB-DATE = '20070101'. APPEND ITAB.
    ITAB-DATE = SY-DATUM.   APPEND ITAB.
    ITAB-DATE = '20080101'. APPEND ITAB.
    LOOP AT ITAB WHERE DATE < SY-DATUM.
      WRITE: / 'before', ITAB-DATE.
    ENDLOOP.
    LOOP AT ITAB WHERE DATE = SY-DATUM.
      WRITE: / 'equal ', ITAB-DATE.
    ENDLOOP.
    LOOP AT ITAB WHERE DATE > SY-DATUM.
      WRITE: / 'after ', ITAB-DATE.
    ENDLOOP.
    Regards, Dieter

  • How can i use control panel in win vista

    Can i get an old version of icloud ( may be V.2 ) to install an use control panel in win Vista. The newest version (v. 3.1) only works in win 7 or win 8

    You can get ver. 2.1.2 here: http://support.apple.com/kb/DL1687.

  • How can I use an IF statement in the SELECT

    Hi People,
    I have a procedure called ENQUEUE_PROC which takes 3 parameters.
    and I am trying to use an if statement in the select. I appreciate the help with this task.
    here is my code.
    Please have a look at my Select statement. What I have does not compile, however it might give you an idea of what i need.
    PROCEDURE ENQUEUE_PROC(P_SUBMISSION_ID NUMBER,
                           P_EVENT         VARCHAR2,
                                CASE_TYPE_CODE NUMBER;
                           ) AS
         XMLDATA XMLTYPE;
         enqueue_options     dbms_aq.enqueue_options_t;
         message_properties  dbms_aq.message_properties_t;
         message_handle      RAW(16);
         message SYS.AQ$_JMS_TEXT_MESSAGE;
    BEGIN
              SELECT      
                        XMLELEMENT("caseFileEvent", XMLATTRIBUTES('http://www.ussc.gov/soa/casefile/event/types' AS "xmlns",
                                                          'http://www.ussc.gov/soa/casefile/event/types' AS "xmlns:ns0"),
                             XMLELEMENT("caseFileUploadEvent", XMLATTRIBUTES('http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi",
                                                                                                   'http://www.ussc.gov/soa/casefile/event/types ../xsd/Case_META.xsd' AS "xsi:schemaLocation",
                                                                                                   'http://www.ussc.gov/soa/casefile/event/types' AS "xmlns"),
                                       XMLELEMENT("taskEvent", P_EVENT), --eg - 'SUBMIT', 'REJECT', 'RESUBMIT'
                                XMLELEMENT("defendentDetails",
                                                                XMLELEMENT("sentensingDate", SMD.SENT_VIO_DATE),
                                                                XMLELEMENT("personDetails",
                                                                               // Here is where I want my IF statement, *********************************
                                                                               IF CASE_TYPE_CODE = 10 THEN
                                                                                         XMLELEMENT("personNameDetails",
                                                                                                             XMLELEMENT("firstName", SMD.FIRST_NAME),
                                                                                                             XMLELEMENT("middleName", SMD.MIDDLE_NAME),
                                                                                                             XMLELEMENT("lastName", SMD.LAST_NAME)
                                                                                                   ), -- personNameDetails
                                                                               ELSE
                                                                                    XMLELEMENT("personNameDetails",
                                                                                                   XMLELEMENT("corpname", SMD.CORPNAME),
                                                                                         ), -- personNameDetails
                                                                               XMLELEMENT("dateOfBirth", SMD.BIRTH_DATE)          
                                                                          ) -- personDetails
                                            ), -- defendentDetails
                                            XMLELEMENT("documentStatusDetails",
                                                      XMLELEMENT("otherStatus",
                                                                     XMLELEMENT("intCode", NULL),
                                                                     XMLELEMENT("description", NULL)
                                                                ) -- otherStatus
                                            ), -- documentStatusDetails
                                            XMLELEMENT("uploadOtherDetails",
                                                           XMLELEMENT("submissionId", SUB.SUBMISSION_ID),
                                                           XMLELEMENT("submissionSessionId", SUB.SUB_SESSION_ID),
                                                           XMLELEMENT("submissionMethod",
                                                                XMLELEMENT("intCode", SUB.SUB_MTHD_CODE),
                                                                XMLELEMENT("description", SM.DESCRIP)
                                                           ), -- submissionMethod
                                                           XMLELEMENT("submissionReason",
                            XMLELEMENT("intCode", SUB.SUB_TYPE_CODE),
                                                                XMLELEMENT("description", SR.DESCRIP)
                                                           ), -- submissionReason
                                                           XMLELEMENT("district",
                                                                XMLELEMENT("intCode", SMD.DIST_ID),
                                                                XMLELEMENT("description", D.DISTRICT_NAME)
                                                           ), -- district
                                                           XMLELEMENT("caseFileType",
                                                                XMLELEMENT("intCode", SUB.CASE_TYPE_CODE),
                                                                XMLELEMENT("description", C.DESCRIP)
                                                           ), -- caseFileType
                                                           XMLELEMENT("primaryDocketInfo",
                                                                XMLELEMENT("yearYY", SUBSTR(SMD.DOCKET, 1, 2)),
                                                                XMLELEMENT("id", SUBSTR(SMD.DOCKET, 3, 7)),
                                                                XMLELEMENT("defendentNumber", SMD.DEF_NUM)
                                                           ), -- primaryDocketInfo
                                                           XMLELEMENT("PACTSId", SMD.PACTS_ID), -- PACTSId
                                                           XMLELEMENT("AOJudgeId",
                                                                XMLELEMENT("intCode", SMD.AO_JUDGE_ID),
                                                                XMLELEMENT("description", J.LAST_NAME || ', ' || J.FIRST_NAME || ', ' || J.MIDDLE_NAME)
                                                           ), -- AOJudgeId
                                                           XMLELEMENT("missingCasefile", SUB.MISSING_CASE), -- missingCasefile
                                                           XMLELEMENT("creator",
                                                                XMLELEMENT("firstName", NULL),
                                                                XMLELEMENT("lastName", NULL),
                                                                XMLELEMENT("email", SUB.CREATOR_ID),
                                                                XMLELEMENT("actionDate", REGEXP_REPLACE( TO_CHAR(SUB.CREATE_TIME, 'YYYY-MM-DD"T"HH24:MI:SS.FFTZR'), '...(......)$', '\1'))
                                                           ), -- creator
                                                           XMLELEMENT("lastModifier",
                                                                XMLELEMENT("firstName", NULL),
                                                                XMLELEMENT("lastName", NULL),
                                                                XMLELEMENT("email", H.USER_ID),
                                                                XMLELEMENT("actionDate", TO_CHAR(H.ACTION_DATE, 'YYYY-MM-DD"T"HH24:MI:SS".000-05:00"'))
                                                           ) -- lastModifier
                                            ) -- uploadOtherDetails
                             ) -- caseFileUploadEvent
                        ) -- caseFileEvent
              INTO      XMLDATA
              FROM      USSC_CASES.SUBMISSION SUB,
              USSC_CASES.SUBMISSION_METADATA SMD,
              USSC_CASES.CASE_HISTORY H,
              LOOKUP.CASE_SUB_MTHD SM,
              LOOKUP.CASE_SUB_TYPE SR,
              LOOKUP.DISTRICTS D,
              LOOKUP.JUDGES J,
              LOOKUP.CASE_TYPES C
              WHERE      SUB.SUBMISSION_ID = SMD.SUBMISSION_ID
              AND        SUB.SUBMISSION_ID = H.SUBMISSION_ID
              AND        SUB.SUB_MTHD_CODE = SM.SUBMTHD_CODE
              AND        SUB.SUB_TYPE_CODE = SR.SUBTYPE_CODE
              AND        SUB.CASE_TYPE_CODE = C.CASE_TYPE_CODE
              AND        SMD.DIST_ID = D.USSC_DISTRICT_ID
              AND        SMD.AO_JUDGE_ID = J.AO_JUDGE_ID
              AND        H.ACTION_DATE IN (SELECT MAX(A.ACTION_DATE)
                                  FROM USSC_CASES.CASE_HISTORY A
                                  WHERE A.SUBMISSION_ID = P_SUBMISSION_ID)
              AND        SUB.SUBMISSION_ID = P_SUBMISSION_ID;
        --dbms_output.put_line('queue start '|| xmldata.getclobval());
        --insert into test1 values(xmldata);
        message := SYS.AQ$_JMS_TEXT_MESSAGE.construct;
        message.set_text(xmldata.getStringVal());
        DBMS_AQ.ENQUEUE(queue_name => 'case_file_queue',  -- aqadm.cases_queue             
        enqueue_options    => enqueue_options,       
        message_properties => message_properties,     
        payload  => message,             
        msgid   => message_handle);
         COMMIT;
    END ENQUEUE_PROC;

    thanks for the help,
    I believe I almost got it to compilw, however I am getting Error(29,19): PL/SQL: ORA-00918: column ambiguously defined.
    Of course CASE_TYPE_CODE is ambiguously because its passed in, is there a way around this.
    Here is what i have so far.
    PROCEDURE ENQUEUE_PROC(P_SUBMISSION_ID NUMBER,
                           P_EVENT         VARCHAR2,
                           CASE_TYPE_CODE NUMBER    // passed in field
                           ) AS
         XMLDATA XMLTYPE;
         enqueue_options     dbms_aq.enqueue_options_t;
         message_properties  dbms_aq.message_properties_t;
         message_handle      RAW(16);
         message SYS.AQ$_JMS_TEXT_MESSAGE;
    BEGIN
              SELECT      
                        XMLELEMENT("caseFileEvent", XMLATTRIBUTES('http://www.ussc.gov/soa/casefile/event/types' AS "xmlns",
                                                          'http://www.ussc.gov/soa/casefile/event/types' AS "xmlns:ns0"),
                             XMLELEMENT("caseFileUploadEvent", XMLATTRIBUTES('http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi",
                                                                                                   'http://www.ussc.gov/soa/casefile/event/types ../xsd/Case_META.xsd' AS "xsi:schemaLocation",
                                                                                                   'http://www.ussc.gov/soa/casefile/event/types' AS "xmlns"),
                                       XMLELEMENT("taskEvent", P_EVENT), --eg - 'SUBMIT', 'REJECT', 'RESUBMIT'
                                            XMLELEMENT("defendentDetails",
                                                                XMLELEMENT("sentensingDate", SMD.SENT_VIO_DATE),
                                                                CASE
                                                                     WHEN CASE_TYPE_CODE = 10 THEN
                                                                           XMLELEMENT("personDetails",
                                                                                         XMLELEMENT("personNameDetails",
                                                                                                             XMLELEMENT("firstName", SMD.FIRST_NAME),
                                                                                                             XMLELEMENT("middleName", SMD.MIDDLE_NAME),
                                                                                                             XMLELEMENT("lastName", SMD.LAST_NAME)
                                                                                                   ), -- personNameDetails 
                                                                                         XMLELEMENT("dateOfBirth", SMD.BIRTH_DATE)          
                                                                                    ) -- personDetails
                                                                     ELSE
                                                                          XMLELEMENT("corporationDetails",
                                                                                         XMLELEMENT("organizationName", SMD.CORP_NAME)
                                                                                    ) -- corporationDetails          
                                                                END
                                            ), -- defendentDetails
                                            XMLELEMENT("documentStatusDetails",
                                                      XMLELEMENT("otherStatus",
                                                                     XMLELEMENT("intCode", NULL),
                                                                     XMLELEMENT("description", NULL)
                                                                ) -- otherStatus
                                            ), -- documentStatusDetails
                                            XMLELEMENT("uploadOtherDetails",
                                                           XMLELEMENT("submissionId", SUB.SUBMISSION_ID),
                                                           XMLELEMENT("submissionSessionId", SUB.SUB_SESSION_ID),
                                                           XMLELEMENT("submissionMethod",
                                                                XMLELEMENT("intCode", SUB.SUB_MTHD_CODE),
                                                                XMLELEMENT("description", SM.DESCRIP)
                                                           ), -- submissionMethod
                                                           XMLELEMENT("submissionReason",
                                                                XMLELEMENT("intCode", SUB.SUB_TYPE_CODE),
                                                                XMLELEMENT("description", SR.DESCRIP)
                                                           ), -- submissionReason
                                                           XMLELEMENT("district",
                                                                XMLELEMENT("intCode", SMD.DIST_ID),
                                                                XMLELEMENT("description", D.DISTRICT_NAME)
                                                           ), -- district
                                                           XMLELEMENT("caseFileType",
                                                                XMLELEMENT("intCode", SUB.CASE_TYPE_CODE),
                                                                XMLELEMENT("description", C.DESCRIP)
                                                           ), -- caseFileType
                                                           XMLELEMENT("primaryDocketInfo",
                                                                XMLELEMENT("yearYY", SUBSTR(SMD.DOCKET, 1, 2)),
                                                                XMLELEMENT("id", SUBSTR(SMD.DOCKET, 3, 7)),
                                                                XMLELEMENT("defendentNumber", SMD.DEF_NUM)
                                                           ), -- primaryDocketInfo
                                                           XMLELEMENT("PACTSId", SMD.PACTS_ID), -- PACTSId
                                                           XMLELEMENT("AOJudgeId",
                                                                XMLELEMENT("intCode", SMD.AO_JUDGE_ID),
                                                                XMLELEMENT("description", J.LAST_NAME || ', ' || J.FIRST_NAME || ', ' || J.MIDDLE_NAME)
                                                           ), -- AOJudgeId
                                                           XMLELEMENT("missingCasefile", SUB.MISSING_CASE), -- missingCasefile
                                                           XMLELEMENT("creator",
                                                                XMLELEMENT("firstName", NULL),
                                                                XMLELEMENT("lastName", NULL),
                                                                XMLELEMENT("email", SUB.CREATOR_ID),
                                                                XMLELEMENT("actionDate", REGEXP_REPLACE( TO_CHAR(SUB.CREATE_TIME, 'YYYY-MM-DD"T"HH24:MI:SS.FFTZR'), '...(......)$', '\1'))
                                                           ), -- creator
                                                           XMLELEMENT("lastModifier",
                                                                XMLELEMENT("firstName", NULL),
                                                                XMLELEMENT("lastName", NULL),
                                                                XMLELEMENT("email", H.USER_ID),
                                                                XMLELEMENT("actionDate", TO_CHAR(H.ACTION_DATE, 'YYYY-MM-DD"T"HH24:MI:SS".000-05:00"'))
                                                           ) -- lastModifier
                                            ) -- uploadOtherDetails
                             ) -- caseFileUploadEvent
                        ) -- caseFileEvent
              INTO      XMLDATA
              FROM      USSC_CASES.SUBMISSION SUB,
              USSC_CASES.SUBMISSION_METADATA SMD,
              USSC_CASES.CASE_HISTORY H,
              LOOKUP.CASE_SUB_MTHD SM,
              LOOKUP.CASE_SUB_TYPE SR,
              LOOKUP.DISTRICTS D,
              LOOKUP.JUDGES J,
              LOOKUP.CASE_TYPES C
              WHERE      SUB.SUBMISSION_ID = SMD.SUBMISSION_ID
              AND        SUB.SUBMISSION_ID = H.SUBMISSION_ID
              AND        SUB.SUB_MTHD_CODE = SM.SUBMTHD_CODE
              AND        SUB.SUB_TYPE_CODE = SR.SUBTYPE_CODE
              AND        SUB.CASE_TYPE_CODE = C.CASE_TYPE_CODE
              AND        SMD.DIST_ID = D.USSC_DISTRICT_ID
              AND        SMD.AO_JUDGE_ID = J.AO_JUDGE_ID
              AND        H.ACTION_DATE IN (SELECT      MAX(A.ACTION_DATE)
                                                 FROM      USSC_CASES.CASE_HISTORY A
                                                 WHERE      A.SUBMISSION_ID = P_SUBMISSION_ID)
              AND        SUB.SUBMISSION_ID = P_SUBMISSION_ID;
        --dbms_output.put_line('queue start '|| xmldata.getclobval());
        --insert into test1 values(xmldata);
        message := SYS.AQ$_JMS_TEXT_MESSAGE.construct;
        message.set_text(xmldata.getStringVal());
        DBMS_AQ.ENQUEUE(queue_name => 'case_file_queue',  -- aqadm.cases_queue             
        enqueue_options    => enqueue_options,       
        message_properties => message_properties,     
        payload  => message,             
        msgid   => message_handle);
         COMMIT;
    END ENQUEUE_PROC;Edited by: Rooney on Jan 31, 2012 1:55 PM

  • How can I use Pinnacle break-out box to capture in CS5

    A colleague uses Pinnacle's break-out box to capture analog video directly through CS4, bypassing Studio.
    I have CS5, and bought Pinnacle Studio 14.
    But when I open CAPTURE in CS5, I get a "capture device offline" statement. Anyone got any ideas?
    CL

    Or...
    Old forum message, message now gone, but here's the summary - I have not used, only made note of the product "Matt with Grass Valley
    Canopus in their tech support department stated that the 110 will suffice for most hobbyist. If a person has a lot of tapes that were
    played often the tape stretches and the magnetic coding diminishes. If your goal is to encode tapes in good shape buy the 110, if you
    will be encoding old tapes of poor quality buy the 300"
    http://www.grassvalley.com/products/advc55 One Way Only to Computer
    http://www.grassvalley.com/products/advc110 for good tapes, or
    http://www.grassvalley.com/products/advc300 better with OLD tapes
    Or ADS Pyro http://www.adstechnologies.com
    ADS Pyro $120 http://www.bhphotovideo.com/c/product/462759-REG/ADS_Technologies_API_557_EFS_PYRO_A_V_Lin k_with.html
    Pyro has low rating @Newegg and low at BHPV
    Below said... I have the ADS Pyro AV Link and it works flawlessly and it bypasses MacroVision
    http://forum.videohelp.com/threads/275966-Is-Canopus-50-55-100-110-REALLY-god-s-gift-to-th e-VHS-capture-universe
    ADVC55 $159 http://www.bhphotovideo.com/c/product/312315-REG/Grass_Valley_602005_ADVC_55_Analog_to_Dig ital.html
    ADVC55 has higher ratings at BHPV with very few low ratings and also high rating @Newegg
    Next Article said Liked the ADVC55's picture quality the best
    http://www.macworld.com/reviews/product/406056/review/advc55.html

  • How can we use IF ELSE  statement in Header Section

    Hi All
    I have requirement to display a bill address in header section based on a particular status ,would some body please share that is it possible to use if else in header section .
    Thanks in advance
    Thanks
    Pratap

    you cannot place your if conditions within form fields in the Word header. But you can directly type the tags instead.
    Regards
    Nishka

  • How can i use page break for every 5 records in sap scripts

    on every 5 lines of records i have go for a new page so what is procedure to do this .if possible send me with coding .

    Hi John..
    this is the way..
    IN THE PRINT PROGRAM...
    DATA : V_MOD TYPE I.
    loop at Itab.
       V_MOD  = SY-TABIX / 5.
       IF V_MOD  = 0.
           CALL FUNCTION 'CONTROL_FORM'
           EXPORTING'
              COMMAND = 'NEW-PAGE' .
      ENDIF.
             CALL FUNCTION 'WRITE_FORM'
    ENDLOOP.
    <b>reward if Helpful.</b>

  • 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 Statements in HR-ABAP

    Hi Guru's
    I'm new to hr-abap i would like some guidance, can we use control break statements in abap-hr.
    Thanks & Regards
    Raj.

    Hi Raj,
    You mean AT .. ENDAT statements inside loops right?
    Yes, they are definitely used in HR-ABAP.
    REPORT ZTRIAL.
    INFOTYPES: 0022.
    GET PERNR.
    LOOP AT P0022.
    AT FIRST.
    WRITE: 'First record'.
    ENDAT.
    AT NEW SLART.
    WRITE: 'School type changed'.
    ENDAT.
    ENDLOOP.
    Regards,
    Dilek

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

  • Doubt in control break statement

    Hi All,
    Is there any way to trigger control break statements at new & at end of for non primary key fields.
    i want to trigger both control break statements for my requirement , not at change of, because i want to trigger at end of also. Please let me know if any possibility. Thanks
    regards
    vishal

    hi vishal,
    Variants:
    1. AT NEW f.
    2. AT END OF f.
    3. AT FIRST.
    4. 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
    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.
    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.
    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.
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas.See 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 fhas 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
    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.
    By defining an offset and/or length, you can further restrict control break criteria - regardless of whether they are specified statically or dynamically.
    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.
    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.

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

Maybe you are looking for

  • HP Savings Center - Coupons and Offers: Help and Support

    The HP savings Center on HP Connected has been retired.  For access to coupons and deals please go to www.coupons.com/moresavings.  I am an HP employee.

  • Acrobat crashes when creating a PDF from a web page

    Whenever I ask Acrobat to create a PDF from a web page, it crashes halfway through the process.  Here is an example from the BBC:- http://www.bbc.co.uk/news/science-environment-19585341 Printing to PDF from the browser does not produce an accurate do

  • Is it really another error about full table scans for small tables....?????

    Hi , I have posted the following : Full Table Scans for small tables... in Oracle10g v.2 and the first post of Mr. Chris Antognini was that : "I'm sorry to say that the documentation is wrong! In fact when a full table scan is executed, and the block

  • DTP status is in yellow forever

    Hi experts, We are using BI 7.0. Last weekend we implemented SP 19. Since putting in SP 19, some master data loads are running correctly, but remaining 'yellow'. The data package in the DTP monitor remains yellow since almost 24 hrs with only "Extrac

  • Word Processor

    Is there anywhere I can get a word processor online for my mac? Mine didn't come with appleworks, and I'm just looking for something basic to put on it. I took a look at openoffice.org but I don't think that is right for my system. Thanks!