on 05-10-2011 6:11 AM
Hi All,
Please help me out for this requirement.
I have an amount field MSEG-DMBTR. I need to show the sum of this field as TOTAL.
The code used in script is:
/: DEFINE TOT_PRICE
/: PERFORM final_total IN PROGRAM ZFIN_TOTAL
/: USING &MSEG-DMBTR&
/: CHANGING &TOT_PRICE&
/: ENDPERFORM
the form subroutine used is:
FORM final_total tables int_cond structure itcsy
outt_cond structure itcsy.
data : value type dmbtr.
statics value1 type dmbtr.
Read table int_cond WITH KEY NAME = 'MSEG-DMBTR'.
SHIFT int_cond-value LEFT DELETING LEADING space.
REPLACE ',' WITH ' ' INTO int_cond-value.
IF SY-SUBRC = 0.
CONDENSE int_cond-value NO-GAPS.
ENDIF.
value = int_cond-value.
value1 = value1 + value.
Read outt_cond table WITH KEY name = 'TOT_PRICE' .
outt_cond-value = value1.
Modify outt_cond index SY-INDEX.
ENDFORM. "final_total
i am printing &value1& in footer window...........
but i am not getting the value in print output...... I hav also tried to print &TOT_PRICE& in footer window still not getting the value....
may i know where is the problem???
what should i print in the footer window?
Edited by: Srikant Dada on May 10, 2011 7:11 AM
Hi,
You are declaring the variable TOT_PRICE in script and you are trying to print the value in variable &VALUE1& which is declared in the perform.
You need to print the value in TOT_PRICE variable in the SAP script inorder to get the total value in print out.
Also check that in which window you have defined the TOT_PRICE variable and calling the perform. Try to declare the TOT_PRICE variable in Footer window and call the perform statement with the relevant set of values available in the footer window to calculate the total and print TOT_PRICE
Regards,
Harish.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, where should we start...
Why define VALUE1 as STATICS when you use it as a variable for calculation?
Since you declared VALUE1 in your subroutine, this will be a local field that always gets cleared when you call the routine again, so this won't work for aggregation.
Also, the call doesn't match the definition of the subroutine... you have an internal table and two structures in the definition but you're passing two fields. So it's anybody's guess what the result will be.
What populates table int_cond? I'm not really sure what your logic tries to do...
The form has no idea about &VALUE1& so no wonder nothing prints when you try to output that.
Etc... etc...
Finally, just a guess here (it has been a while when I used to do SAPscript), but shouldn't you use
/: DEFINE &TOT_PRICE&
to define your variable?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check in DEBUG value1 has some value.I think it will be blank.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.