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

selection-screen function key dynamically ?

former_member517
Participant
0 Likes
2,014

Dear all,

I wonder if it is possible to have a function key dynamically appearing on the selection screen of an ABAP. For example the button for reading the documentation of an ABAP is shown dynamically only if there is a documenation available.

I have tried several methods at SELECTION-SCREEN OUTPUT

- SET PF-STATUS EXCLUDING 'FC0x' : no reaction

- Blanking the icon via CLEAR: SSCRFIELDS-FUNCTXT: Result blank button

- In LOOP AT SCREEN nothing can be found concerning function keys.

I assume that the crucial point is the SELECTION-SCREEN FUNCTION KEY statement, which generates the button.

Thanx for your help

Rabanus Diehl

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,220

Hi Rabanus,

check the sample program: demo_sel_screen_status.

Regards,

Ravi

4 REPLIES 4
Read only

Former Member
0 Likes
1,220

You mention about the 'Documentation' button.

However, SE38 is a dialog program so this why it is easy to do. You are writing a report program. You could have the pushbutton on the screen itseld instead of the status bar. You should then be able to use LOOP AT SCREEN to hide. Here is some code to put a pushbutton on a screen.

INCLUDE <list>.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON 01(35) garment

USER-COMMAND garment.

SELECTION-SCREEN END OF LINE.

INITIALIZATION.

PERFORM f_setup_pushbutton_text USING icon_execute_object text-s01

CHANGING garment.

FORM f_setup_pushbutton_text USING p_icon

p_text

CHANGING p_result.

DATA: l_result(50).

CALL FUNCTION 'ICON_CREATE'

EXPORTING

name = p_icon

text = p_text

add_stdinf = space

IMPORTING

RESULT = l_result

EXCEPTIONS

EXCEPTIONS

icon_not_found = 1

outputfield_too_short = 2

OTHERS = 3.

IF sy-subrc EQ 0. ENDIF.

p_result = l_result.

ENDFORM. " F_SETUP_PUSHBUTTON_TEXT

Read only

0 Likes
1,220

Quoting Martin Shinks:

>You are writing a report program. You could have the pushbutton on the screen itseld >instead of the status bar.

First of all, thanks for your answer. I don't want to use a push-button on the selection-screen itself because the feature behind the button is to be implemented in several ABAPs where it should look and work in the same way without disturbing the individual selection-screens.

Rabanus

Read only

Former Member
0 Likes
1,221

Hi Rabanus,

check the sample program: demo_sel_screen_status.

Regards,

Ravi

Read only

Former Member
0 Likes
1,220

S u can do in selection screen Function key.

TABLES SSCRFIELDS. 
... 
SELECTION-SCREEN FUNCTION KEY 1. 
... 

INITIALIZATION. 
  MOVE 'My text' TO SSCRFIELDS-FUNCTXT_01. 
  ... 

AT SELECTION-SCREEN. 
  IF SSCRFIELDS-UCOMM = 'FC01'. 
    ... 
  ENDIF.

SELECTION-SCREEN FUNCTION KEY n.

Effect

Activates a pushbutton (one of a maximum of 5) in the application toolbar of the selection screen (where n is between 1 and 5).

At runtime, you must insert the text for the pushbutton into the appropriate ABAP Dictionary field SSCRFIELDS-FUNCTXT_01 ... SSCRFIELDS-FUNCTXT_05. If you want to assign an icon to the pushbutton, you must fill SSCRFIELDS-FUNCTXT_01 ... SSCRFIELDS-FUNCTXT_05 using the structure SMP_DYNTXT.

The function code placed in field SSCRFIELDS-UCOMM is 'FC01' ... 'FC05'. You can query this function code in the AT SELECTION-SCREEN event or the PAI routine in the database access program SAPDBldb.

Within the selection include : Additions FOR NODE node , FOR TABLE dbtab , and ID id.FOR TABLE dbtab und ID id.

Notes

If a pushbutton (ex. FUNCTION KEY 2,) is already defined in the selection include, the system returns a syntax error if you try to include an equivalent statement in your report.

You can create your own pushbuttons directly on the screen using the PUSHBUTTON addition.

Refer the documentation available by pressign F1.