on 2007 May 02 7:12 AM
Hello Friends,
I am using table J_1IEXCDTL for my report and in my report I am calculating Net price for a unit quantity by doing
net_price = J_1IEXCDTL-EXBAS / J_1IEXCDTL-MENGE.
for eg. my value for <b>J_1IEXCDTL-EXBAS is 7129.80 and for
J_1IEXCDTL-MENGE is 5.000</b>
then i shud get a value for my variable net_price = <b>1425.96</b> which is i m not getting instead of that value i m getting <b>1.43</b> only so how do i do it as it is showing me wrong values.
regds,
pritesh
hi
good
check the calculation first using the debugging that what value J_1IEXCDTL-EXBAS and J_1IEXCDTL-MENGE before storing the final value in net_price.
There must be some problem in the calculation.
thanks
mrutyun^
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Friends thanks for replying to my question but my problem has not been solved yet. I have declared
data: net_price type TYPE p decimals 2. and did the calculation
net_price = J_1IEXCDTL-EXBAS / J_1IEXCDTL-MENGE.
still net_price = 1.43
then i changed my declaration as below
data: net_price type TYPE J_1IEXCDTL-EXBAS.
Still the net_price = 1.43
pls help.
pritesh
hello agarwal,
i am not sure what the problem is, i wrote the same sample program and getting the right answer, are the input values correct. i used the same values you told. completly delete the program lines and write it once again(some times there may be junk characters when you cut and paste)
Thanks
raju N
i dont know what u are doing, i am getting this .
Testing
Gross = 7.129,80 Qty = 5,000 Net = 1.425,96
my code is
<b>REPORT ZPRABHU .
data: gross like J_1IEXCDTL-EXBAS,
qty like J_1IEXCDTL-menge,
net like bseg-dmbtr.
gross = '7129.80'.
qty = '5.000'.
net = gross / qty.
write:/ 'Gross = ', gross,
'Qty = ' , qty,
'Net = ' , net.</b>
Regards
Prabhu
ok than, i any case there should be very simple problem. did you look at the code i gave you, just create a sample report and check it. if you think its giving a right result, check with you debugging in your program whether the values you are imagining are in action at the time(may be some problem with header, table) like that.
Thanks
raju N
Hi raju ,
I am afraid but my code is not giving desired o/p.
My code is
data: gross like J_1IEXCDTL-EXBAS,
qty like J_1IEXCDTL-menge,
net like bseg-dmbtr.
LOOP AT TJ_1IEXCDTL INTO J_1IEXCDTL.
write the item details
gross = J_1IEXCDTL-EXBAS.
qty = J_1IEXCDTL-MENGE.
net = gross / qty.
ENDLOOP.
SO TELL ME IS THERE ANY MISTAKE.
PRITESH
PA ,
in Debug more any body can easly find out that values these fields having ?
y u are wasting out time , this is first time i am opening a new thread more than twice.
have u check trhe field definations of thse table ?
<b>TJ_1IEXCDTL , J_1IEXCDTL.</b>.
first ccheck and debug at ur end.
Regards
Prabhu
ok fine, your program gets the net value for the last record in the internal table.
As you are looping through and moving the date in net value gets on changing and values for the final loop remains.
you need to keep appending the values to new internal table or to the same table
before the endloop. so you can have net value for all the entries in table
And also check with the structure of your internal tables if you are updating net value is should be of same type as of net.
thanks
raju N
Message was edited by:
krishnam Raju N
raju let me clear the things to u first.
I am printing excise invoice thro sap scripts.
here is my declaration
DATA: BEGIN OF TJ_1IEXCDTL OCCURS 30.
INCLUDE STRUCTURE J_1IEXCDTL.
DATA: END OF TJ_1IEXCDTL..
data: gross like J_1IEXCDTL-EXBAS,
qty like J_1IEXCDTL-menge,
net like bseg-dmbtr.
data fetching done in between.
.
.
.
.
.
SORT TJ_1IEXCDTL.
LOOP AT TJ_1IEXCDTL INTO J_1IEXCDTL.
gross = J_1IEXCDTL-EXBAS.
qty = J_1IEXCDTL-MENGE.
net = gross / qty.
endloop.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TOTALS'
WINDOW = 'TOTAL'
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
this is how my code goes. Now i debugged it and got the values as follows
gross = 7129.80
qty = 5.000
net = 1.43
Now please tell me what field defination need i check?
Pritesh
ok man, where are updating the values you got from net value. you are doing an loop than endloop. you are not updating any values. check you internal table and tell me the vaue of qty and gross for the last entry,
Do remember i want the values for the last record of the internal table after they are sorted.
and also check if fixed arthimetic is checked in attributs as prem said, my will be checked always as default.
Thanks
raju N
Message was edited by:
krishnam Raju N
Message was edited by:
krishnam Raju N
netprice type p decimals 3
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Obviously the result you are getting is 7129.80 divided by 5000 which is 1.42596 rounded off to 1.43.
To solve this :
Declare a variable of the same type as J_1IEXCDTL-EXBAS .
Move MENGE to this variable.
Now do the division with variables of the same type.
Hope this helps you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
declare ur variable as below..
<b>data:
net_price type p decimals 2.</b>
net_price = J_1IEXCDTL-EXBAS / J_1IEXCDTL-MENGE.
write: net_price.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What type have to taken net price as.... please check the variable ... chnage it to p(pack) and you will get the right value....
Hope that helps..
Regards,
Jayant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello agarwal,
check with the variable type you declared, make sure that it would of type menge.
Thanks
raju N
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
9 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.