2007 Dec 20 1:16 PM
hi experts,
while printing salesorder i am using a temporrary variable to print the total .if there is two line items it will total and print the qty in the total column .
while seeing preview the total is coming properly .but when we take a print out the value is doubling up .only if we go out of the tcode and enter again it is coming properl;y.
what shall i do for this..
regards,
mani
hi experts,
while printing salesorder i am using a temporrary variable to print the total .if there is two line items it will total and print the qty in the total column .
while seeing preview the total is coming properly .but when we take a print out the value is doubling up .only if we go out of the tcode and enter again it is coming properl;y.
what shall i do for this..
regards,
mani
2007 Dec 20 1:18 PM
hi Mani,
you have to CLEAR the variable, either before the first line item, or right after it is printed out.
hope this helps
ec
2007 Dec 20 1:20 PM
Hi,
you must clear variable before you start loop to add all line item amount.
2007 Dec 20 1:23 PM
Hi,
just, CLEAR that temporary variable whenever you press the PRINT button.
As you said when you press PRINT the value is doubling. hence, CLEAR that variable once you press the button PRINT.
hope this helps.
2007 Dec 20 1:24 PM
Hi,
Just before using loop for adding quantities you just clear : v_total.
sometimes it will get cumulated to previous qty.
you just put clear if you are using nested loops means use inside the outer loop..
Regds
Sivaparvathi
Please reward points if helpful...
2007 Dec 20 1:29 PM
thanx for all ur replies.
i am using script tp print the document .
in script i am using perform statement .
so for every line item it calls the program and the progarm sends back the result .
where shall i insert the clear statement ..
if i use it inside the loop only the final value will be stored .the first value will be cleared ..
2007 Dec 20 1:31 PM
Hi,
Before the ENDFORM statement Initialize the variable. I.e Clear <variable>.
- Selva
2007 Dec 20 1:45 PM
2007 Dec 20 1:48 PM
Otherwise whereever u are filling the variable, before that u clear the variable.
- S
2007 Dec 20 1:49 PM
Hi Mani,
could you send us only that part of code where your are looping and getting the total amount in that variable??
2007 Dec 20 2:07 PM
i am not looping it .i am using perform statement .so according to number of line items it will come to the program .
conside there are two line items.
first time it will come to the program .(weight is 10 kgs )
tot = tot + qty.
so tot will be 10 nmow .
secong time it will come to the progarm ( now weight is 20 kgs).
tot = tot + qty.
now tot will be 10 + 20 = 30.
now the output is beeing preiviewed.
it is 30 now .
but when i print the report the tot is now 60 ..
this is my problem .
if use clear at the beginning of the program then .the first item weight will be cleared only second item weight will be in tot .
this is the case .
hope i am clear.
2007 Dec 20 2:14 PM
Hi,
then take another variable call
data: d_total(5).
at the end when final total has been done store that value into d_total.
ie, d_total = total.
and now, Clear: total.
so, now print the SAP script with this variable.
hope this helps.
2007 Dec 20 5:56 PM
Could you please upload the code? for looking the error.
thanks
2007 Dec 21 5:44 AM
FORM SOprice TABLES intab
STRUCTURE itcsy outtab
STRUCTURE itcsy.
clear :t1.
READ TABLE intab INDEX 1.
gknumv = intab-value.
READ TABLE intab INDEX 2.
gkposn = intab-value.
READ TABLE intab INDEX 3.
l_char = intab-value.
l_char1 = l_char.
REPLACE FIRST OCCURRENCE of ',' in l_char1 with ' '.
gmeng = l_char1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gknumv
IMPORTING
output = gknumv.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gkposn
IMPORTING
output = gkposn.
select mwsk1 KSCHL from konv into (mwsk1 , KSCHL) where knumv eq gknumv AND KSCHL EQ 'JIN6'.
ENDSELECT.
select mwsk1 KSCHL from konv into (mwsk1 , KSCHL) where knumv eq gknumv AND KSCHL EQ 'JIN7'.
ENDSELECT.
CASE MWSK1.
WHEN 'A0'.
TAX = 'NIL'.
WHEN 'A1'.
TAX = '4%'.
WHEN 'A2'.
TAX = '3%'.
WHEN 'A3'.
TAX = 'NIL'.
WHEN 'A4'.
TAX = '8%(CST)'.
WHEN 'A6'.
TAX = 'NIL'.
ENDCASE.
SELECT VBELN FROM VBAK INTO I_VBELN WHERE KNUMV EQ gknumv.
ENDSELECT.
SELECT IHREZ_E FROM VBKD INTO TEXT WHERE VBELN EQ I_VBELN AND POSNR NE '000000'.
ENDSELECT.
SELECT AUART FROM VBAK INTO AUART WHERE VBELN EQ I_VBELN.
ENDSELECT.
IF AUART EQ 'YOR' OR AUART EQ 'YTS' OR AUART EQ 'YRE' OR AUART EQ 'YKA' OR AUART EQ 'YKB'
OR AUART EQ 'YKE' OR AUART EQ 'YKR'.
SELECT kawrt kwert FROM konv INTO (gkawrt , gkwert) WHERE knumv = gknumv AND kposn = gkposn AND kschl = 'JIN6'.
ENDSELECT.
gfinal = gkawrt + gkwert.
tmeng = tmeng + gmeng.
tqty = tmeng.
select kBETR from konv into t1 where knumv = gknumv and kposn = gkposn and kschl eq 'PR00'.
ENDSELECT.
PRICE = T1.
elseif auart eq 'ZCV'.
tmeng = tmeng + gmeng.
tqty = tmeng.
select kBETR from konv into t1 where knumv = gknumv and kposn = gkposn and kschl eq 'JASS'.
ENDSELECT.
SELECT kawrt FROM konv INTO gkawrt WHERE knumv = gknumv AND kposn = gkposn AND kschl = 'JIN6'.
ENDSELECT.
SELECT kawrt FROM konv INTO gkawrt WHERE knumv = gknumv AND kposn = gkposn AND kschl = 'JIN7'.
ENDSELECT.
dPRICE = GKAWRT / gmeng.
PRICE = T1 + DPRICE.
ELSE.
tmeng = tmeng + gmeng.
tqty = tmeng.
SELECT kawrt FROM konv INTO gkawrt WHERE knumv = gknumv AND kposn = gkposn AND kschl = 'JIN6'.
ENDSELECT.
SELECT kawrt FROM konv INTO gkawrt WHERE knumv = gknumv AND kposn = gkposn AND kschl = 'JIN7'.
ENDSELECT.
dPRICE = GKAWRT / gmeng.
price = dprice.
ENDIF.
READ TABLE outtab INDEX 1.
MOVE price TO outtab-value.
MODIFY outtab INDEX 1.
READ TABLE outtab INDEX 2.
MOVE tqty TO outtab-value.
MODIFY outtab INDEX 2.
READ TABLE outtab INDEX 3.
MOVE tAX TO outtab-value.
MODIFY outtab INDEX 3.
READ TABLE outtab INDEX 4.
MOVE TEXT TO outtab-value.
MODIFY outtab INDEX 4.
READ TABLE outtab INDEX 5.
MOVE price1 TO outtab-value.
MODIFY outtab INDEX 5.
ENDFORM. "price
in this code when seeing preview value is coming properly but whn i go for print by using back tab .the temp value tmeng,tqty remains uncleared and the value is doubling .Mainly if tmeng is cleared the code will work properly .
but i cant put clear inside the program bcoz the subroutine will be called as many times eq to line items .so only the final line items weight will be stored in tot..
what to do ?
ragrds,
mani
2007 Dec 21 9:52 AM
hi Mani,
use clear statement.Ur problem will be solved.U Have to place clear Statement at correct place.Check it once.
whenever u print the " TMENG,TQTY",After u print these values the below statemenr u have to use is
clear : TMENG, TQTY.
check it once.
Award points if helpful.
kiran kumar.G
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |