lehiester
lehiester

Reputation: 900

Do QUAN fields in SAP allow storing blank/null values?

Does a QUAN field allow null/blank values to be stored? Or must a number be stored in it at all times?

Not asking whether the default value can be displayed as blank, but whether a blank/null value can be stored in a QUAN field in a way that can be distinguished from the default value, e.g. if the default value is zero. It's stored in BCD, so it hypothetically could encode non-numeric values if SAP allows it.

Upvotes: 2

Views: 427

Answers (2)

Sandra Rossi
Sandra Rossi

Reputation: 13656

There are two completely different BCD, so maybe you are confusing them:

  • BCD format used by SAP internally for ABAP packed variables (of type P), and which corresponds to ABAP Dictionary types QUAN, CURR or DEC
  • character-encoding BCD format.

So, the answer is no, BCD-packed fields may encode only digits 0 to 9 and sign (and the position of the decimal point is defined by its associated type).

References:

Upvotes: 3

Jonas Wilms
Jonas Wilms

Reputation: 138457

You are assuming that the concept of nullability exists in ABAP - it does not. In many occasions one can store such a "null value" in place by choosing an initial value that can be distinguished from a "non null" value (i.e. 0 if values of range [1,…) are expected). If that is not the case, an additional field is needed to store the null.

The underlying database however does have a concept of nullability and one can evaluate the IS NULL predicate inside database queries, and great care must be taken when reading nullable values from the database as those are replaced with the initial value.

Another loosely related concept are unbound references - references that are not bound are somewhat a null value (thus REF TO p would be a semantically sound way to represent a nullable fixed point, but you probably don‘t want to spend the cost of heap allocations).

Upvotes: 4

Related Questions