Skip to Content
avatar image
Former Member

ALV output button event

Hi

We are using ALV grid FM, when you click addon <List> button in ALV grid

it displays list as output. In list output, i have add <Export> button and defined gui status and displayed at application bar.

when i click that export button , i am not able to catch the function code SY-UCOMM value.when i add standard <Print> button in applciation bar, its working by debugging into standard screen.

Does event is required to catch that?

In the list

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-CPROG

I_CALLBACK_PF_STATUS_SET = GUIST_LIST

I_CALLBACK_USER_COMMAND = UCOMM_LIST

I have codded as below too.

FORM UCOMM_LIST USING r_ucomm LIKE sy-ucomm rs_selfield TYPE

slis_selfield.

WHEN SY-UCOMM.

  • i can get func code for ALV <list> button. Not the <Export> button function of output list.

...no value

ENDFORM.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Nov 12, 2011 at 10:08 AM

    Hi guys

    Can somebody shed light on this.

    Little tips will help to continue..

    REgards

    Chandra

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 12, 2011 at 11:07 AM

    Hi,

    Use below code..

    **************For user command define*************
    data: g_form_user_command type slis_formname value 'USER_COMMAND_L'.
    
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-CPROG
    I_CALLBACK_PF_STATUS_SET = GUIST_LIST
    I_CALLBACK_USER_COMMAND = g_form_user_command
    
    ******Declare form...endform for handle user command**********
    form user_command_l using p_ucomm type sy-ucomm
                              p_selfield type slis_selfield.
    
      case p_ucomm.
    
        when <function code used for alv list button>.                       " CALL LIST
         Write your code to display list
      endcase.
    endform.

    BR

    Vijay

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Vikram

      yes, From ALV grid, i am displaying second output screen.

      pls see below source outcode. When i click button from ALV grid below i am able to get the function code inside below form.

      But not able to get function code in Second output screen Button.

      form user_command_l using p_ucomm type sy-ucomm

      p_selfield type slis_selfield.

      case p_ucomm.

      when <function code used for alv list button>. " CALL LIST

      ->calling second output screen where i have export button.

      How to handle here?

      endcase.

      endform.

      How to handle that.

      Regards

      Chandra

      Edited by: princeck on Nov 12, 2011 12:58 PM

  • avatar image
    Former Member
    Nov 12, 2011 at 12:26 PM

    Hi Chandra,

    Pass the same variable against parameter I_CALLBACK_USER_COMMAND in both alv's FM,s so in both cases same form USER_COMMAND_L will be called.

    As i mentioned below.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-CPROG
    I_CALLBACK_PF_STATUS_SET = GUIST_LIST
    I_CALLBACK_USER_COMMAND = g_form_user_command  <--Pass this variable in second REUSE_ALV** FM also

    Vijay

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Chandra,

      FORM CONTROL_UCOMM_LIST USING WA_UCOMM    LIKE SY-UCOMM
        CASE SY-UCOMM.
         WHEN 'LIST'
         PERFORM  LAYOUT_JL.  displays output in list.
      ENDFORM.
      
       AT USER-COMMAND.
       CASE SY-UCOMM.
       WHEN 'EXPORT'
       PERFORM SPOOLLIST.  
       
       FORM SPOOLLIST.
        .................
        ................
       ENDFORM.
      

      Use above structure of code.

      And remove rest of the AT USER-COMMAND statements from your code as you mentioned you declared AT USER-COMMANT statements so many place in your code.

      Thanks,

      Vijay

  • avatar image
    Former Member
    Feb 27, 2012 at 12:38 PM

    thanks

    Add comment
    10|10000 characters needed characters exceeded