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:
TCURR and replaced
GDATU_INV domain with simple
LVC_FIELDCATALOG_MERGE according to
TCURR structure I write to
fields of the GDATU line values
Is there more efficient and simple solution to this problem?
You should be able to use your new structure in
LVC_FIELDCATALOG_MERGE, in stead of using TCURR which would mean that you don't have to overwrite the settings in the field catalog after the fact. But that's a pretty minor thing.
I don't think you had any choice but to use a structure with a data element that behaves the way you need it to.
Do look into the Simple ALV classes, though. (
CL_SALV*) They are well documented and much easier to use than then now out-of-date ALV function modules. (Particularly generating the field catalog is a lot less hassle).