Skip to Content

hide all buttons in a GUI-STATUS ?

I'd like to hide all functions from the toolbar of a GUI-STATUS except for one function.

I could of course create a table with all the FCODE except for the one and then call

 SET PF-STATUS 'bla' EXCLUDING itab.

But whenever I add a function to the GUI-Status then, I have to change that code. Is there a way to prevent this.

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    Posted on Feb 02, 2005 at 05:56 PM

    Hi Deniel,

    There is a function module that lists out all the function codes of a given GUI-STATUS of a program. It is

    RS_CUA_GET_STATUS_FUNCTIONS.

    Before you do the 'set pf-status', you can always call this function module, move all the fcodes into exculde itab except the one you wanted and then do the set pf-status.

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 03, 2005 at 07:28 AM

    Hi Daniel,

    Considering the dynamism you want i would suggest you create a database table 'Y_ACTIVE_FCODE' where you will store all the active Function Codes for a particular screen.

    Then as suggested by others get all the function codes on the screen via the Standard function module and include all the function codes in the Exclusion internal table except the ones maintained in your database table 'Y_ACTIVE_FCODE' for the particular screen. This way you'll have the flexibility of activating / deactivating new/existing function codes without actually changing the code to do so.

    Cheers

    Nitesh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 02, 2005 at 05:54 PM

    That is the only way to do it. Since your changing the gui-status anyway, what's one more line of code to exclude the FCODE.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 03, 2005 at 08:29 AM

    Hello Daniel,

    Looking at the responses that your question has got, I wouldn't say that I had understood the question as well as

    the others have.

    I understand that you want to be able to dynamically add and delete the Functions from your toolbar. But what I did

    not quite understand is what exactly you had meant by "...I have to change that code....". If you want to perform an

    action, you would have to write some code anyways. So here's what I would do:

    1. Define a GUI-STATUS which has all the function codes you will ever need during the program.

    2. You can manipulate the Buttons on the toolbar with the EXCLUDING option.

    3. I don't believe that you need to use the FM RS_CUA_GET_STATUS_FUNCTIONS. Consider using instead the ABAP statement GET PF-STATUS. The Online Documentation has explained this statement wonderfully.

    4. I don't think that creating a database table to merely maintain the FCODEs of a program is a sensible option either.

    Instead consider using an internal table of constants, where you have all the FCODES required.

    I hope these points would clarify some of the things. If you need further assistance, please get back.

    Regards,

    Anand Mandalika.

    P.S. Two points that I would like to remind you:

    a). You can use the statement SET PF-STATUS SPACE to reset all the PF-STATUS.

    b). Once you set a PF-STATUS, it will be available till the moment you use the next SET PF-STATUS statement.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 03, 2005 at 08:53 AM

    Hi all. I think using the FuBa was exantly what I was looking for. Here's the code I used:

      DATA lt_functions TYPE TABLE OF rsmpe_funl.
      DATA wa_function  LIKE LINE OF lt_functions.
      DATA lv_prog LIKE sy-repid.
      DATA lv_status_name TYPE string.
    * 2 different stati depending on wheter the dynpro is called as popup or not
      IF gv_show_as_popup = abap_true.
        lv_status_name = 'Zxx_DIALOG'.
      ELSE.
        lv_status_name = 'Zxx_STATUS'.
      ENDIF.
    
    * if entry is locked,hide all buttons except the exit button
      IF gv_display_only = abap_true.
    
        lv_prog = sy-repid.
    
        CALL FUNCTION 'RS_CUA_GET_STATUS_FUNCTIONS'
             EXPORTING
                  program           = lv_prog
                  status            = lv_status_name
    *             language          = sy-langu
             TABLES
                  function_list     = lt_functions
             EXCEPTIONS
                  menu_not_found    = 1
                  program_not_found = 2
                  status_not_found  = 3
                  OTHERS            = 4.
        IF sy-subrc <> 0.
          MESSAGE i026.
        ELSE.
    *     add all FCODEs except EXIT to excluding-itab.
          LOOP AT lt_functions INTO wa_function WHERE fcode <> 'EXIT'.
            APPEND wa_function-fcode TO gt_hide_functions.
          ENDLOOP.
        ENDIF.
      ENDIF.
    
      SET PF-STATUS lv_status_name EXCLUDING gt_hide_functions.
    

    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.