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

Dynamic SELECTION-SCREEN.

Former Member
0 Likes
917

Hi Everyone.

I have one problem with selection-screen.

I have two t-code for one program.

if I use one t-code, it need to declare

selection-screen function key 1

and if I use other t-code it doesn't need

selection-screen function key 1.

Is there any way to declare selection-screen dynamically?

And I have one thing I can't understand.

I used initialization for this problem like this source.

INITIALIZATION.

IF SY-TCODE NE 'ZPP00041'.

SELECTION-SCREEN FUNCTION KEY 1.

MOVE TEXT-001 TO SSCRFIELDS-FUNCTXT_01.

ENDIF.

But selection-screen was declared even though sy-tcode was 'ZPP00041',

but MOVE TEXT-001 TO SSCRFIELDS-FUNCTXT_01 didn't work.

Why does it work?

Pleas give me some answer.

Thank you!

5 REPLIES 5
Read only

Former Member
0 Likes
533

Jus a quick reply.

Perhaps you could do it this was.

Initialization.

move sy-tcode to var1.

at selection screen output

IF var1 NE 'ZPP00041'.

SELECTION-SCREEN FUNCTION KEY 1.

MOVE TEXT-001 TO SSCRFIELDS-FUNCTXT_01.

ENDIF

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
533

How about instead of using the SELECTION-SCREEN FUNCTION KEY statement, use a gui status. Just create a gui status with your button in it. Set the gui status depending on the tcode.



report zrich_0006.

tables: sscrfields.

parameters: p_check.


at selection-screen output.
  if sy-tcode ne 'ZPP00041'.
    set pf-status 'SEL'.
  else.
    set pf-status 'SEL' excluding 'BUTTION'.
  endif.

Here SEL is the gui status and BUTTON is the fcode tied to the button that you created on the gui-status.

Regards,

Rich Heilman

Read only

0 Likes
533

Hi,

The Selection screen is defined prior to INITIALIZATION wherein you are only passing text to the button based on tcode. If you want to deactivate the button you have to loop at the table sscrfields during the at selection-screen event. similar to how you loop at screen & make fields display only etc.

Regards,

Suresh Datti

Read only

Former Member
0 Likes
533

Thank you for reply!

KLL.

I tried what you adviced but it doesn't work

It makes some error message like this.

Within FORM routines and function modules, the SELECTION-SCREEN statement is not allowed.

Rich Heilman

I used pf-status but it always shows 'EXCEL' button.

AT SELECTION-SCREEN OUTPUT.

IF SY-TCODE NE 'ZPP00041'.

SET PF-STATUS 'STATUS02'.

ELSE.

SET PF-STATUS 'STATUS02' EXCLUDING 'EXCEL'.

ENDIF.

Suresh Datti .

Could you tell me some more?

I can't understand exactly.

If you show some source, it would be very helpful!

Message was edited by: Sang Sin Bae

Read only

Former Member
0 Likes
533

Hi Sang,

Its possible to define selection screen dynamically.

You define the selection screen field in no-display mode while declaring the selection screen field.

Now in at selection-screen output event,

use following code snippet.

Loop at screen.

IF SY-TCODE = 'ZPP00041'.

if screen-name = 'whatever in your case'

screen-active = '0'.

screen-invisible = '1'.

modify screen.

endif

endif.

endloop.

Hope it will give you some idea!!

Cheers,

Vikram

Pls reward for helpful replies!!