Application Development 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: 

Radio Buttons on Selection Screen

Former Member
0 Kudos

Hi,

I have four radio buttons on selection screen in a frame, all belonging to the same group.

When the program is called using transaction 1, first two radio buttons are displayed. When the program is called using transaction 2, bottom two radio must be displayed.

I am doing this using the following code.

The problem is : When last two are displayed, there is empty space left on the top and first two are displayed there is empty space left in the bottom of the frame. How can this be taken care of such there are no empty spaces in the box frame?

Code:

  • Radio Buttons for Table Name

SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-005.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : p_ot RADIOBUTTON GROUP grp1 MODIF ID one.

SELECTION-SCREEN COMMENT 5(31) text-001 FOR FIELD p_ot.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : p_exp RADIOBUTTON GROUP grp1 MODIF ID one.

SELECTION-SCREEN COMMENT 5(31) text-002 FOR FIELD p_exp.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : p_cost RADIOBUTTON GROUP grp1 MODIF ID two.

SELECTION-SCREEN COMMENT 5(31) text-003 FOR FIELD p_cost.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : p_att RADIOBUTTON GROUP grp1 MODIF ID two.

SELECTION-SCREEN COMMENT 5(31) text-004 FOR FIELD p_att.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK bl1.

----


  • Initialization

----


INITIALIZATION.

  • Display Table Names depending on transaction calling the program

PERFORM display_table_names.

FORM display_table_names.

DATA : l_mod_id(3) TYPE c.

IF sy-tcode EQ 'ZVTEST1'.

l_mod_id = 'ONE'.

ELSEIF sy-tcode EQ 'ZVTEST2'.

l_mod_id = 'TWO'.

ENDIF.

LOOP AT SCREEN.

IF screen-group1 EQ l_mod_id.

screen-invisible = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDFORM. " display_table_names

1 ACCEPTED SOLUTION

former_member378318
Contributor
0 Kudos

Better still just extend each of your SELECTION-SCREEN COMMENT commands with the MODIF ID addition like this:

SELECTION-SCREEN COMMENT 5(31) TEXT-001 FOR FIELD P_OT MODIF ID ONE.

This way both your radio button and comment will become hidden together.

5 REPLIES 5

Former Member
0 Kudos

hi,

use screen-ACTIVE = 0.

ur problem will be solved.

<b>if solved close the thread by marking helpfull answers.

feel free to ask question</b>

Regards

manoj.baijnath@wipro.com

Message was edited by: Manoj Gupta

former_member181962
Active Contributor
0 Kudos

Hi Vaishali,

YOU can create two differnet selection screens with two radio-buttons each, calling the appropriate one according your requirement(Calling from trx1/trx2).

That way you can create a feel of hiding the unwanted buttons.

Regards,

Ravi

former_member188685
Active Contributor
0 Kudos

Hi,



REPORT  Z_SALES MESSAGE-ID ZZ                          .

************************************************************************
*                             Variables                                *
************************************************************************

DATA: IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
      IT_MSGS LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

DATA: V_FILE TYPE STRING.

************************************************************************
*                         Internal Tables                              *
************************************************************************

DATA: BEGIN OF IT_SALES OCCURS 0,
        AUART,
        VKORG,
        VTWEG,
        BSTKD,
        KUNNR_KUNAG,
        KUNNR_KUNWE,
        KETDAT,
        KPRGBZ,
        PRSDT,
        BSTKD_1,
        KUNNR_KUNAG1,
        KUNNR_KUNWE1,
        KETDAT_1,
        KPRGBZ_1,
        PRSDT_1,
        ZTERM_1,
        INCO1,
        INCO2,
        MABNR,
        KWMENG,
        BSTKD_2,
        KUNNR_KUNAG2,
        KUNNR_KUNWE2,
        KETDAT_2,
        KPRGBZ_2,
        PRSDT_2,
        ZTERM_2,
        INCO1_1,
        INCO2_2,
        KSCHL,
        KBETR,
      END OF IT_SALES.


************************************************************************
*                       Selection-Screen                               *
************************************************************************

*Selection Screen 1

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_FILE(25) TYPE C,
             O_FILE(25) TYPE C.

SELECTION-SCREEN END OF BLOCK B1.

*Selection Screen 2

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

PARAMETERS: CAL_TRA RADIOBUTTON GROUP G1 USER-COMMAND FLAG,
            SESSION RADIOBUTTON GROUP G1 DEFAULT 'X'.

SELECTION-SCREEN END OF BLOCK B2.

*Selection Screen 3

SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.

PARAMETERS: MODE DEFAULT 'X' MODIF ID BL1,
            UPDATE DEFAULT 'X' MODIF ID BL1.

SELECTION-SCREEN END OF BLOCK B3.

*Selection Screen 4

SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-003.


PARAMETERS: SES_NAM(25) MODIF ID BL2,
            KEP_TRAS TYPE C DEFAULT 'X' MODIF ID BL2,
            LOC_DATE TYPE SY-DATUM MODIF ID BL2,
            USER TYPE SY-UNAME DEFAULT SY-UNAME MODIF ID BL2.

SELECTION-SCREEN END OF BLOCK B4.

************************************************************************
*                     At  Selection-Screen Output                      *
************************************************************************

AT SELECTION-SCREEN OUTPUT.


  IF CAL_TRA = 'X'.
    LOOP AT SCREEN.

      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  IF SESSION = 'X'.

    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '0'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.
  ENDIF.

************************************************************************
*                     At  Selection-Screen                             *
************************************************************************

AT SELECTION-SCREEN.

  PERFORM VALIDATE_MANDATORY_FIELDS.

************************************************************************
*****************            INITIALIZATION         ********************
************************************************************************

INITIALIZATION.

  LOC_DATE  = SY-DATUM - 1.
************************************************************************
*                       Start of Selection                             *
************************************************************************

START-OF-SELECTION.

  V_FILE = P_FILE.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                = V_FILE
      FILETYPE                = 'ASC'
      HAS_FIELD_SEPARATOR     = ' '
    TABLES
      DATA_TAB                = IT_SALES
    EXCEPTIONS
      FILE_OPEN_ERROR         = 1
      FILE_READ_ERROR         = 2
      NO_BATCH                = 3
      GUI_REFUSE_FILETRANSFER = 4
      INVALID_TYPE            = 5
      NO_AUTHORITY            = 6
      UNKNOWN_ERROR           = 7
      BAD_DATA_FORMAT         = 8
      HEADER_NOT_ALLOWED      = 9
      SEPARATOR_NOT_ALLOWED   = 10
      HEADER_TOO_LONG         = 11
      UNKNOWN_DP_ERROR        = 12
      ACCESS_DENIED           = 13
      DP_OUT_OF_MEMORY        = 14
      DISK_FULL               = 15
      DP_TIMEOUT              = 16
      OTHERS                  = 17.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


*&--------------------------------------------------------------------*
*&      Form  VALIDATE_MANDATORY_FIELDS
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM VALIDATE_MANDATORY_FIELDS.

  IF P_FILE IS INITIAL OR O_FILE IS INITIAL.

    MESSAGE E000 WITH 'ENTER BOTH THE FILE NAMES'.

  ENDIF.

  IF CAL_TRA = 'X'.

    IF MODE IS INITIAL OR UPDATE IS INITIAL.
      MESSAGE E000 WITH 'ENTER BOTH THE OPTIONS'.
    ENDIF.

    IF SY-SUBRC <> 0.

      IF MODE <> 'A' OR MODE <> 'E' OR MODE <> 'N'
      OR MODE <> 'a' OR MODE <> 'e' OR MODE <> 'n'.

        MESSAGE E000 WITH 'Mode should be either A, E or N'.

      ENDIF.

      IF UPDATE <> 'S' OR UPDATE <> 'A'
      OR UPDATE <> 's' OR UPDATE <> 'a'.

        MESSAGE E000 WITH 'Mode should be either S or A'.

      ENDIF.

    ENDIF.

  ENDIF.

  IF SESSION = 'x'.

    IF SES_NAM   IS INITIAL
    OR KEP_TRAS  IS INITIAL
    OR LOC_DATE  IS INITIAL
    OR USER      IS INITIAL.

      MESSAGE E000 WITH 'ENTER ALL THE FIELDS'.

    ENDIF.

  ENDIF.

ENDFORM.                    "VALIDATE_MANDATORY_FIELDS

Regards

vijay

former_member378318
Contributor
0 Kudos

Hahaha we have so many answers but its SO simple.

Your problem is very simple you are forgetting to HIDE the associated COMMENTS you have defined for the radio buttons! You must set to invisible not only the radio buttons but also the associated comments. You can test this by simply commenting out the SELECTION-SCREEN COMMENT command for now and your code will work.

Also it would be best if you moved the logic into the AT SELECTION-SCREEN OUTPUT as it makes most sense there.

If you wish to make the COMMENTS invisible you must first identify there SCREEN-NAME (eg. %F001003_1000) by running in debug and then in the LOOP AT SCREEN set the screen comment INVISIBLE = '0' for the SCREEN-NAME name you find in debug.

former_member378318
Contributor
0 Kudos

Better still just extend each of your SELECTION-SCREEN COMMENT commands with the MODIF ID addition like this:

SELECTION-SCREEN COMMENT 5(31) TEXT-001 FOR FIELD P_OT MODIF ID ONE.

This way both your radio button and comment will become hidden together.