I think you define the pushbutton so you give the name.
Can you explain your need in detail.
Fuat's suggestion in regard to using radiobuttons sounds like a good one. Then you do not need a button, the user would hit the regular execute button.
One of the principals of screen processing is that your ABAP only needs to understand the function codes and NOT where/how the function code was invoked. For example, the same function might be available from a button, a menu and a function key. Your ABAP would only need to understand what to do when the user requested the function and does not need to know how the user did it.
It you are determined to have 3 buttons, it can be done but is more complicated. I assume you need your 3 buttons plus some selection screen objects like select-options.
Define a regular screen and create a subscreen area. Outside the subscreen area, put your 3 buttons with 3 different function codes. In the subscreen area, put a selection screen defined as a subscreen.
You can do help on command SELECTION-SCREEN and look at the option for BEGIN OF SCREEN nnn AS SUBSCREEN.
Demo program demo_sel_screen_as_subscreen might also help.
I have a few notes that might be helpful:
1. define the selection screen with a number in the range 1001 thru 1100. If not, the normal selection screen events are not available.
2. set PF2=OPTI in the status for your screen or selection options will not work. Add the button as well as it appears on a regular selection screen.
Let us know how it goes.
Dear Arun,
First of all Thanks for giving me points for your 'Time Query'.
It was my first inauguration in sdn.
Regarding this 'Button Name' Query,
It seems to me that your problem is still not solved.
All the answers provided do 'Something Else'
and your 'Real Questions' remains unsolved.
Its a very good question. I also tried much and
presently conclude that for achieving this :
1. Some Discipline in Naming Convention has to be followed.
2. This discipline is between
a) Name of button
b) user command for this button
3. I have written a sample code in which
a) 3 buttons appear on screen.
b) press any one button
c) then press 'Execute' Button For displaying name
4. The main logic is to
a) search by using a 'Loop at Screen'
b) In the loop, in the name field search the ucomm.
5. I hope this will be satisfactory till time. If it get
something more, i will let u know.
6. Once again please give points if u feel satisfied.
Thanks & Regards,
Amit Mittal.
*----
REPORT abc.
DATA : btnname(8) TYPE c.
*----
REQUIRED
TABLES sscrfields.
*----
Create Button
*----
Note : Name Of Button 'U1_HELLO'
*----
Starts with 'U1' (assigned user command)
*----
This kind of discipline required
SELECTION-SCREEN PUSHBUTTON /10(20) u1_hello USER-COMMAND u1.
SELECTION-SCREEN PUSHBUTTON /10(20) u2_hello USER-COMMAND u2.
SELECTION-SCREEN PUSHBUTTON /10(20) u3_hello USER-COMMAND u3.
*----
Init
INITIALIZATION.
MOVE 'BUTTON 1' TO u1_hello.
MOVE 'BUTTON 2' TO u2_hello.
MOVE 'BUTTON 3' TO u3_hello.
*----
AT SELECTION-SCREEN.
*------- Loop at Screen
LOOP AT SCREEN.
IF screen-name CS sscrfields-ucomm.
*----
FOUND
btnname = screen-name.
ENDIF.
ENDLOOP.
*----
END-OF-SELECTION.
*----
WRITE: 'BUTTON NAME IS ' , btnname.
Add a comment