‎2009 Mar 17 4:54 AM
Hi all,
I have one problem below :
I am trying to take value of field vgw01, vgw02, vgw03 ,vgw04, vgw05, vgw06 of table PLPO into one variable.
Data Declaration of variable is like below:
DATA : v_vgw01_m_mstd(9) TYPE c,
after that i am doing v_vgw01_m_mstd = t_plpo-vgw01 and so on for all in different var.
but problem is if vgw01 is having value 4500
then in debug mode its coming 4,500.
and finally in my variable its coming like 4.5.
I want exact 4500 in my variable.
so please guide me.i tried data TYPE P DECIMALS 0, and TYPE VGWRT also. and checked with diff data type. but still problem is same. i used TRUNC also then its giving only value 4.
Thanks in advance,
Regards,
Sujeet
‎2009 Mar 17 4:58 AM
hi,
Declare a numeric variable instead of character type.
data:
v_vgw01_m_mstd(9) TYPE NThanks
Sharath
‎2009 Mar 17 5:26 AM
Hi,
My Question is why this 4500 coming in table as 4,500. and then in Debug mode 4.500.
its standard field value this is coming from PLPO-VGW02.
I have changed data declaration TYPE N.
but still problem is same.
in debug mode T_PLPO-VGW02 = 4.500 "instead of 4500
and if i do v_vgw01_m_mstd = T_PLPO-VGW02
then v_vgw01_m_mstd = 5
guide me.
‎2009 Mar 17 5:07 AM
Hi,
In table it is quan type,so declare it as type n.
DATA : v_vgw01_m_mstd(9) TYPE n.
So, u will get leading zeros in the variable,
while writing ,take it as
write: v_vgw01_m_mstd no-zero.
‎2009 Mar 17 5:13 AM
Hi,
You have to declare a numeric variable instead of char. Because it is quantity type.
So
DATA: v_vgw01_m_mstd(9) TYPE N.
Regards,
Jyothi CH.
‎2009 Mar 17 5:15 AM
‎2009 Mar 17 5:15 AM
‎2009 Mar 17 5:16 AM
Hi,
This is simple just declare the variable of type 'n' rather than c,it will gice you result as per your requireemnt moreoevr the length of the varibale should be same as defined in the table field.
Hope this might help you.
Pooja
‎2009 Mar 17 5:34 AM
Dear Pooja,
Thanks for reply.
I know this is simple but can you please once again read my above thread.
actually my problem is not to declare data. already i have written above that i have used these all.
please read above thread which i have written again in details.
thanks once again.
Regards,
Sujeet
‎2009 Mar 17 5:40 AM
hi,
The field you are specifying is quantity field which is of number type with 3 decimals.
So can you just verify in the data base table you are having the data i.e 4,500 instead of 4.500.
and about the "5" , since its a number with value 4.5 (decimal value >= 5) its being rounded off to nearest integer value, hence the value 5.
Thanks
sharath
‎2009 Mar 17 5:44 AM
Hi,
As all the table fields are QUAN type with decimal as 3 thats is why it is giving the value as with decimal and when you are assigning it to a char type it will give the vlaue with ',' symbol which is similar to '.'
If you assign the value of vgw01.....etc to a n type varible(which I have done ) it will display the result without any truncation or decimals.
code snippet attcahed below:
types:begin of itab,
vgw01 type plpo-vgw01,
end of itab.
data:it type standard table of itab with header line.
data: v_vgw01_m_mstd(9) TYPE i.
select single vgw01 from plpo into it.
v_vgw01_m_mstd = it-vgw01.
write:/ v_vgw01_m_mstd.Pooja
‎2009 Mar 17 5:46 AM
Hello Sharath.
thanks.
in database table value is reflecting like 4,500.actually this is the field which show the time duration in PP module.I have to convert these all value in hours based on unit.
4,500 is second,
some is in Minute
so in calculation i am getting problem.
tell me better ways to do this.
‎2009 Mar 17 5:59 AM
hi,
From your post what i understood is you are retrieving the value from VGW02 and checking against the unit of measure specified in the VGE03.
If it is so...
1) Use a CASE
when 'H.'
...
when 'MIN'
......
when 'SEC'.
....
ENDCASE inside the loop.
2) Check for VGE03 value if its a Hour or second use the conversion eg.
you have the value in the VGW02 as 3 and unit of measure is Hour (H).
Inside the case statement perform the appropriate conversion i.e 3 * 60 * 60 secs.else
if its a Minutes conversion would be .. 3 * 60.
Thanks
Sharath
‎2009 Mar 17 6:08 AM
Hi Sharath,
Thanks,
I did this.
But Problem is still with value 4500 second. its coming in internal table itself like 4.500 second.
this has value in PLPO Table like 4,500.
so can i convert this value same like 4500 when retrieving into internal table , which user entered?
thanks
‎2009 Mar 17 6:12 AM
Sujeet ,
Then why dont you assign the value read in the intrenal table to a local varibale of type n and use that local variable for your calculation, as you need to take the variable of type tablename-fieldname in the intrenal table to read the value form the table.
I have pasted the code above for the same.I guess that might have solved your problem?
Pooja
‎2009 Mar 17 6:15 AM
hi,
It would be more helpful, if you can paste the structure of the internal table you declared.
and also try with the statement,
set country 'US'.
just check it and let me know.
Thanks
Sharath
‎2009 Mar 17 6:27 AM
Hi Sharath,
data declaration is like below
data: BEGIN OF t_plpo OCCURS 0.
INCLUDE STRUCTURE plpo.
data: mitem like t_ausgabe-mitem,
END OF T_plpo.
Data:
v_vgw01_m_mstd TYPE I,
v_vgw01_s_mstd TYPE I.
my Coding where i am transferring data :
if t_plpo-lar01 = 'MSTD'.
if t_plpo-vge01 = 'MIN'.
v_vgw01_m_mstd = t_plpo-vgw01 * 60. " convert it into seconds
elseif t_plpo-vge01 = 'S'.
v_vgw01_s_mstd = t_plpo-vgw01. " if this is seconds then 4500 is coming like 4.5 in t_plpo-vgw01.
endif.
elseif t_plpo-lar01 = 'FSTD'.
if t_plpo-vge01 = 'MIN'.
v_vgw01_m_fstd = t_plpo-vgw01 * 60. " convert it into seconds
elseif t_plpo-vge01 = 'S'.
v_vgw01_s_fstd = t_plpo-vgw01.
endif.
endif.
Thanks
‎2009 Mar 17 6:17 AM
Hi Sujeet,
If you are displaying the data using ALV then pass the field name to cfieldname in fieldcatlog.
Regards,
Sathish
‎2009 Apr 03 4:42 AM