Skip to Content
avatar image
Former Member

using control break statement

Hi ,

can anybody help me on this issue.......

using control break statement i want to sum price field at the end of every page i need total....

here i am sending some code what i have written...

LOOP AT it_final INTO wa_final.

AT FIRST.

WRITE: / 'NUMBER RECORDS SELECTED:' , V_LINE.

ENDAT.

AT NEW VBELN.

WRITE: /2 wa_final-vbeln.

ENDAT.

WRITE: /10 wa_final-erdat,

30 wa_final-ernam,

45 wa_final-posnr,

60 wa_final-matnr,

75 wa_final-ntgew,

90 wa_final-netwr.

V_NETWR = V_NETWR + WA_FINAL-NETWR.

AT END OF VBELN.

WRITE: /70 'NET VALUE SALESORDER:',V_NETWR.

ENDAT.

AT LAST.

WRITE: / 'END OF REPORT'.

ENDAT.

ENDLOOP.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 15, 2008 at 09:28 AM

    hi ,

    u have to use keyword SUM here.

    sample code-

    AT END OF VBELN.

    SUM.

    WRITE: /70 'NET VALUE SALESORDER:',WA_FInal-NETWR.

    ENDAT.

    comment line - V_NETWR = V_NETWR + WA_FINAL-NETWR.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi,

      i got the output for every sales order number. i don't want like this. i want to get sum at every page.

      but above code will give ( if i have 5 records of salse order 1 i will get 5 records sum ) i want total at end of every page...

  • avatar image
    Former Member
    Oct 15, 2008 at 10:32 AM

    Hi,

    just add netwr value in to a variable.

    say for eg.

    sum = sum + wa_itab-netwr.

    now print this in END-OF-PAGE. event

    END-OF-PAGE.

    write sum.

    specify line-count at start of report.

    for final sum use

    at last.

    sum.

    write : wa_itab-netwr.

    endat.

    this will solve your problem.

    <code>

    REPORT ZVD_SDN1 LINE-COUNT 33(3). .

    TYPES:BEGIN OF TY_ITAB,

    VBELN TYPE VBELN,

    NETWR TYPE NETWR,

    END OF TY_ITAB.

    DATA : GT_ITAB TYPE TABLE OF TY_ITAB,

    WA_ITAB TYPE TY_ITAB,

    I TYPE SY-LINCT,

    SUM TYPE I.

    START-OF-SELECTION.

    SELECT VBELN NETWR FROM VBAP

    INTO TABLE GT_ITAB

    UP TO 100 ROWS.

    END-OF-SELECTION.

    SORT GT_ITAB BY VBELN.

    LOOP AT GT_ITAB INTO WA_ITAB.

    WRITE :/ WA_ITAB-VBELN,WA_ITAB-NETWR.

    WRITE : SY-LINCT,SY-LILLI.

    SUM = SUM + WA_ITAB-NETWR.

    AT LAST.

    SUM.

    ULINE.

    WRITE :/'SUM',WA_ITAB-NETWR.

    ULINE.

    ENDAT.

    ENDLOOP.

    END-OF-PAGE.

    ULINE.

    WRITE: /50 'SUM',SUM.

    ULINE.

    <code>

    Add comment
    10|10000 characters needed characters exceeded