cancel
Showing results for 
Search instead for 
Did you mean: 

POWL Sort order

Former Member
0 Kudos

How do you set the sort-order for columns in a POWL implementation?

I know theres a "sort_ref" field as part of the POWL_FIELDCAT_TTY table that you pass back to the POWL framework in the GET_FIELD_CATALOG method. But I have no idea what I am supposed to put in it.

Why does it reference another field? And in the output data table of all things?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

It seems like SAP does not currently support sorting positions in the POWL implementation. I know this because I debugged the standard SAP code until I got to this:

- Class

CL_POWL_UTIL

- Method

UPDATE_ALV_MODEL_FROM_FIELDCAT

There's a piece of code that says:

" set sorting
      IF <lfs_fieldcat>-allow_sort IS NOT INITIAL.
        CALL METHOD lr_field->if_salv_wd_sort~set_sort_allowed
          EXPORTING
            value = abap_true.
        IF <lfs_fieldcat>-sort_order = '01'.
          CALL METHOD lr_field->if_salv_wd_sort~create_sort_rule
            EXPORTING
              sort_order        = if_salv_wd_c_sort=>sort_order_ascending
*            sort_position     = 1
              group_aggregation = abap_true
*          RECEIVING
*            value             = lo_sorttest
              .
        ELSEIF <lfs_fieldcat>-sort_order = '02'.
          CALL METHOD lr_field->if_salv_wd_sort~create_sort_rule
          EXPORTING
            sort_order        = if_salv_wd_c_sort=>sort_order_descending
*            sort_position     = 1
            group_aggregation = abap_true
*          RECEIVING
*            value             = lo_sorttest
            .
        ENDIF.

If I interpret this correctly, the sort_position should have been passed as well instead of defaulted and the SALV component will now sort automatically in the order of the fields added. The problem is, because the Fieldcat table from the POWL feeder class is a sorted table based on COLID, they are added in this order and so this means the default sort order of the ALV will be based on the alphabetical names of the fieldcat - not at all functional!

If I now disable sorting and send in the data already sorted, it is correct except that I don't get grouping on similar values and the user can't change the sorting!

If would help a lot if SAP could add support for the sort_position in the POWL fieldcat in the future! Or, if I miss something, please correct me.

ChandraMahajan
Active Contributor
0 Kudos

Hi,

Refer http://wiki.sdn.sap.com/wiki/display/WDABAP/NullandZeroinFieldCatalogofPOWL ,http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=222957279 and http://wiki.sdn.sap.com/wiki/display/WDABAP/POWLEASY

May be you will get some hint from this.

Thanks,

Chandra