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: 

selection-screen

Former Member
0 Kudos

Hi ALL,

Hope all are doing fine!!!

parameters: c1 as checkbox default 'X',
                  c2 as checkbox.

selection-screen begin of block b1.
 select-options: fld1 for bukrs modif id group1,
                       fld2 for kunr modif id group1,
                       fld3 for belmr modif group2,                          
                       fld4 for gjahr modi group2.  
selection-screen end of block b1.

selection-screen begin of block b2.
 select-options: fld5 for bukrs modif id group1,
                       fld6 for kunr modif id group1,
selection-screen end of block b2.

my requirement is metioned below:

whenever user selects c1 flag.., only block b1 is mandatory.....and when user select c2 only block b2 is mandatory..

and at the same time,,if user selects c1 flag the group1 fields should be mandatory if group2 is not filled...,and vice versa i.e., group2 fields should be mandatory if group1 is not filled

Looking for possible resolutions for the same!!

Thanks & Regards,

John

Edited by: Julius Bussche on Jan 26, 2009 2:37 PM

Code tags added. You might want to try using the search as well as using a more meaningfull subject title in future.

6 REPLIES 6

faisal_altaf2
Active Contributor
0 Kudos

Hi,

Test the following code hope this will solve out ur problem,

TABLES: vttk, kna1.
 
 
SELECTION-SCREEN BEGIN OF BLOCK box WITH FRAME TITLE text-001.
PARAMETERS: p_email AS CHECKBOX USER-COMMAND flag .
SELECT-OPTIONS: email FOR kna1-kunnr LOWER CASE NO INTERVALS MODIF ID md1.
SELECTION-SCREEN END OF BLOCK box.
 
AT SELECTION-SCREEN OUTPUT.
  PERFORM set_screen.
 
*&---------------------------------------------------------------------*
*&      Form  set_screen
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM set_screen .
  IF p_email EQ 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'MD1'.
        screen-input = '1'.
        screen-invisible = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'MD1'.
        screen-input = '0'.
        screen-invisible = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDFORM.                    "set_screen

Please Reply if have any Issue,

Kind Regards,

Faisal

faisal_altaf2
Active Contributor
0 Kudos

Hi,

Test the following code, I have tested it is working exactly according to your requirement

TABLES kna1.

PARAMETERS: c1 RADIOBUTTON GROUP g USER-COMMAND a ,
            c2 RADIOBUTTON GROUP g .

SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECT-OPTIONS: fld1 FOR kna1-sortl MODIF ID gr1,
                fld2 FOR kna1-sortl MODIF ID gr1,
                fld3 FOR kna1-sortl MODIF ID gr1,
                fld4 FOR kna1-sortl MODIF ID gr1.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2.
SELECT-OPTIONS: fld5 FOR kna1-sortl MODIF ID gr2,
                fld6 FOR kna1-sortl MODIF ID gr2.
SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

  PERFORM set_screen.

*&---------------------------------------------------------------------*
*&      Form  set_screen
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM set_screen .
  IF c1 = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'GR1'.
        screen-required = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'GR2'.
        screen-required = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

ENDFORM.                    "set_screen

INITIALIZATION .
  c1 = 'X'.

Test Following too,


TABLES: kna1.
PARAMETERS: c1 RADIOBUTTON GROUP g USER-COMMAND a ,
            c2 RADIOBUTTON GROUP g .

SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECT-OPTIONS: fld1 FOR kna1-kunnr MODIF ID gr1,
                fld2 FOR kna1-kunnr MODIF ID gr1,
                fld3 FOR kna1-kunnr MODIF ID gr1,
                fld4 FOR kna1-kunnr MODIF ID gr1.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2.
SELECT-OPTIONS: fld5 FOR kna1-kunnr MODIF ID gr2,
                fld6 FOR kna1-kunnr MODIF ID gr2.
SELECTION-SCREEN END OF BLOCK b2.


AT SELECTION-SCREEN OUTPUT.

  PERFORM set_screen.

*&---------------------------------------------------------------------*
*&      Form  set_screen
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM set_screen .
  IF c1 = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'GR1'.
        screen-required = '1'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'GR2'.
        screen-required = '0'.
        screen-input = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
    CLEAR: fld5, fld5[], fld6, fld6[].
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'GR2'.
        screen-required = '1'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'GR1'.
        screen-required = '0'.
        screen-input = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
    CLEAR: fld1, fld1[], fld2, fld2[], fld3, fld3[], fld4, fld4[].
  ENDIF.

ENDFORM.                    "set_screen

INITIALIZATION .
  c1 = 'X'.

Please Reply if you need some thing else.

Kind Regards,

Faisal

Edited by: Faisal Altaf on Jan 26, 2009 8:06 PM

0 Kudos

Hi Faisal,

Thanks for your time!!!

But you mis-understood my requirement

As per my requirement group1,group2 are under same block b1

but u took it in other way,,by considering group1 in block b1 and group2 in block2...

group1,group2 are in the same block b1 ,,,,,,but not in two different blocks.

and at the same time ..,the group1 fields should be made mandatory if group2 fields are not filled and vice versa.,,,both group1 and group2 are under same block..

if we select c1 only block b1 should be activated and b2 should be hidden/de-activated/grayed-out..

.., if we select c2 only b2 should be activated and b1 should be hidden/de-activated/grayed-out

Thanks in Advance

Regards,

John

0 Kudos

hi John,

the sample code from Faisal completely covers your requirement, at least you can figure out, what you have to do in your own program. If you need a complete source code, which covers your exact requirement... than SDN is not the proper place for this.

all the best

ec

0 Kudos

Hi John,

Please post full contact details for your client, including hidden / de-activated / greyed-out decision maker's names.

We will do the needfull.

Cheers,

Julius

nkr1shna
Contributor
0 Kudos

Hi John,

You can achieve your requirement by validating checkbox in ON... construct and using the message type E which blocks users from proceeding further before entering programtic manditatory selection-field.

Best Regards,

Krishna