1

Eventually I came across surprising fact that internal ABAP Dictionary types for currency and quantity (data elements based on them) implicitly save sign information no matter what setting have been set in data element domain.

enter image description here

Even with the above domain the data element preserves sign in ALV. Can we prevent ALV (or ABAP) from such behavior?
I thoroughly read documentation about both CURR and QUAN but found no single word about sign. Can somebody explain this?

The only solution I ended with was to use DEC type and data-elements based on DEC.

ADDITION: simple test to check the described issue
1. Create three variables of types BNOMS (domain BWHR), MATQUAN (domain MENG10) and MENGEP (domain MENGEP). All these types are standard DDIC types with unchecked sign field in domain.
2. Assign a negative value to them
3. Output them to ALV

As BNOMS and MATQUAN types are CURR and QUAN types, they will output the sign anyways whereas MENGEP will not, as it has DEC type. In the run-time all they preserve sign however in ALV DEC-type domain restrictions are respected, so I tend to think it's more ALV-related issue.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Suncatcher
  • 10,355
  • 10
  • 52
  • 90

1 Answers1

0

Be aware that there are two distinct type systems in the ABAP stack - the dictionary types like CHAR, NUMC, DEC and QUAN which are used for structures and especially database definitions, and the ABAP types used at runtime. The type mapping is explained in detail in the documentation.

It is important to note that at runtime ("in the debugger"), only ABAP types exist. Any restrictions placed onto a data element via the domain that can not be translated into a corresponding ABAP type definition (like, case-sensitivity/-insensitivity or the signed/unsigned flag) are simply ignored. You can easily define a variable based on the domain CHAR1_X which has the fixed values 'X' and ' '. Since that translates to a simple TYPE C LENGTH 1 in ABAP, it is equally easy to then assign a lowercase x, a U or - on a unicode system - .

vwegert
  • 18,371
  • 3
  • 37
  • 55
  • I am perfectly aware about distinction between ABAP/DDIC types and explicitly specified DDIC in title. We know the corresponding internal representation for CURR and QUAN is ABAP type **P**, however DEC type corresponds to **P** type too, and it perfectly bears the sign information. – Suncatcher Jan 16 '17 at 08:45
  • When we create variable from DEC-based domain with disabled sign the system respects this fact. So your assumption about ignored restrictions between ABAP and DDIC types is not completely true. – Suncatcher Jan 16 '17 at 08:48
  • Seems to be ALV issue, see my addition. – Suncatcher Jan 16 '17 at 09:19