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 call on a pushbutton click

Former Member
0 Likes
1,876

Hi,

Can anybody guide me to find a solution of the following problem

I have a push button and i want to call a function to transfer a file from one folder to another .

The problem is how to call that function on the click of the button.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,027

Hi,

Check the below code.

type-pools icon.

data: v_flag type c.

tables: sscrfields.

selection-screen begin of block file with frame.

selection-screen skip.

selection-screen pushbutton 1(30) xdatatxt user-command selx.

selection-screen skip.

selection-screen end of block file .

initialization.

xdatatxt+5 = 'Physical file'.

xdatatxt+0(5) = icon_address.

at selection-screen.

if sscrfields-ucomm = 'SELX'.

v_flag = 'X'.

endif.

start-of-selection.

if v_flag = 'X'.

write:/ 'selected'.

  • do what ever you want here

else.

write:/ 'No'.

endif.

4 REPLIES 4
Read only

Former Member
0 Likes
1,027

well in the PAI section of your dynpro you either already have some staement like:


case sy-ucomm.
  when 'xxxx'.

  when others.

endcase.

there insert a when with your funtion code and the do your coding.

e-G- call function.

Read only

Former Member
0 Likes
1,027

Hi,

When you click on the pushbutton.

you have assigned any function code to that or if it a selection screen you have assigned any user-command to that pushbutton.

Write the code for the same

case sy-ucomm.

when 'PUSH'.

Perform your action here.( YOUR FUNCTION MODULE CALL )

Encase.

Regards,

Madan.

Read only

0 Likes
1,027

Hi,

I actually created a user defined function in that i am calling a function module .

But when i write a perform statement in CASE-ENDCASE block it do not executes.

Read only

Former Member
0 Likes
1,028

Hi,

Check the below code.

type-pools icon.

data: v_flag type c.

tables: sscrfields.

selection-screen begin of block file with frame.

selection-screen skip.

selection-screen pushbutton 1(30) xdatatxt user-command selx.

selection-screen skip.

selection-screen end of block file .

initialization.

xdatatxt+5 = 'Physical file'.

xdatatxt+0(5) = icon_address.

at selection-screen.

if sscrfields-ucomm = 'SELX'.

v_flag = 'X'.

endif.

start-of-selection.

if v_flag = 'X'.

write:/ 'selected'.

  • do what ever you want here

else.

write:/ 'No'.

endif.