I had a need to output TCURR table into ALV grid. All went fine but when user sorts table by "valid from" date (GDATU
) strange things happened.
Sorting in ascending order behaves as sorting in descending order and vice versa. This is so because field GDATU
contains date in inverted format and has domain GDATU_INV
with the conversion routine INVDT
which converts date on the fly. ALV grid shows the date correctly but sorting is done by inverted dates.
I solved it like this:
- I declared table structure similar to
TCURR
and replacedGDATU_INV
domain with simpleDATUM
. - I converted inverted dates into usual ones
- I filled my table with the converted dates
- After generating field catalog through FM
LVC_FIELDCATALOG_MERGE
according toTCURR
structure I write to
CONVEXIT,
REF_TABLE,
DATATYPE,
DOMNAME
fields of the GDATU line values
'',
'',
'DATS',
'DATUM' respectively.
Is there more efficient and simple solution to this problem?