Skip to Content
author's profile photo Former Member
Former Member

sap script totals and subtotals

im doin a script for sales order.

my question is that is i enter a range for SO..

i need the subtotals for every SO on that page and also at the last page i want the total of all the subtotals..

i ve got through for the subtotals..but getting total and subtotal simultaneously on the last page is a problem.

n till nw its page1 format..

do i ve to include page2 format or any other soution??

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 01, 2007 at 07:47 AM

    Hi,

    If u wantto display the grand total in the last page, u can handle that in the driver program.

    AT LAST .

    sum the field into var1.

    Endat .

    In the scripttext editor of first page of footer window,

    • &var1&

    It will no way effect ur Subtotal at the end of ur page.

    Revert back if any issues,

    Reward with points if helpful.

    Regards,

    Naveen.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 01, 2007 at 08:27 AM

    Hi rashmi,

    If the above code doesn't work means, use upto subtotal part. That means after at last u can remove and do in the above loop itself.see the below one.

    loop at itab.

    v_qty =v_qty+ itab-qty.

    call function 'WRITE_form' for element 'TABLE_ROW'.

    at end of vbeln.

    read table itab index sy-tabix.

    sum.

    call function 'WRITE_form' for element 'TABLE_SUBTOTAL'.

    endloop.

    in the variable v_qty u will have total value.

    reward if helpful

    Thanks,

    Suma.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 01, 2007 at 08:21 AM

    Hi Rashmi,

    I missed one statement. plz use the below code.

    loop at itab.
                 call function 'write_form'
                 exporting
                    element = 'TABLE_ROW'
                    function = 'SET'
                    type = 'BODY'
                    window = 'MAIN'
     <b>at end of vbeln</b>
     read itab index sy-tabix.
     sum.
                  call function 'write_form'
                      exporting
                      element = 'TABLE_SUBTOTAL'
                       f unction = 'SET'
                      type = 'BODY'
                      window = 'MAIN'
      endat.
    
    <b> at last.</b>
     read table itab index sy-tabix.
     sum.
            call function 'write_form'
               exporting
                element = 'TABLE_TOTAL'
                function = 'SET'
                 type = 'BODY'
                 window = 'MAIN'
     endat.
    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 01, 2007 at 07:49 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 01, 2007 at 08:17 AM

    Hi rashmi,

    If u are able to do subtotals in script means u can find total in driver program and save it in variable . use that variable in sapscript last page. plz check suppose this code is useful.

    loop at itab.

    call function 'write_form'

    exporting

    element = <b>'TABLE_ROW'</b>

    function = 'SET'

    type = 'BODY'

    window = 'MAIN'

    read itab index sy-tabix.

    sum.

    call function 'write_form'

    exporting

    element = <b>'TABLE_SUBTOTAL'</b>

    function = 'SET'

    type = 'BODY'

    window = 'MAIN'

    endat.

    <b>at last</b>.

    read table itab index sy-tabix.

    sum.

    call function 'write_form'

    exporting

    element = <b>'TABLE_TOTAL'</b>

    function = 'SET'

    type = 'BODY'

    window = 'MAIN'

    endat.

    endloop.

    IIn sap script under 'TABLE_ROW' element write all coloumns.

    under 'TABLE_SUBTOTAL' itab-qty

    under 'TABLE_TOTAL' itab-qty

    I am not sure. but it may work plz once test it.

    reward if helpful.

    Thanks,

    Suma.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.