cancel
Showing results for 
Search instead for 
Did you mean: 

hide all buttons in a GUI-STATUS ?

daniel_humberg
Contributor
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Use function module RS_CUA_GET_STATUS_FUNCTIONS to get the Fcodes of the status at runtime.

Regards,

Rich Heilman

Answers (4)

Answers (4)

daniel_humberg
Contributor
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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