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

SAP Script: Display Total calculated on page 2 in page 1

Hi,

In my Layout set there are two pages,

Page 1 is a cover letter & Page 2 displays the actual

data. Both pages are supposed to carry the total.

The total can be calculated only on page 2 as the line items are printed on page 2.

Added limitiation is that the steering program is a std program & the total calculation is custom & very specific to this layout.

How could this be accomplished ?.

Regards,

Jeron

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Dec 06, 2004 at 12:05 PM

    As far as I know you can only copy and change the steering program. And calculate the value before calling the sapscript.

    And from customizing, you should change the name of the program as the new one.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 27, 2004 at 02:57 PM

    Have you ever try to call PERFORM in SAP Script-formular ?

    Example: Formular 'MEDRUCK' for printing purchase order:

    ...

    /E TOTAL_AMOUNT

    /: PROTECT

    UL &ULINE(71)&

    /: PERFORM GET_TOTAL_SUM IN PROGRAM Z_MEDRUCK

    /: USING &EKKO-EBELN&

    /: CHANGING &I_NETTO& /: CHANGING &I_TAX&

    /: CHANGING &I_TOTAL&

    /: CHANGING &I_PRINT_TAX&

    /: ENDPERFORM

    TO ,, Netto without tax &EKKO-WAERS&,,&i_netto&

    /: IF &I_PRINT_TAX& EQ 'X'.

    TO ,, Tax &EKKO-WAERS&,,&i_tax&

    TO ,, Total with tax &EKKO-WAERS&,,&i_total&

    /: ENDIF

    /: ENDPROTECT

    ...

    where under 'USING' is/are input parameret/s for form 'GET_TOTAL_SUM' in program 'Z_MEDRUCK' and under 'CHANGING' is/are output parameter/s for this form.

    Form 'GET_TOTAL_SUM' summarises total values (netto, tax and total) for one purchase order. 'Z_MEDRUCK' is my own report and I can call it (or a form in it) whereever I want from the formular before printing total values (result of the form 'GET_TOTAL_SUM').

    report 'Z_MEDRUCK':

    REPORT Z_MEDRUCK.

    FORM GET_TOTAL_SUM tables in_par structure itcsy

    out_par structure itcsy.

    data: i_ebeln_s(21),

    i_ebeln like ekko-ebeln,

    i_netto like konv-kwert,

    i_tax like konv-kwert,

    i_total like konv-kwert,

    i_netto_str(21),

    i_tax_str(21),

    i_total_str(21),

    i_print_tax(1).

    data: begin of i_ekko occurs 0.

    include structure ekko.

    data: end of i_ekko.

    data: begin of i_konv occurs 0.

    include structure konv.

    data: end of i_konv.

    read table in_par with key 'EKKO-EBELN'.

    check sy-subrc = 0.

    i_ebeln_s = in_par-value.

    condense i_ebeln_s no-gaps.

    i_ebeln = i_ebeln_s.

    select single * from ekko into i_ekko where ebeln = i_ebeln.

    select * from konv into i_konv where knumv = i_ekko-knumv.

    append i_konv to i_konv.

    endselect.

    loop at i_konv.

    i_total = i_total + i_konv-kwert.

    if i_konv-kschl eq 'ZDPH'.

    i_tax = i_tax + i_konv-kwert.

    endif.

    endloop.

    i_netto = i_total - i_tax.

    write i_netto to i_netto_str.

    write i_tax to i_tax_str.

    write i_total to i_total_str.

    if i_tax gt 0.

    i_print_tax = 'X'.

    endif.

    read table out_par with key 'I_NETTO'.

    check sy-subrc = 0.

    move i_netto_str to out_par-value.

    modify out_par index sy-tabix.

    read table out_par with key 'I_TAX'.

    check sy-subrc = 0.

    move i_tax_str to out_par-value.

    modify out_par index sy-tabix.

    read table out_par with key 'I_TOTAL'.

    check sy-subrc = 0.

    move i_total_str to out_par-value.

    modify out_par index sy-tabix.

    read table out_par with key 'I_PRINT_TAX'.

    check sy-subrc = 0.

    move i_print_tax to out_par-value.

    modify out_par index sy-tabix.

    endform.

    This may help you

    Regard

    sarkan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 27, 2004 at 03:19 PM

    Sorry, I forgot one important aspect - the object you are processing (above it is purchase order) has to be saved in database.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      I am afraid it doesnot help.

      I do have a perform to calculate the total.

      But the total value will get calculated only at end of page 2. I need the total value (calc at end of page 2)

      to be somehow printed on page 1.

      Rgds,

      Jeron

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.