Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

When clicked on column name

Former Member
0 Kudos

Hi,

I need to sort the column when clicked on the column name,

but what its function code, clicking on the columns, I do not know and on which column the user clicked?

How can I do such a thing?

Thanks.

deniz.

6 REPLIES 6

Former Member
0 Kudos

Hi Toprak,

Use GET CURSOR FIELD w_field.

At LINE-SELECTION.
    GET CURSOR FIELD w_field.

  IF w_field EQ 'SPFLI-CARRID'.
    SORT t_spfli BY carrid.
    perform display.
  ELSEIF w_field EQ 'SPFLI-CONNID'.
    SORT t_spfli BY connid.
    perform display.
  ELSEIF w_field EQ 'SPFLI-CITYFROM'.
    SORT t_spfli BY cityfrom.
    perform display.
  ELSEIF w_field EQ 'SPFLI-CITYTO'.
    SORT t_spfli BY cityto.
    perform display.
  ENDIF.

FORM display.
  Loop at t_spfli.
  Write:/ t_spfli-carrid,
            t_spfli-connid,
            t_spfli-cityfrom,
            t_spfli-cityto.
  Endloop.
ENDFORM.

With luck,

Pritam.

0 Kudos

Thanks,

however there is a misunderstanding.

I am not asking the item columns, I need to know the column header.

Assume:

Name Surname

John NASH

Jack SHEPHARD

...

...

I need to know which column header, here Name or Surname, and just one click I mean.

When clicked on NAME itself, not on John or Jack, it should be sorted ascending or if sorted asc then at later click be sorted desc.

Thanks.

0 Kudos

You can try PA30 trans code to understand better.

Write pa30 and then use F4 please to find a pernr through Name surname etc.

Here try to get more data, so please enter something like

A* into surname field or something else.

Now click on surname or name etc, you see that it is sorted with just one click.

Please try this, I mean that.

Thanks.

0 Kudos

Hi,

for that first check if the sy-lilli value contains the line number of the header... then get the cursor position.

regards

padma

former_member188685
Active Contributor
0 Kudos

Using GET CURSOR you can get that

GET CURSOR FIELD <FIELDNAME> VALUE VALUE.

<FIELDNAME> will tell you on which field you clicked

Former Member
0 Kudos

Hi,

i have not tried..i am giving my openion if it helps you try it.

take the parameter id for all the columns of that report.

before looping that table capture all the parameter id's of fields in that tbale.

then in the case stmt...based on that parameter id...you can sort the table and loop it.

Regards,

venkat