Question

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:

  1. I declared table structure similar to TCURR and replaced GDATU_INV domain with simple DATUM.
  2. I converted inverted dates into usual ones
  3. I filled my table with the converted dates
  4. After generating field catalog through FM LVC_FIELDCATALOG_MERGE according to TCURR 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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top