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

scripts

HI,

can i have a sample prog for having the summing and carry fwd in scripts.

regards,

kb

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 10, 2007 at 11:50 AM

    Hi,

    To calculate totals and sub totals in sap scripts you have to use subroutines.

    Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine

    /: DEFINE &TOT_PRICE&

    /: PERFORM F_GET_PRICE IN PROGRAM <subroutine prog name> /:USING &KOMVD-KBERT& /:CHANGING &TOT_PRICE& /:ENDPERFORM

    Then write the variable where ever you want it to be printed (mostly it will be in footer window)

    Then create subroutine pool program and you have to write the code.

    FORM F_GET_PRICE tables int_cond structure itcsy

    outt_cond structure itcsy. data : value type kbert.

    statics value1 type kbert.

    Read int_cond table index 1.

    value = int_cond-value.

    value1 = value1 + value.

    Read outt_cond table index 1.

    outt_cond-value = value1.

    Modify outt_cond index 1.

    ENDFORM.

    Regards,

    Bhaskar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 10, 2007 at 11:51 AM

    Hi,

    You can sum the total in the program that calls the script and print it in the script.

    lets say you have an internal table and you writing as lines in the script.

    01 10 usd

    02 20 usd

    etc...

    99 10 usd

    call funtion 'open_form'

    loop at itab.

    call funtion 'write_form

    element = '100' (for lines)

    g_total = g_total + itab-value.

    at last.

    call funtion 'write_form

    element = '101' (for total)

    endat.

    endloop.

    so at the end of all the line items printed, the element 101 will be called and the total is printed there.

    For subtotals and totals on each page you have to come with a logic to sum in the wrapper program and pass it on to the SAP script.

    Reward if found helpfull...

    Cheers

    Chandra Sekhar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2009 at 10:20 PM

    thanks

    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.