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: 

Regarding SAP Scripts Total Printing

Former Member
0 Kudos
129

Hi All,

I have a issue regarding SAP Scripts Total Printing.

Actual issue is:

I have Item data to be printed in my page all those item data we need to print in columns&rows in Frame, that data may carry to no of pages.

Now what i want is when all the records are printed then i need to print total below it for some fields also some

NOTE: i have to provide below total.

Can any body tell me how can i solve above issue.

<b>When records not available Total is printing below Header not in the specified row.

If more rows are available it is printing in diffrent place.</b>

To make Total to be printed in exactly below all rows what i need to do.

Can anybody help me out for solving this problem

Thanks in advance.

Thanks & Regards,

Rayeez.

9 REPLIES 9

Former Member
0 Kudos
80

Hi shaik,

1. write the total

in a text element (separate from item element)

2. Then in your driver program,

after printing all the items (using text elements)

one by one,

after the loop is over,

write code to print the text element for TOTALS.

regards,

amit m.

0 Kudos
80

Hi,

I have done it in the way you have specified.

But because All items inside a Frame and in boxes.

I am not able to print Total in exact place.

If u take one example in excel sheet.

I am printing <b>Item No Description Quantity</b> as 3 cloumns.

i might have <b>1/5/10/No</b> rows.

In that case <b>Total</b> should come below Description Column and below <b>Quantity</b> total should be displayed.

but remember Total is also in box same way as all items.

Now i should be able to print Total at 2/6/11/after header in Box.

In case of excel just think of <b>Columns& Rows/Boxes</b>.

If any body have the solution please reply.

Thanks & Regards,

Rayeez.

Former Member
0 Kudos
80

use WRITE_FORM for total after u loop through all the records.

u can use the same window MAIN.....

loop at itab.

*do the total of records here.

endloop.

call function 'WRITE_FORM'

exporting

element = 'ITEM_TOTAL'

window = 'MAIN'

exceptions

element = 1

function = 2

type = 3

unopened = 4

unstarted = 5

window = 6

bad_pageformat_for_print = 7

others = 8.

Former Member
0 Kudos
80

HI Shahik,

1.Write a new text element ..

eg. /E Total in your SAPScript.

And in the program..

call it in

LOOP AT ..

AT LAST.

CALL FUNCTION 'WRITE_FORM'.

EXPORTING

........

ELEMENTS = 'TOTAL'

ENDAT.

ENDLOOP.

regards

satesh

0 Kudos
80

Hi,

Thanks for those replies.

But in that case also Total & its values are displayed in seperate line and box in other lines which is actually meant for Total & its values.

It is varying depending upon no of rows[Items] for that Output.

That's the actual issue.

Thanks & Regards,

Rayeez.

Former Member
0 Kudos
80

u have to use tabs in the script so that u can print them as u like.

Former Member
0 Kudos
80

in the script use rhe element name

for example

/tot

use the same element tot in the write form when u want to print the total.

in the script :

/: &f1& &f2& &f3&

/e tot

/: &f_total&

Former Member
0 Kudos
80

hai,

why can't u create another window (ie) footer window to display the totals............

example:

AT LAST.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'FOOTER'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'FOOTER'

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

ENDAT.

Former Member
0 Kudos
80

loop at itab.

call function 'WRITE_FORM'

exporting

element = 'ITEMs'

window = 'MAIN'

exceptions

element = 1

function = 2

type = 3

unopened = 4

unstarted = 5

window = 6

bad_pageformat_for_print = 7

others = 8.

endloop.

call function 'WRITE_FORM'

exporting

element = 'ITEM_TOTAL'

window = 'MAIN'

exceptions

element = 1

function = 2

type = 3

unopened = 4

unstarted = 5

window = 6

bad_pageformat_for_print = 7

others = 8.

in script main window use those elements :

/E items

*print ur items

/eE item_total