Skip to Content
author's profile photo Former Member
Former Member

how read selected fieldcatlog tabname in USER_COMMAND event.

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2009 at 06:29 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2009 at 07:04 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 13, 2009 at 04:46 AM

    ok

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.