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

Regarding Function module

Former Member
0 Likes
655

Hi

I hav a ALv grid output. There i fixed one button using the function code &ZDL.

When user presses thst button the following FM to be called.

GUI_FILE_SAVE_DIALOG.

How can i code for this scenario.

6 REPLIES 6
Read only

Former Member
0 Likes
610

hi Ramesh,

code it in this way ..

AT USER-COMMAND.
CASE SY-UCOMM.

 WHEN '&ZDL'.

   CALL FM 'GUI_FILE_SAVE_DIALOG'.

ENDCASE.

Read only

former_member508729
Active Participant
0 Likes
610

Hi Ramesh,

You have to capture the event into for user_command which you can pass to alv grid function module. There you can call your function module to download the output.

Regards,

Ashutosh

Reward points if helpfull.

Read only

Former Member
0 Likes
610

Refer this sample code.......

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • PAI Event

----


MODULE USER_COMMAND_0100 INPUT.

CASE SY-UCOMM.

WHEN 'name'. " Give the name of the button which has func code '&ZDL'.

CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'

  • EXPORTING

  • WINDOW_TITLE =

  • DEFAULT_EXTENSION =

  • DEFAULT_FILE_NAME =

  • WITH_ENCODING =

  • FILE_FILTER =

  • INITIAL_DIRECTORY =

  • IMPORTING

  • FILENAME =

  • PATH =

  • FULLPATH =

  • USER_ACTION =

  • FILE_ENCODING =

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

Regards,

Pavan

Read only

Former Member
0 Likes
610

Hi ram,

Code like this:

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN '&ZDL'.

CALL FUNCTION 'GUI_FILE_SAVE_DIALOG

EXPORTING

WITH_ENCODING = 'X'

FILE_FILTER = filefilter

default_extension = 'txt'

IMPORTING

FILENAME = filename

PATH = path

FULLPATH = fullpath

USER_ACTION = user_action

FILE_ENCODING = file_encoding.

Hope this helps you. Reply for queries, shall post the updates.

Regards.

Kumar.

Read only

Former Member
0 Likes
610

Hi,

In the FM 'REUSE_ALV_GRID_DISPLAY' you can use the parameter 'i_callback_user_command ' to pass the user command form name to be called for handling events.

Following is the code snippet :

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_bypassing_buffer = 'X'

i_buffer_active = ' '

i_callback_program = w_repid

i_callback_user_command = 'USER_COMMAND' "form name to be executed

        • Define the form 'User_command' in the program to handle the events and code the logic for * different events(for different push buttons).

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

  • The field "R_UCOMM" will contain the current value of "SY-UCOMM"

  • "RS_SELFIELD" will hold contents of the selected line

CASE r_ucomm.

WHEN '&ZDL'.

CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'

EXPORTING

.......

IMPORTING

..........

ENDCASE.

ENDFORM. "USER_COMMAND

Hope this information helps..

Regards,

Dilli

Read only

Former Member
0 Likes
610

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_bypassing_buffer = 'X'

i_buffer_active = ' '

i_callback_program = sy-repid

i_callback_user_command = 'USER_COMMAND' "form name to be executed

FORM user_command USING r_ucomm LIKE sy-ucomm

CASE r_ucomm.

WHEN '&ZDL'.

CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'

ENDCASE.