cancel
Showing results for 
Search instead for 
Did you mean: 

probleam facing at the time of total calculation

Former Member
0 Kudos

hi,

in my out put in maindow the addition of 12lines( all values 150, so 150 multiply with 12) value is 1800 but i am getting 1950,it is calculating next page one line value (150) .

I DONT KNOW WHY IT IS ADDING another one line vaue to the first page instaead of 1800 it is showing 1950.

can some body tell it is the probleam in program or form itself??

please help

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

There might be 13 lines place in your main window, decrease the window size or use conditional break statements.

Former Member
0 Kudos

hi,

how to use conditional break statements??

please tell elaborately

then i will do regarding this issue

Former Member
0 Kudos

Hi,

see this example...

Give conditions like number of line items to be displayed per page and then give next-page.

FORM main_form .

LOOP AT t_flight INTO fs_flight.

w_sum = w_sum + fs_flight-price.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'FLIGHT'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

  • WINDOW = 'MAIN'

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

AT LAST.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'GRAND_TOTAL'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

  • WINDOW = 'MAIN'

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

EXIT.

ENDAT.

ADD 1 TO w_index.

IF w_index GT 5. " Give the required condition

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'PAGE_TOTAL'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

  • WINDOW = 'MAIN'

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'

  • EXCEPTIONS

  • UNOPENED = 1

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

w_index = 1.

ENDIF.

ENDLOOP.