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: 

NULL value in a 'Z' field of a 'Z' table

Former Member
0 Kudos

Hi All,

There is a 'Z' field with data type 'TIMS' in a 'Z' table.

While the value in this respective field is read in a program, it is observed that in records with no value in this

field a blank value(space), which is a NULL(undefiend) value for the respective data type, is being read.

Usually when there is no value in a field, the initial value specific to the data type of the field is expected to be

fetched and in this case the value '000000' is expected.

While analyzing the reason for the above deviation, the finding was the 'NOT NULL' property for the respective field

would not have been set.

Other related findings at this point were,

-> whenever a table is created the 'NOT NULL' property would be set for all the fields,

-> when new fields are added to an existing table, the 'NOT NULL' property should be explicitly set for the

    newly added fields by checking the 'Initial Values'(next to 'Key') flag. Only then initial values will be populated in these

    newly added fields in the existing records, else would be populated with a null value

-> The menu path, Utilities -> Database Object -> Display, (in Dictionary : Display Table screen) contain the 'Not null'

    property for all the fields of this table.

As a coincidence, on getting into the menu path mentioned above, for the 'Z' table in discussion, it is found the 'NOT NULL'

property of the respective 'Z' field is not set.

Upon this, concluded that setting the 'NOT NULL' property would resolve the issue but there is another 'Z' field with data type

'DATS' and the 'NOT NULL' property is not set for this field as well, but in records with no value in this field the respective initial

value '00000000' is being read in the program. This remains as a question.

The above analysis is done in the DEV server, when cross checked in QAS observed the follwing things and certain

points would even appear out of scope :

-> it is found the 'NOT NULL' property is set for all the fields of the 'Z' table in discussion. How could there be such a difference

   across servers ? An input received regarding this, that would appear out of scope of the current discussion 

   is SE14->Activate and Adjust Database is performed in the respective server instead of being transported.

   While being unconvinced of the above input, the system behaviour is exactly the same in QAS server as well.

   Even while the 'NOT NULL' property is set, only 'NULL' value is being read in the program for the 'Z' field with data type

   'TIMS' and '00000000' for the 'Z' field with data type 'DATS'. An odd observation is, in DEV while viewing table contents

   the 'Z' field with data type TIMS is blank, whereas in QAS it contained  '  :  :  ' and this too while viewed in one user's session

   and only blank in another user's session. All such things have left questions which would be even out of scope for the discussion.

In DEV, gave a try by setting the 'NOT NULL' property for the two 'Z' fields, activated the table and executed the program,

even then the system behaviour remains as it is.

Actually, even when 'NULL' value is being read from the respective 'Z' field in the program, which is an RFC enabled FM things go fine

at SAP but at the target Java based WAS portal an exception is raised.

At ABAP end, the issue could be resolved by writting a conditional code as,

IF 'Ztable- Zfield' <> ' '.

  gv_zfield = Ztable-Zfield.

ELSE.

  gv_field = '000000'.

ENDIF.

Since this is not the proper approach, looking for a straight solution which should fetch initial values for the respective 'Z' field

instead of NULL values.

Awaiting for your solution...

Thanks & Regards,

M.LAXMANAN

5 REPLIES 5

Former Member
0 Kudos

Hi ,

Can you please provie a brief snapshot of Z table structure in SE11 . If not then what are the data elements used for each field .

Also if no data elements have been used , then what are the predefined types used .

Kindly indicate which field is the one in discussion which is showing NULL inspite of INITIAL VALUES checkbox ticked .

Regards,

Hemant

0 Kudos

Hi Hemant,

The 'Z' field is connected with a 'Z' data element, which in turn is connected with the standard domain UZEIT.

The other 'Z' field, with data type DATS and the one that works properly, is connected with a 'Z' data elemen, which in turn is connected with the standard domain DATUM.

Also, after setting the 'Initial Values' and seeing no change in the system behaviour, reverted the set property, but even after that in Utilities->Database Object->Display the property 'NOT NULL' remains as set for the fields discussed.

Thanks & Regards,

M.LAXMANAN

0 Kudos

Hello Laxmanan,

When ever you add and additional field to the exitising table structure,make sure you mark the flag "initial values" check box.And later makeit compulsory to adjust the database.

Regards,

Varun

0 Kudos

Hi Varun,

The additional fields were not added by me. Anyhow, as said in the initial post, gave a try by setting the 'Initial Values' flag for the respective fields but even then the system behaviour is as such.

Thanks & Regards,

M.LAXMANAN

0 Kudos

Did you try adjusting the database????