Skip to Content
author's profile photo Former Member
Former Member

Get TEXT OF Pushbutton on selection-screen

HI ,

How can i get the name of the pushbutton on the selection-screen.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jan 14, 2005 at 12:40 PM

    I think you define the pushbutton so you give the name.

    Can you explain your need in detail.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Arun,

      > if i use three different okcodes , then i will not be

      > able to display the list

      I am not sure if this is true.

      Below is a small program to illustrate how you can use pushbuttons on selection screen to execute different lists.

      REPORT ztestaks4 LINE-SIZE 80 LINE-COUNT 65 NO STANDARD PAGE HEADING.
      
      TABLES: sscrfields.
      
      DATA: v_flag.
      
      DATA: BEGIN OF i_excl_tab OCCURS 0,
             pfkey LIKE sy-pfkey.
      DATA: END OF i_excl_tab.
      
      *-- display or maintain options
      SELECTION-SCREEN PUSHBUTTON: /10(20) update  USER-COMMAND upda,
                                    35(20) display USER-COMMAND disp.
      
      *-------------------
      AT SELECTION-SCREEN.
      *-------------------
        CASE sscrfields-ucomm.
          WHEN 'UPDA'.
            v_flag = 'U'.
            sscrfields-ucomm = 'ONLI'.
          WHEN 'DISP'.
            v_flag = 'D'.
            sscrfields-ucomm = 'ONLI'.
          WHEN OTHERS.
        ENDCASE.
      
      *--------------
      INITIALIZATION.
      *--------------
      
        MOVE: 'Update'(006)  TO update,
              'Display'(007) TO display.
      
      
      *--------------------------
      AT SELECTION-SCREEN OUTPUT.
      *--------------------------
      
        REFRESH i_excl_tab.
        MOVE 'ONLI' TO i_excl_tab-pfkey.
        APPEND i_excl_tab.
        CLEAR i_excl_tab.
      
        CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
             EXPORTING
                  p_status  = '%_00'
                  p_program = 'RSSYSTDB'
             TABLES
                  p_exclude = i_excl_tab.
      
      *------------------
      START-OF-SELECTION.
      *------------------
      
        IF v_flag = 'U'.
          WRITE:/ 'I am now updating.'.
        ELSEIF v_flag = 'D'.
          WRITE:/ 'I am now displaying.'.
        ENDIF.
      

      Let me know if this helps.

      Srinivas

  • author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2005 at 12:44 PM

    Hi Arun,

    u could use function module PRINT_SELECTIONS.

    BR,

    Alvaro

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2005 at 06:01 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2005 at 07:26 AM

    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
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.