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

Create Button in Abap Program

Former Member
0 Likes
2,914

Hi anybody,

I want to use click event button inside abap programe.

how to use click events of button.

anybody tell me.

thanks

s.muthu

6 REPLIES 6
Read only

Former Member
0 Likes
1,648

hi for this the user commmand is used...

if sy-ucomm = 'TES'.

do some thing....

endif.

Read only

Former Member
0 Likes
1,648

Hi,

Use user-command event, When button is created using PF-STATUS, put the name for that button (let say BUTTON1).

When it is clicked the user command event will be triggered, then sy-ucomm will become BUTTON1, so that we can handle the button event.

case sy-ucomm.

when 'BUTTON1'.

--> Code

endcase.

Read only

Former Member
0 Likes
1,648

Hiii Mr Subramaniyan

Well i want to make it clear wether u want to have the push button on the application tool bar or n the selection screen area....

however if u want to have it on the application tool bar you have to set the pf status as ....

SET PF-STATUS 'TEST'.

just double click on the TEST and then you would enter SE41 transaction ...there u need to specify the Fcode ...and Display Text ...

Once u activate it then come back to the SE38 screen...

now u can call an event with the following code ...

Case SY-UCOMM.

When 'FCODE' **Fcode set for the icon in the SE41**.

perform the task u want to have ...

endcase ...

regards

chandu reddy

Read only

Former Member
0 Likes
1,648

hi,

under END -OF-SELECTION.

set pf-status <name>.

// In pf-staus u can create a button on application toolbar.

under AT USER-COMMAND.

case sy-ucomm.

when 'FCODE'.

...

endcase.

rgds.,

subash

Read only

Former Member
0 Likes
1,648

hiii

use following code.it will create button

START-OF-SELECTION.

  SET PF-STATUS 'STATUS'.
  PERFORM get_data_kna1.

END-OF-SELECTION.

Now write following code for performing task on clicking that button.

CASE sy-ucomm.
  WHEN 'CUSTOMER'.
   SELECT SINGLE kunnr
      FROM kna1
      INTO w_kna1
      WHERE kunnr = w_kunnr.

      IF sy-subrc <> 0.
         MESSAGE e015(zmsg9).
       ENDIF.

WHEN 'ORDER'.
           SELECT SINGLE vbeln
      FROM vbak
      INTO w_vbak
      WHERE vbeln = w_vbeln.

      IF sy-subrc <> 0.
       MESSAGE e015(zmsg9).
      ENDIF.

  ENDCASE.

reward if useful

thx

twinkal

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,648

Hi,

It is simple. Create ur Own PF status in SE41 transaction and assign the same to ur report.

Go to SE41-> Select radio button status->press copy status in tool bar. Here Give From program name as SAPMSSY0 and status as STLI. In to program give ur report name and to status ur new PF status name. press on copy. Now go to this status, Add push button in application tool bar option. Save and Activate.

now in ur program do like this.

END-OF-SELECTION.

SET PF-STATUS 'ZSTAT' "Ur new PF status.

All ur processing.

AT USER-COMMAND.

CHECK sy-ucomm EQ 'MYCODE'. "This will be assigned "while creating push button in PF status.

Do ur processing on clicking the button.

Thanks,

Vinod.