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

entering zero in database table

Former Member
0 Likes
1,847

Hello Everyone,

i have one field in my database table , of type NUMC length 1.

It can have value either 0 or 1.

while creating entries, i enter 0 or 1.

when i see all table entries, it show blank instead of 0.

why is this happening.

is there any solution for this.

thanks

please help

1 ACCEPTED SOLUTION
Read only

manuel_bassani
Contributor
0 Likes
1,591

Hi,

when printing numc on screen the system trim the leading '0'. (there is a '0' but you can't see it)

If you want to see the '0' with se16 you can use CHAR instead (define a domain with '1' and '0' as valid values)

Regards, Manuel

please reward some points if this answer helps you.

10 REPLIES 10
Read only

manuel_bassani
Contributor
0 Likes
1,592

Hi,

when printing numc on screen the system trim the leading '0'. (there is a '0' but you can't see it)

If you want to see the '0' with se16 you can use CHAR instead (define a domain with '1' and '0' as valid values)

Regards, Manuel

please reward some points if this answer helps you.

Read only

0 Likes
1,591

Don't worry, it is 0 in the database. External formatting is presenting it as " ", in the db it is "0".

Regards,

Rich Heilman

Read only

0 Likes
1,591

when i see these contents in se11, i see zero , why

also if i download these using gui_download, i see zero

please advice,

Manuel i can't get what you mean by

define a domain with '1' and '0' as valid values)

thanks

Read only

0 Likes
1,591

Hi

depend on how you move the field to internal table for downloading.

If you use MOVE, the system don't use any input/output conversion routines, but if you use WRITE the system use it.

So if you have ZMY_TABLE-FIELD = 0.

If you do:

MOVE ZMY_TABLE-FIELD TO ITAB-FIELD => ITAB-FIELD = 0.

OR

ITAB-FIELD = ZMY_TABLE-FIELD => ITAB-FIELD = 0.

but

WRITE ZMY_TABLE-FIELD TO ITAB-FIELD => ITAB-FIELD = SPACE

Max

Message was edited by: max bianchi

Read only

0 Likes
1,591

you could define a domain in SE11 (domains specify the valid values of your field).

1. Define a new domain (type CHAR) with only '0' and '1' as valid values

2. define your field with reference to the domain you have created.

Now you have a CHAR value (instead of NUMC) that accepts only '0' and '1'. And will never be converted to space.

Manuel

Read only

0 Likes
1,591

Hi Manuel ,

i got you.

so as per above suggestions i should define it as CHAR

sure i will try that , and get back

thanks a lot

Read only

0 Likes
1,591

Hello Max

i what does symbol => refer in

WRITE ZMY_TABLE-FIELD TO ITAB-FIELD => ITAB-FIELD = SPACE

thanks for this suggestion

i didn't know this earliear

thanks

Read only

0 Likes
1,591

Hi

=> is only mathematic symbol and it means THEN, I usually use it, excuse me.

Anyway you do only:

WRITE ZMY_TABLE-FIELD TO ITAB-FIELD.

Now the value of ITAB-FIELD is space.

Max

Message was edited by: max bianchi

Read only

Former Member
0 Likes
1,591

Hi

The type N has a convertion routine that replace the zero (at the left of last number) with space.

So if you have a field type N long 5 chars and its value is 00010, you show 10, and if it's 00000 you show space.

So you should use a field type C and not type N, if you want to see the 0 when value is 0.

Max

Read only

andreas_mann3
Active Contributor
0 Likes
1,591

hi,

show your table with se16 :

1) with alv-grid

2) with abap-list

differences ?

i think , it's only the diff. formatting and representation

Andreas