Application Development and Automation 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: 
Read only

convert char to quantity

Former Member
0 Likes
2,773

Hi there,

Do you know if there's any standard function module which converts a char into a field of type quantity? or, if there isn't any, do you know if it is possible to show in a table control field the value 0,000 when no quantity is introduced by the user and the field is set as modificable and as field of type quan instead of char?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,661

I think there is no function module and declare ur table control internal table field as Char(quantity ),if ur quantity field is initial.

fill the 0,000.

endif.

That is best option

Thanks

Seshu

I think there is no function module and declare ur table control internal table field as Char(quantity ),if ur quantity field is initial.

fill the 0,000.

endif.

That is best option

Thanks

Seshu

7 REPLIES 7
Read only

Former Member
0 Likes
1,661

I think there is no function module and declare ur table control internal table field as Char(quantity ),if ur quantity field is initial.

fill the 0,000.

endif.

That is best option

Thanks

Seshu

Read only

Former Member
0 Likes
1,662

I think there is no function module and declare ur table control internal table field as Char(quantity ),if ur quantity field is initial.

fill the 0,000.

endif.

That is best option

Thanks

Seshu

Read only

monalisa_biswal
Contributor
0 Likes
1,661

Try Using this function module CHAR_NUMC_CONVERSION.It also works for quan type.

Read only

0 Likes
1,661

I think that this one only works to convert a char into numc, you cannot get a number of quantity type by executing this function module.

Read only

Former Member
0 Likes
1,661

FUNCTION Z_CONV_POINT_TO_COMMA.

*"----


""Local interface:

*" IMPORTING

*" VALUE(NUM1)

*" EXPORTING

*" VALUE(STR1)

*"----


data:i type i,

length type i,

stest(16),

sakt(1).

stest = num1.

length = strlen( stest ).

while i < length.

sakt = stest(1).

if sakt = '.'.

sakt = ','.

endif.

shift stest.

concatenate str1 sakt into str1.

i = i + 1.

endwhile.

ENDFUNCTION.

Read only

0 Likes
1,661

Thanks for your code, but I was just looking for one standard to avoid building a new specific function module for that purpose.

Read only

Former Member
0 Likes
1,661

hi there,

define a field of type numc (or int or whatever u wish to) say FIELD2 in your internal table.

add following lines after the select query.

loop at itab.

move itab-FIELD1 to itab-FIELD2.

modify itab.

endloop.

here FIELD1 is of type char.

and FIELD2 is numc type.

itab is ur internal table.

hope this helps.

if u stil have doubts let me know.

Regards,

Roshani