Thursday, November 26, 2009

Selection Screen

I have found good tutorial on SAP selection Screen, below code is taken from this site


In this example I will show you below selection screen properties

* Adding button on selection screen
* Define radiobuttons
* Define checkboxes
* Add more than one object in per line of selection screen
* Disable an object
* Hide/Show an object
* Display blue colored parameters

REPORT ZMAVSARTEST.

Tables : Pgmi, Sscrfields.

Data : Begin Of IPgmi Occurs 0,
Werks Type Pgmi-Werks,
Prgrp Type Pgmi-Prgrp,
Nrmit Type Pgmi-Nrmit,
End Of IPgmi.
Data : WPgmi Like Line Of IPgmi.

Selection-Screen Begin of Block b1 With Frame Title TEXT-T01.
Select-Options : Prgrp For Pgmi-Prgrp Default ‘183X366_BTE’ Modif Id OB.
Parameters : Werks Like Marc-Werks Default ‘2000′,
S1 RadioButton Group G1,
S2 RadioButton Group G1,
S3 RadioButton Group G1,
PSay(3).
Selection-Screen End of Block b1.

Selection-Screen Begin of Block b2 With Frame Title TEXT-T02.
Parameters : S4 RadioButton Group G2,
S5 RadioButton Group G2.
Selection-Screen End of Block b2.

Selection-Screen Begin of Block b3 With Frame Title TEXT-T03.
Parameters : S6 RadioButton Group G3 User-Command Radyo,
S7 RadioButton Group G3.
Selection-Screen begin of line.
Parameters p_ch1 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-001 Modif ID SL.
Parameters p_ch2 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-002 Modif ID SL.
Parameters p_ch3 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-003 Modif ID SL.
Selection-Screen end of line.
Selection-Screen begin of line.
Parameters p_ch4 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-004 Modif ID SL.
Parameters p_ch5 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-005 Modif ID SL.
Parameters p_ch6 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-006 Modif ID SL.
Selection-Screen end of line.
Selection-Screen begin of line.
Parameters p_ch7 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-007 Modif ID SL.
Parameters p_ch8 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-008 Modif ID SL.
Parameters p_ch9 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-009 Modif ID SL.
Selection-Screen end of line.
Selection-Screen begin of line.
Parameters p_ch10 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-010 Modif ID SL.
Parameters p_ch11 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-011 Modif ID SL.
Parameters p_ch12 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-012 Modif ID SL.
Selection-Screen end of line.
Selection-Screen End of Block b3.

TYPE-POOLS icon.
Data : Functxt TYPE Smp_Dyntxt.

Selection-Screen: Function Key 1,
Function Key 2.
Initialization.
S7 = ‘X’.
Functxt-icon_id = ICON_ALARM.
Functxt-quickinfo = ‘Uç’.
Functxt-icon_text = ‘Uç’.
Sscrfields-functxt_01 = functxt.
Sscrfields-Functxt_02 = ‘Button2′.

At Selection-Screen.
Case Sscrfields-Ucomm.
When ‘FC01′.
Message ‘Uçakla mı uçacaksın?’ Type ‘I’.
When ‘FC02′.
Message ‘Button2′ Type ‘I’.
When Others.
Endcase.

At Selection-Screen Output.
Perform CheckRadio.

FORM CheckRadio.
Loop At Screen.
If S6 = ‘X’.
If Screen-Group1 = ‘SL’.
Screen-Active = 0.
Endif.
Elseif S7 = ‘X’.
If Screen-Group1 = ‘SL’.
Screen-Active = 1.
Endif.
Endif.
If Screen-Group1 = ‘OB’.
Screen-Intensified = ‘1′.
Endif.
If Screen-Name = ‘S5′.
Screen-Input = 0.
Endif.
Modify Screen.
Endloop.
ENDFORM.” CheckRadio

Start-Of-Selection.
Perform GetData.
End-Of-Selection.

Form GetData.
* Get your data in this subroutine
EndForm. ” GetData

No comments:

Post a Comment