Skip to Content
0
K P
Jun 03, 2011 at 12:59 AM

adding type c fields

37 Views

Hi ,

I have added two character fields by removing ',' from them.

After adding i want now the ',' back . snippet of code written

ls_num_1 TYPE c LENGTH 32,"P DECIMALS 2,"LENGTH 32,

ls_num_2 TYPE c LENGTH 32,

ls_num_3 TYPE c LENGTH 32,

ls_str_amt TYPE c LENGTH 32,

ls_dec_amt TYPE c LENGTH 32,

ls_str_amt_final TYPE c length 32

.

ls_num_1 = ls_price_form_data-column2.

ls_num_2 = ls_price_form_data-column3.

  • Remove commas to be able to add the numbers

replace ',' in ls_num_1 with ''.

replace ',' in ls_num_2 with ''.

ls_str_amt = ls_num_1 + ls_num_2.

ls_dec_amt = ls_str_amt.

write ls_dec_amt to ls_str_amt.

  • Right-justify the string

shift ls_str_amt right deleting trailing space.

ls_price_form_data-column4 = ls_str_amt.

I want to print in smart form by adding ','. Tried to move to type p but did not work.

any suggestions to get back the ',' into numbers.

thanks,

Kamala