Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with removing decimal place while passing quantity field

former_member242512
Participant
0 Kudos

Hi All,

Im passing data to an internal table .

wa_xyz-qty =  wa_mbewh-lbkum.
append wa_xyz-qty to t_xyz.

I cannot use write statement using unit as both wa_xyz ant t_xyz refer to field of z table and having field qty type MENGE_D.

Please help me how to pass the qfieldname and qtabname to remove the decimal while passing data .

ex : 9.000 should display as 9 .

*      <fs_fieldcat>-qfieldname = ''.
*      <fs_fieldcat>-qtabname = ''.

Kindly please help.

1 ACCEPTED SOLUTION

deepak_dhamat
Active Contributor
0 Kudos

hi ,

PERFORM get_fieldcat USING 'BISMT' 'DIENO ' 12 'L' 'N' '000' 'N' 'N' 'N' 'N' 'N' 'N' 'Y'.

FORM get_fieldcat USING p_fieldname

p_txtname

p_length

p_justfy

p_keyfld

p_color

p_hotspt

p_total

p_sort

p_subtot

p_para1

p_zero

p_fix.

IF p_zero = 'Y'.

ms_fieldcat-no_zero = 'X'.

ENDIF.

regards

Deepak.

12 REPLIES 12

deepak_dhamat
Active Contributor
0 Kudos

hi ,

PERFORM get_fieldcat USING 'BISMT' 'DIENO ' 12 'L' 'N' '000' 'N' 'N' 'N' 'N' 'N' 'N' 'Y'.

FORM get_fieldcat USING p_fieldname

p_txtname

p_length

p_justfy

p_keyfld

p_color

p_hotspt

p_total

p_sort

p_subtot

p_para1

p_zero

p_fix.

IF p_zero = 'Y'.

ms_fieldcat-no_zero = 'X'.

ENDIF.

regards

Deepak.

0 Kudos

Hi,

Thanks for your reply. But its not working.

Kindly help.

0 Kudos

looks like Deepak set no zero to N, then checked for Y. Just set your no_zero to 'X' (ON). Or convert your output field to a char, set it = the decimal field, then split the character field at '.' into character field, lv_trash (another character field that you won't use). You could also use a type I field....or a P field with no decimals and adjust your value as needed.

0 Kudos

hi ,

PERFORM get_fieldcat USING 'BISMT' 'DIENO ' 12 'L' 'N' '000' 'N' 'N' 'N' 'N' 'N' 'Y' 'Y'.

FORM get_fieldcat USING p_fieldname

p_txtname

p_length

p_justfy

p_keyfld

p_color

p_hotspt

p_total

p_sort

p_subtot

p_para1

p_zero

p_fix.

IF p_zero = 'Y'.

ms_fieldcat-no_zero = 'X'.

ENDIF.

You can use like above code or SEt Directly no-zero = 'X' for fieldcat .

Regards

Deepak.

Former Member
0 Kudos

hi,

before moving value into qty field you will replace decimal with '0' and then use with shift right deleting trailing '0'. then you will move that value into your qty field. it you beleave every time you will get all decimal valuess are 0's.

Former Member
0 Kudos

Hi Ujjwal,

Try this logic!!!!

Just declare the field as type char15 or string. If you are using a quantity field, it is bound to return you '****.000' even if the value after decimal is initial. So just try with passing the value into char type variable.

(Note: before passing the value to the filed, dont forget to make modificationon field using split statement).

Hope this winfo will help you to resolve the issue & close the thread.

BR,

Vinit

former_member184578
Active Contributor
0 Kudos

Hi Ujwal,

By default QUAN datatype automatically gives 3 decimal places even if u suppress.

Try this,

if u are using slis field catalog

wa_fieldcat-datatype = 'DEC'.

wa_fieldcat-decimals_out = 0.

append wa_fieldcat to lt_fieldcat.

if u are using lvc field catalog.

wa_fieldcat-datatype = 'DEC'.

wa_fieldcat-decimals_o = 0.

append wa_fieldcat to lt_fieldcat.

hope this helps,

reply if u need some more clarifications,

Thanks & Regards

Kiran

0 Kudos

Hi,

I tried this logic but its not working.

Plz help.

0 Kudos

Hi Ujwal,

It will work., i tried this so many times., may be u missed some where., pls check once again.,

Thanks & Regards

Kiran

0 Kudos

Hi,

I have checked .... its correct but still i can see decimals line 9.000 instead of 9 .

May be there soem other issue.

I even tried to shift right and delete trailing 0 but finally we have to assign it to the field qunatiy which already contains 0.000 and makes it accordingly after assignment 9.000.

Plz help.

Edited by: ujjwal_d15 on Apr 18, 2011 4:13 PM

0 Kudos

Hi ujjwal,

Declare the Quantity Filed as

Weigh1 type p decimals 0,

it will suppress the decimal values while displaying.

it may help you.

Thanks and Regards,

Prakash K

0 Kudos

Guyz ,

There is strange thing.

The internal table t_xyz is populated first using a loop1.


loop1 .
wa_xyz-qty =  wa_mbewh-lbkum.
append wa_xyz-qty to t_xyz.
endloop

Now the qunatity fields come out tob as 3.000,

9.000 for its records.

Then there is loop next to above loop.


loop2 .
wa_xyz-qty =  wa_mbewh-lbkum.
append wa_xyz-qty to t_xyz.
endloop

Here the records gets populated as 3,6,89 and so on..

I have checked each and every fields both assigning fields are same.

But still there is difference in output.

I came to know actaully the issue is with the records .

But why it happens , its really strange.

Whether any one can help me in this issue.

Guyz your solutions are actually working for records of 2nd loop but not the first .

Thanks All , but any new solutions .

Kindly help.

Regards,