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: 

a field of type I is showing Zero in display mode

Former Member
0 Kudos
1,797

Hi,

I have module pool program, with create, change and display buttons.

Here I have a field PERNR type PERNR_D.

This field is not a mandatory field. so, I am creating a record without entering any value in this.

But when I go into display for this record, it is showing '0'.

How to remove single zero in display mode?

I tried with the following code but it is not working for me.

if zstruct-zpernr eq '00000000'.

write zstruct-zpernr to zstruct-zpernr no-zero.

endif.

Please advise me here

6 REPLIES 6

Former Member
0 Kudos
357

Hi:

It has NUMC - Character string with only digits so it shows 0 in the case of empty.

Just declare it by CHAR08 and move the value when it requires.

Regards

Shashi

0 Kudos
357

but,

Here the field should accept only numbers or numerical values.

If i diclare this as char08, this may cause user to enter other than numbers..

is there any other suggestions?

Former Member
0 Kudos
357

PERNR_D is a data element of type NUMC, its default value is 0, but not the default value SPACE of CHAR. So you always get 0 in your table or internal table.

When you output the field to screen using WRITE or in a Table Control or ALV, you can omit 0 by using NO-ZERO or certain parameters.

peter_ruiz2
Active Contributor
0 Kudos
357

hi chitra,

use this code to remove records with '0' PERNR.

DELETE itab WHERE pernr IS INITIAL.

regards,

Peter

Former Member
0 Kudos
357

Hi,

try this.

if zstruct-zpernr CO '0'.

write zstruct-zpernr to zstruct-zpernr no-zero.

endif.

Or if u want to use char08 ,then give validation.

if zstruct-zpernr CO '0123456789'.

write code.

else.

message 'Do not enter characters' type 'E' display like 'S'.

endif.

0 Kudos
357

I tried all the ways except using char08.

as permy spec, I should not use this type.

So,

I tried to remove '0' by using the following code.but it is giving error as follows.

Please help me

Code:

if Zstruct-zpernr CO '0'.

  • if ( Zstruct-zpernr eq '00000000' ) or (Zstruct-zpernr is initial ).

write Zstruct-zpernr to Zstruct-zpernr no-zero.

endif.

error log:

Value is not numeric

Message no. E2135

Diagnosis

A value that is not numeric has been entered for a domain with a numeric data type. This is not allowed.

System Response

The system cannot accept the value.

Procedure

Correct your entry. You must enter a numeric value.