1
votes

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.

1
"save sign information" where?vwegert
@vwegert I don't know where exactly it takes place (hence is my question), at least I see it in debugger and while output to ALV-grid.Suncatcher

1 Answers

0
votes

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 - .