Application Development and Automation 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: 
Read only

how read selected fieldcatlog tabname in USER_COMMAND event.

Former Member
0 Likes
545

Hi Experts,

I Make One Alv Report,It works Fine and Display 40 colums.i create one Button on Application Tool Bar. User select any

colum from 40 colum and Press Button and user wants to see that colum in sorting and based upon that sorting ,he wants sub total for different records.

how can find that selected colum in USER_COMMAND.

Please give any read statement to read fieldcatlog of slected colum.

Thanks.

Hi Experts,

I Make One Alv Report,It works Fine and Display 40 colums.i create one Button on Application Tool Bar. User select any

colum from 40 colum and Press Button and user wants to see that colum in sorting and based upon that sorting ,he wants sub total for different records.

how can find that selected colum in USER_COMMAND.

Please give any read statement to read fieldcatlog of slected colum.

Thanks.

3 REPLIES 3
Read only

Former Member
0 Likes
503

Hi

check the example below code to get an idea..

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_repid

i_callback_pf_status_set = 'SET_PFALV'

i_callback_user_command = 'USER_COMMAND1'

it_fieldcat = t_fieldcat

it_events = t_events

TABLES

t_outtab = t_outtab

EXCEPTIONS

program_error = 0.

now jus write a subroutine USER_COMMAND1 remember this routine is called dynamically u no need to write perform user_command1.

in selfield u can find ur selected table value

FORM user_command1 USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield. "#EC CALLED

CHECK sy-subrc = 0.

CASE ucomm.

WHEN '&IC1'.

CASE selfield-sel_tab_field.

WHEN 'T_BALANCE-MATNR'.

  • Call Transcation MM01.

WHEN 'T_BALANCE-STOCK'.

  • Call Transaction MMBE.

...

.

.

ENDCASE.

endform.

Read only

Former Member
0 Likes
503

Hi dasaradha ramayya,

In ALV when user clicks on any selected column, user command will be '&IC1'.

You can define any action based upon this function code.

For ex :

FORM user_command USING u_ucomm LIKE sy-ucomm us_selfield TYPE slis_selfield.

sort it_vbak by vbeln.

CASE u_ucomm.

WHEN '&IC1'.

CLEAR wa_event.

READ TABLE it_vbak INTO wa_vbak INDEX us_selfield-tabindex.

if sy-subrc ne 0.

message i006 with 'sorry there is no items for this orders'(014).

endif.

ENDCASE.

Hope the information is helpful,

Regards,

Kittu

Read only

Former Member
0 Likes
503

ok