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

Function key in ALV output

Former Member
0 Likes
2,146

hi all,

i have to make a function key(Re-process) in ALV grid output and if user selects any ALV row and click on that function key then it will reprocess the selected data. so can any one please tell how would i make Function key in ALV output and also how to trap the selected row data of ALV?

regards.

1 ACCEPTED SOLUTION
Read only

anup_deshmukh4
Active Contributor
0 Likes
1,298

For this you will have to write the a Call back routine you will have to add a custom button in allv

and when your added button is pressed then this routine will be triggred you will have to write a operation for the function code inteh call back routine

you Get the CALL BACK ROUTING NAME PARAMETER in the REUSE_ALV_GRID_DISPLAY

in this routine you will ge the current selected row also.


call function 'REUSE_ALV_GRID_DISPLAY'
   exporting
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
    i_callback_program             = sy-cprog
    i_callback_html_top_of_page = 'TOP_OF_PAGE'
*    i_callback_top_of_page         = 'TOP_OF_PAGE'
*   I_CALLBACK_PF_STATUS_SET       = ' '
    i_callback_user_command        = 'USER_COMMAND'
*    I_GRID_TITLE                   = 'VIRAJ PROFILES LTD.'
*   I_STRUCTURE_NAME               =
      is_layout                      = layout
      it_fieldcat                    = fieldcat
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
     it_sort                        = i_sort
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
    tables
      t_outtab                       = <table>
* EXCEPTIONS
*   PROGRAM_ERROR                  = 1
*   OTHERS                         = 2
            .
form user_command using r_ucomm like sy-ucomm
                 rs_selfield type slis_selfield.
  case r_ucomm.
    when '&IC1'.
      loop at it_ekko into wa_it_ekko.
        if rs_selfield-fieldname cs wa_it_ekko-ebeln.
          set parameter id  'ANF' field wa_it_ekko-ebeln.
          call transaction 'ME47' and skip first screen.
        endif.
      endloop.
    when '%_GC 117 3'.
      data : msg type string.
      concatenate 'Click' 'on' rs_selfield-fieldname into msg separated by space.
      message msg type 'I'.
    when others.
  endcase.
endform.                    "USER_COMMAND

Above is sample code ...just debug it you will get it all

Edited by: Anup Deshmukh on Feb 2, 2010 4:43 AM

hi all,

i have to make a function key(Re-process) in ALV grid output and if user selects any ALV row and click on that function key then it will reprocess the selected data. so can any one please tell how would i make Function key in ALV output and also how to trap the selected row data of ALV?

regards.

4 REPLIES 4
Read only

anup_deshmukh4
Active Contributor
0 Likes
1,299

For this you will have to write the a Call back routine you will have to add a custom button in allv

and when your added button is pressed then this routine will be triggred you will have to write a operation for the function code inteh call back routine

you Get the CALL BACK ROUTING NAME PARAMETER in the REUSE_ALV_GRID_DISPLAY

in this routine you will ge the current selected row also.


call function 'REUSE_ALV_GRID_DISPLAY'
   exporting
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
    i_callback_program             = sy-cprog
    i_callback_html_top_of_page = 'TOP_OF_PAGE'
*    i_callback_top_of_page         = 'TOP_OF_PAGE'
*   I_CALLBACK_PF_STATUS_SET       = ' '
    i_callback_user_command        = 'USER_COMMAND'
*    I_GRID_TITLE                   = 'VIRAJ PROFILES LTD.'
*   I_STRUCTURE_NAME               =
      is_layout                      = layout
      it_fieldcat                    = fieldcat
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
     it_sort                        = i_sort
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
    tables
      t_outtab                       = <table>
* EXCEPTIONS
*   PROGRAM_ERROR                  = 1
*   OTHERS                         = 2
            .
form user_command using r_ucomm like sy-ucomm
                 rs_selfield type slis_selfield.
  case r_ucomm.
    when '&IC1'.
      loop at it_ekko into wa_it_ekko.
        if rs_selfield-fieldname cs wa_it_ekko-ebeln.
          set parameter id  'ANF' field wa_it_ekko-ebeln.
          call transaction 'ME47' and skip first screen.
        endif.
      endloop.
    when '%_GC 117 3'.
      data : msg type string.
      concatenate 'Click' 'on' rs_selfield-fieldname into msg separated by space.
      message msg type 'I'.
    when others.
  endcase.
endform.                    "USER_COMMAND

Above is sample code ...just debug it you will get it all

Edited by: Anup Deshmukh on Feb 2, 2010 4:43 AM

Read only

0 Likes
1,298

hi anup,

thanx for reply....can u please tell me how would i make function key on application tool bar of ALV output screen?

can anyone please help me on this? actually in ALV if user selects the row of ALV and click on that function key then i have to take all selected records in and have to do some operation againg.

please help.

regards.

Read only

0 Likes
1,298

Hi,

Create the function key in menu painter(SE41).

And use it in your program.

Thanks,

Sudheer

Read only

0 Likes
1,298

saurabh srivastava ,

Hear is a suggesition,

When you display your report and the standar tool bar put '/h' in the Tcode input box i.e. enter the debugging mode will be activited

next for eg. if you save button you will go to your USER_COMMAND form

just check tey SY-UCOMM you will get the function code for the button pressed on the report

For. Eg. if you Click on SAVE icon on standar report you will get a function Code as '&DATA_SAVE'

  • This is only for alv save

  • your save button will be activated if your alv is editable...!