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: 

How to clear initial value of PACKED (P) ABAP type

Former Member
0 Kudos

hi Gurus,

here i am giving one example

CLEAR : itab1-posnr,

itab1-matnr,

itab1-arktx,

itab1-kwmeng.

this statement Resets the contents of fields to its initial value.

i.e posnr is of type char and it is set to SPACE(blank)

matnr is of type char and it is set to SPACE(blank)

arktx is of type char and it is set to SPACE(blank)

kwmeng is of type packed and it is set to 0.000 as it is INITIAL value.

now when i am trying to ommit this 0.000 in order to get only space in the output using following code

if itab1-kwmeng is initial.

itab1-kwmeng = ' '.

endif.

APPEND itab1 TO itab3 .

it is showing the initial value 0.000 again

so i want to know what code/statement i shall use to remove initial value of PACKED (P) ABAP type in the output

1 ACCEPTED SOLUTION

Former Member
0 Kudos
data : begin of it occurs 0 ,
       fkimg like lips-lfimg,
       text(2) type c,
       end of it.

data : begin of wt  occurs 0 ,
       fkimg(2) type c,
       text(2) type c,
      end of wt.

data rt(20) type c.

it-fkimg = 1.it-text = 'A'.append it.
it-fkimg = 2.it-text = 'b'.append it.
it-fkimg = 3.it-text = 'c'.append it.
it-fkimg = 4.it-text = 'd'.append it.
it-fkimg = 5.it-text = 'e'.append it.
it-fkimg = 0.it-text = 'f'.append it.
it-fkimg = 0.it-text = 'g'.append it.
it-fkimg = 0.it-text = 'h'.append it.

loop at it.

write:/ it-fkimg , it-text.
endloop.
uline.

loop at it where fkimg = space.

wt-fkimg = ''.
wt-text  = it-text.
append wt.
clear : wt,rt.
endloop.

loop at wt.

write:/10 wt-fkimg ,50 wt-text.
endloop.

hope this helps

3 REPLIES 3

Former Member
0 Kudos
data : begin of it occurs 0 ,
       fkimg like lips-lfimg,
       text(2) type c,
       end of it.

data : begin of wt  occurs 0 ,
       fkimg(2) type c,
       text(2) type c,
      end of wt.

data rt(20) type c.

it-fkimg = 1.it-text = 'A'.append it.
it-fkimg = 2.it-text = 'b'.append it.
it-fkimg = 3.it-text = 'c'.append it.
it-fkimg = 4.it-text = 'd'.append it.
it-fkimg = 5.it-text = 'e'.append it.
it-fkimg = 0.it-text = 'f'.append it.
it-fkimg = 0.it-text = 'g'.append it.
it-fkimg = 0.it-text = 'h'.append it.

loop at it.

write:/ it-fkimg , it-text.
endloop.
uline.

loop at it where fkimg = space.

wt-fkimg = ''.
wt-text  = it-text.
append wt.
clear : wt,rt.
endloop.

loop at wt.

write:/10 wt-fkimg ,50 wt-text.
endloop.

hope this helps

Former Member
0 Kudos

Hi,

when using write statement

write : itab-kwmeng no-zeros.

Regards,

V.Balaji

Reward if Usefull...

Former Member
0 Kudos

use no-zero with write statement