Saturday, February 6, 2016

Selection Screen

Standard Reference Program : CHANGEDOCU_READ

Structure of a program
Report Heading : REPORT  <Zprogram> MESSAGE-ID <ZMessage Class> 
Message Class can be created in SE91
SELECTION-SCREEN
Different blocks of selection screen can be defined here.
INITIALIZATION
AT SELECTION-SCREEN Options like F4 Help for the selection screen options
AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN
here validations, authorizations are done
START-OF-SELECTION
Actual processing of data


Selection Screen block with select options and parameters
SELECTION-SCREEN BEGIN OF BLOCK sel WITH FRAME TITLE text-sel.
SELECT-OPTIONS:
  s_obj          FOR cdhdr-objectclas,
  s_obid         FOR cdhdr-objectid,
  s_chnr         FOR cdhdr-changenr.
PARAMETERS: p_user  LIKE cdhdr-username.
SELECTION-SCREEN END OF BLOCK sel.


Selection screen based on Radio button
type-pools: icon.
data: switch.
selection-screen begin of block b2 with frame title text-001.
parameters: radio radiobutton group rnd user-command test default 'X',
            radio2 radiobutton group rnd.
selection-screen end of block b2.
selection-screen begin of block b1 with frame title text-001.
parameters:
           test type bkpf-belnr modif id sc1.
selection-screen end of block b1.
selection-screen begin of block b3 with frame title text-001.
parameters:
           test1 type bkpf-belnr modif id sc2.
selection-screen end of block b3.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
  IF SCREEN-GROUP1 = 'SC1' AND RADIO EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ELSEIF SCREEN-GROUP1 = 'SC2' AND RADIO2 EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ENDIF.
ENDLOOP.

start-of-selection.

Selection screen options in one line / options side - by - side

This option does not work with dynamic selection screen based on radio button
SELECTION-SCREEN BEGIN OF BLOCK func WITH FRAME TITLE text-t06.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : p_dso RADIOBUTTON GROUP g1 USER-COMMAND comm DEFAULT 'X'.
SELECTION-SCREEN COMMENT 5(20) text-t01 FOR FIELD p_dso.
PARAMETERS :    p_wdso RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 30(20)  text-t02 FOR FIELD p_wdso.
PARAMETERS :    p_md RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 60(25)  text-t03.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK func.

 CHECK BOX

USING TOP

To have the extra top screen in the output of your ALV output

Data Declaration

DATA: lt_top TYPE slis_t_listheader,
             lw_top TYPE slis_listheader,

Populating Tables
  lw_top-typ 'S'.
  lw_top-key '<text>'.
  lw_top-info = <text>.
  APPEND lw_top TO lt_top.

using in ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   I_CALLBACK_TOP_OF_PAGE            'TOP'
Uncomment 'I_CALLBACK_TOP_OF_PAGE ' in the ALV output and have 'TOP' as value

Form
FORM f_top.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
     it_list_commentary       lt_top.
ENDFORM.

Have the above form in the system even though it does not have a perform. just have the form copy paste.


Creating documentation 
In SE38 -> Documentation
This should give the documentation maintained for the program. If there is no documentation, you can click on create

You might get the following error when maintaining documentation.
Document is not available in language EN
Check in the program header, if message id is included.
The first line of the program should be
REPORT ZTEST MESSAGE-ID Z001.

You can either add the statement and click on Z001 ( or whatever you named it ) and create the message ID or go to se91 and create it. You need not add any messages over there.
Once the 'Message ID' is included in the code, GoTo Documentation . It open a word document. Edit it and save.

Now on you can see the documentation and can edit it whenever needed.


No comments:

Post a Comment