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