Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

want to calculate price for the materials listed per page of main window

Former Member
0 Kudos
83

dear friends,

i want to calculate amount for the items listed on respective page.I have main windw in which items are been listed.i m getting amount for items listed on first page at last but in second page i get the sum of previous and this pages item price too.

i want to calculate amount for all items listed per page on each page seperately...

please help....

thnx in advance..

1 ACCEPTED SOLUTION

Former Member
0 Kudos
62

hi yogendra

try this type

LOOP AT I_INV.

sum = i_INV-fkimg + sum.

sum1 = i_INV-netwr + sum1.

  • sum2 = sum1.

endloop.

amount = sum.

LOOP AT I_INV.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'MAIN'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • CODEPAGE = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDLOOP.

loop at i_inv.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'DATA1'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'SECOND'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • CODEPAGE = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

endloop.

pls put it loop and calc the amount and

amount1 = amount + sum like do .

3 REPLIES 3

Former Member
0 Kudos
63

hi yogendra

try this type

LOOP AT I_INV.

sum = i_INV-fkimg + sum.

sum1 = i_INV-netwr + sum1.

  • sum2 = sum1.

endloop.

amount = sum.

LOOP AT I_INV.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'MAIN'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • CODEPAGE = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDLOOP.

loop at i_inv.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'DATA1'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'SECOND'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • CODEPAGE = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

endloop.

pls put it loop and calc the amount and

amount1 = amount + sum like do .

Former Member
0 Kudos
62

hi yogendra...

u can write ur sum's logic in "END_OF_PAGE" event.... u'll have to specify line count at report statement for that... i think its enough to get total amount at every end of the page..

reward points if useful..

0 Kudos
62

hi sagar, ihave to do the same in samrtform.As in main window when the list exceeds in no. some of items been listed in next page.

I m getting the final value on 2 nd page as needed but now i also want to get sum for the items respective to each page to create amount for cheque which is been created on each page.