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

Former Member
0 Likes
785

Hi all

I am having few doubts in selection screen...

1) I want to hide some field on selection screen based on the value entered in any one field on the selection screen. I want to disable / enable some fields based on the data enetered on the selection screen. How should I go about that? If anyone gives example like code then it will be very helpful for me.

2) I have an interactive report. I have matnr as one of the fields in my report. If I click on the matnr field the program should take me to MM02. Where should I code the logic for this? I mean in whic event and what would be the code for this?? If anyone can give me code sample then it would be very helpful for me.

Thanks in advance

Deepti..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
761

1)

Check the below code.

parameters: p_test type c,

p_num type i.

at selection-screen output.

loop at screen.

if screen-name = 'P_NUM'.

if p_test = 'P'.

screen-input = 1.

else.

screen-input = 0.

endif.

endif.

modify screen.

endloop.

2)

data: itab like mara occurs 0 with header line.

data: fnam(20) TYPE C,

fval(10) TYPE C.

Select * from mara into table itab.

loop at itab.

write:/ matnr.

endloop.

At line-selection.

Get cursor field fnam value fval.

set parameter id 'MAT' field fval.

call transaction 'MM02' and skip first screen.

Regards,

Ravi K

8 REPLIES 8
Read only

Former Member
0 Likes
761

heres one example for ur first query

at selection-screen output.

if r_pspid = 'X'.

loop at screen.

if screen-group1 = 'SC2'.

screen-active = 0.

modify screen.

endif.

endloop.

elseif r_posid = 'X'.

loop at screen.

if screen-group1 = 'SC1'.

screen-active = 0.

modify screen.

endif.

endloop.

endif.

pk

Read only

0 Likes
761

Hi

Thanks for your immediate reply. Can you please explain the code as well so that I can have a better understamding of it since I am new to this.

Read only

0 Likes
761

sorry forgot to include the selection-screen code:

tables: proj, prps.

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

parameters: r_pspid radiobutton group r1 user-command c1 default 'X',

r_posid radiobutton group r1.

select-options: s_pspid for proj-pspid modif id sc1." obligatory.

select-options: s_posid for prps-posid modif id sc2.

selection-screen: end of block b1.

Read only

0 Likes
761

in above code, if u select a certain radio button, then certain text fields are displayed, but if another radio button is selected, then the first text field is not displayed, instead the relevant text field for the second radio button is displayed.

theres a table called SCREEN, where u can get a lot of options for display, visible, active and other such things. that will be higly useful for u.

regards

pk

Read only

0 Likes
761

Hi Prashanth

Thanks for the reply. I will try out the code and certainly look for the SCREEN table.

Read only

Former Member
0 Likes
761

Hi Deepthi,

Please check this link

http://help.sap.com/saphelp_nw70/helpdata/en/79/34a234d9b511d1950e0000e8353423/content.htm

Please check this code

http://www.sapdevelopment.co.uk/reporting/selscr/but_buttons.htm

AT SELECTION-SCREEN OUTPUT

event is triggered. This event block allows you to modify the selection screen and its fields directly before it is displayed.

Initializations of selections screen fields at this moment always take effect, whereas at the execution of an executable program, initializations at moment INITIALIZATION only take effect at the first program start, and are otherwise overwritten by the previous user inputs at the beginning of AT SELECTION-SCREEN OUTPUT.

REPORT demo_at_selection_screen_pbo.

PARAMETERS: test1(10) TYPE c MODIF ID sc1,
            test2(10) TYPE c MODIF ID sc2,
            test3(10) TYPE c MODIF ID sc1,
            test4(10) TYPE c MODIF ID sc2.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF screen-group1 = 'SC1'.
      screen-intensified = '1'.
      MODIFY SCREEN.
      CONTINUE.
    ENDIF.
    IF screen-group1 = 'SC2'.
      screen-intensified = '0'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

The parameters test1 and test3 are assigned to the modification group sc1, while test2 and test4 are assigned to group sc2. During the AT SELECTION-SCREEN OUTPUT event, the INTENSIFIED field of internal table screen is set to 1 or 0, depending on the contents of the group1 field. On the standard selection screen, the lines for test1 and test3 are highlighted while those for test2 and test4 are not

Best regards,

raam

Read only

Former Member
0 Likes
762

1)

Check the below code.

parameters: p_test type c,

p_num type i.

at selection-screen output.

loop at screen.

if screen-name = 'P_NUM'.

if p_test = 'P'.

screen-input = 1.

else.

screen-input = 0.

endif.

endif.

modify screen.

endloop.

2)

data: itab like mara occurs 0 with header line.

data: fnam(20) TYPE C,

fval(10) TYPE C.

Select * from mara into table itab.

loop at itab.

write:/ matnr.

endloop.

At line-selection.

Get cursor field fnam value fval.

set parameter id 'MAT' field fval.

call transaction 'MM02' and skip first screen.

Regards,

Ravi K

Read only

Former Member
0 Likes
761

hi deepthi,

for 2nd question

u have to use the event at line selection.

example

at line-selection.

case sy-lsind.

when 1.

get cusor field fnam value fval.

if fnam = 'wa_mara-matnr'.

set parameter id 'MAT' field wa_mara-matnr.

call transaction 'mm01' and skip first screen.

endif.