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

numeric field _append

naveen_inuganti2
Active Contributor
0 Likes
867

Hi all....

Iam having one internal table with five fields and 10 records...

Now iam going to add one more record to that internal table in my program by using append statement...

itab-f1 = ' '.

itab-f2 = ' '.

itab-f3 = ' '.

itab-f4 = 'india '.

itab-f5 = ' '.

append itab.clear itab.

with above syntax i have to get four spaces and one entry....

but i am getting 0 for the last field, which is the numeric field...

how to avoid that zero...

there is no chanse to change numeric as char or others....because it is database table field using in some other reports and in other conditions in this reoprt also....

and

one more thing is iam dispalying this internal table by using table control, not with normal reporting!!!!

thank you,

naveen.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
850

Hi Naveen,

Assign the value to a field-symbol as following:

data: num type n.

num = itab-f5.

field-symbols: <fs> type any.

assign num to <fs> casting type c.

if <fs> is assigned.

clear <fs>.

write:/ <fs>.

endif.

Copy paste the program in a test program and check the output. Also check the value of <fs> after getting assigned and then after clearing it.

Thank you.

Reward points if found useful

7 REPLIES 7
Read only

Former Member
0 Likes
850

Please try this....

itab-f1 = ' '.

itab-f2 = ' '.

itab-f3 = ' '.

itab-f4 = 'india '.

append itab.clear itab.

Read only

0 Likes
850

Hi...

Then it was going to disply previous value of the f5 field....

Thank you,

Naveen

Read only

Former Member
0 Likes
850

What you can do to avoid displaying the zero is write like below

Write: / ITAB-F5 no zero.

reward if helpful

Read only

0 Likes
850

Hi... Iam not displaying using write statement...with table control iam doing this....ok!!

Thank you, naveen

Read only

0 Likes
850

The only way I know of to make the field not show as "0" is to have it as type CHAR. Unless I'm missing something, this is how it is in SAP. You can get around this if you are willing to do some extra coding, moving the values from CHAR CURR and handling the negative sign.

regards,

Ashish

Read only

Former Member
0 Likes
851

Hi Naveen,

Assign the value to a field-symbol as following:

data: num type n.

num = itab-f5.

field-symbols: <fs> type any.

assign num to <fs> casting type c.

if <fs> is assigned.

clear <fs>.

write:/ <fs>.

endif.

Copy paste the program in a test program and check the output. Also check the value of <fs> after getting assigned and then after clearing it.

Thank you.

Reward points if found useful

Read only

Former Member
0 Likes
850

Hi,

I tested as you specified but no zero displaying for me in the table control.

And also try to change the type in the screen painter for that last field in the table control (like NUMC).

Regards,

Raghu