Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Dynamic Screen Selection

Hi all,

I need to have a Dynamic screen selection which works the following way:

Firstly I have a selection-screen which has a single parameter on it:

 selection-screen begin of block b1 with frame title text-001.

parameters: pa type proj-pspid.

selection-screen end of block b1. 

Now here Im using the AT SELECTION-SCREEN ON VALUE-REQUEST event to display a limited number of entries only (using the FM F4IF_INT_TABLE_VALUE_REQUEST ) in the F4 help.

 AT SELECTION-SCREEN ON VALUE-REQUEST FOR  pa. 
----------
-----------
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
---------------------

After this based on the selection I need to display another Selection screen.

For Example if,

if pa+3(2) = 'GW'. 

I need to display parameters p3 and p4 only on the selection screen:

selection-screen begin of block b2 with frame title text-001.

parameters: p3 RADIOBUTTON GROUP rad2 modif id sc1,
            p4 RADIOBUTTON GROUP rad2 modif id sc1.

parameters: p5 RADIOBUTTON GROUP rad2 modif id sc2,
            p6 RADIOBUTTON GROUP rad2 modif id sc2.

selection-screen end of block b2. 

 elseif pa+3(2) = 'MP'. 

parameters p5 and p6 only needs to be displayed.

In ideal conditions I know we could write the above code under the AT SELECTION-SCREEN OUTPUT event. But here Ive already defined a AT SELECTION-SCREEN ON VALUE-REQUEST event to display the pa value for restricted F4 help.

Right now my problem is that all the parameters (p3,p4,p5,p6) are all being displayed. Only after I get an input in the parameters field will I get the preferred parameters displayed in the subsequent selection screen (Loop at Screen....endloop).

But initially I want the second selection screen to be totally blank.

So right now its getting a bit too confusing for me on a Monday afternoon after a 6 day long vacation

Any inputs on this?

Regards,

pk

Tags:
Former Member
Former Member replied

Hi Guys,

In addition to Vijay's code this one line addition does the magic of - SIMULATING ENTER KEY HIT

REPORT  ZTEST_ZERO_01.
 
data:
  begin of fs_vbeln,
    vbeln type vbeln_va,
    posnr type posnr_va,
  end of fs_vbeln,
  t_vbeln like standard table of fs_vbeln.
 
data: lt_tab like ddshretval occurs 0 with header line.
 
parameters: p1(10).
 
selection-screen begin of block b2 with frame title text-001.
 
parameters: p3 RADIOBUTTON GROUP rad2 modif id sc1,
            p4 RADIOBUTTON GROUP rad2 modif id sc1.
 
parameters: p5 RADIOBUTTON GROUP rad2 modif id sc2,
            p6 RADIOBUTTON GROUP rad2 modif id sc2.
 
selection-screen end of block b2.
 
at selection-screen output.
 
loop at screen.
 if screen-group1 = 'SC1'.
 if p1 eq '123456'.
  screen-active = 1.
 else.
  screen-active = 0.
 endif.
  modify screen.
 endif.
 
 if screen-group1 = 'SC2'.
 if p1 eq '456789'.
  screen-active = 1.
 else.
  screen-active = 0.
 endif.
  modify screen.
 endif.
 
endloop.
 
 
at selection-screen on value-request for p1.
select vbeln posnr
  into table t_vbeln
  up to 20 rows
  from vbap.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
  exporting
    retfield               = 'VBELN'
   dynpprog               = sy-cprog
   dynpnr                 = sy-dynnr
   value_org              = 'S'
   callback_program       = sy-cprog
  tables
    value_tab              = t_vbeln
   return_tab             = lt_tab
 exceptions
   parameter_error        = 1
   no_values_found        = 2.
 
if sy-subrc eq 0.
  loop at lt_tab.
    clear p1.
    p1 = lt_tab-fieldval.
  endloop.

CALL SCREEN 1000.  " <----1000 By Default. If you use some other screen number use that
endif.

Is this a clean way?

Cheers,

Kothand

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question