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

input enable

Former Member
0 Likes
1,390

Dear Friends,

Query:- there are 2 check boxes and also 2 selection blocks are there in the selection screen,

parameters: check1 as checkbox default 'X',

check2 as checkbox.

selection-screen begin of block b1,

select-options: field1 for -- modif id g1,

field2----


modif id g1,

field n -


modif id g1,

selection-screen end of block b1.

selection-screen begin of block b2,

select-options: field1 for -- modif id g2,

field2----


modif id g2,

field n -


modif id g2,

selection-screen end of block b2.

the block b1/group g1 must be input enabled if i click on either of two check boxess,,, the block b2/group g2 must be input enabled if i click only on 1st check box only but not on 2nd check box.

i.e.., if i click only on 2nd check box the block b1/group g1 must be input enabled and block b2/group g2 must be input disabled.

I have written the following for input enabling and disabling the blocks based on selection of check boxes , but its not working friends.

at selection-screen output.

if check1 = 'X'.

loop at screen.

if screen-group1 = 'G1' or screen-group1 = 'G2'.

screen-input = '1'. "input enabling

modify screen.

endif.

endloop.

elseif check2 = 'X'.

loop at screen.

if screen-group1 = 'G2'

screen-input = '0'. " input disabling

modify screen.

else

screen-input = '1'.

modify screen.

endif.

endloop.

endif.

for the above code , the selection-screen itself is changing ...

Would be greatful if someone can suggest me the changes in the code or solution for the requirement as mentioned above..

Please feel free to reply back if any clarifications needed in the code/requirement

Thanks in Advance friends

Bye

Jack

1 ACCEPTED SOLUTION
Read only

valter_oliveira
Active Contributor
0 Likes
1,353

Hello there.

I would recommend user command to the checkboxes to automatically make the groups to appear / dissapear.

So, I would propose something like:


PARAMETERS: check1 AS CHECKBOX DEFAULT 'X' USER-COMMAND rad,
            check2 AS CHECKBOX.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    CASE screen-group1.
      WHEN 'G1'.
        IF check1 = 'X' OR check2 = 'X'.
          screen-input = '1'. "input enabling
        ELSE.
          screen-input = '0'. "input disabling
        ENDIF.
        MODIFY SCREEN.
      WHEN 'G2'.
        IF check1 = 'X' and check2 = space.
          screen-input = '1'. "input enabling
        ELSE.
          screen-input = '0'. "input disabling
        ENDIF.
        MODIFY SCREEN.
      WHEN OTHERS.
    ENDCASE.
  ENDLOOP.

Regards,

Valter Oliveira.

15 REPLIES 15
Read only

faisalatsap
Active Contributor
0 Likes
1,353

Hi, Jack

Please Have a Look at the following Thread and the the Sample code Send by me,

Specially in the 2nd Reply

Hope will solve out your problem,

[selection-screen |]

Please Reply if any Problem,

Kind Regards,

Faisal

Edited by: Faisal Altaf on Feb 1, 2009 7:18 PM

Read only

0 Likes
1,353

Dear Faisal,

the screen-required option makes the field as mandatory ,,!!! which is really not suitable,,

and also the fields are being cleared ???

Thanks for the quick reply

Cheers

Jack

Read only

0 Likes
1,353

Hi, Jack,

Test the following now it is working fine, Hope this time Solve your problem,

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-input = '0'.
        screen-invisible = '1'.
*        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'.
        screen-invisible = '1'.
        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 and else issue,

Kind Regards,

Faisal

Read only

0 Likes
1,353

Dear Faisal,,

I think it should work,,,i'll have to test and do the necessay changes .but this is for checkboxes my dear friend and not for radio button....which differs in functionality....

anyway thanks for your atmost interest ...ill be given points to you if i can get rid off with your kind solution

Cheers

Jack

Read only

0 Likes
1,353

Hi, Jack

Test the following this time i use Check Boxes, Hope will Help you using CheckBoxes.

TABLES: kna1.
PARAMETERS: c1 AS CHECKBOX DEFAULT 'X' USER-COMMAND a ,
            c2 AS CHECKBOX DEFAULT 'X' USER-COMMAND a .

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 c2 = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'GR2'.
        screen-input = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'GR2'.
        screen-input = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
  IF c1 = 'X' .
    LOOP AT SCREEN.
      IF screen-group1 = 'GR1'.
        screen-input = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'GR1'.
        screen-input = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDFORM.                    "set_screen

Please Reply if any issue.

Kind Regards,

Faisal

Edited by: Faisal Altaf on Feb 1, 2009 8:36 PM

Read only

valter_oliveira
Active Contributor
0 Likes
1,354

Hello there.

I would recommend user command to the checkboxes to automatically make the groups to appear / dissapear.

So, I would propose something like:


PARAMETERS: check1 AS CHECKBOX DEFAULT 'X' USER-COMMAND rad,
            check2 AS CHECKBOX.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    CASE screen-group1.
      WHEN 'G1'.
        IF check1 = 'X' OR check2 = 'X'.
          screen-input = '1'. "input enabling
        ELSE.
          screen-input = '0'. "input disabling
        ENDIF.
        MODIFY SCREEN.
      WHEN 'G2'.
        IF check1 = 'X' and check2 = space.
          screen-input = '1'. "input enabling
        ELSE.
          screen-input = '0'. "input disabling
        ENDIF.
        MODIFY SCREEN.
      WHEN OTHERS.
    ENDCASE.
  ENDLOOP.

Regards,

Valter Oliveira.

Read only

0 Likes
1,353

Hi Valter,

Thanks for your response!

i have written the following code as per your suggestion and its working fine for input enable or disable as per the selection of check boxes in the selection-screen.

at selection-screen output.

LOOP AT SCREEN.

CASE screen-group1.

WHEN 'GR1'.

IF c1 = 'X' OR c2 = 'X'.

screen-input = '1'. "input enabling

ELSE.

screen-input = '0'. "input disabling

ENDIF.

MODIFY SCREEN.

WHEN 'GR2'.

IF c1 = 'X' and c2 = space.

screen-input = '1'. "input enabling

ELSE.

screen-input = '0'. "input disabling

ENDIF.

MODIFY SCREEN.

WHEN OTHERS.

ENDCASE.

ENDLOOP.

but i really don't understand why i'm getting another small box in the selection screen beside the low value

Thanks in Advance

Jack

Read only

0 Likes
1,353

Hi, Jack

My Last Code is not working Properly ?

I have tested I think it is working according to your Requirements.

Please Reply.

Kind Regards,

Faisal

Read only

0 Likes
1,353

Hi Faisal,

Thanks for your solution,, Ur answer is also working ....,but we are getting a small box beside the low value in the selection-screen...

even am trying on it y we are getting this box ??

Cheers

Jack

Read only

Former Member
0 Likes
1,353

Hi

the block b1/group g1 must be input enabled if i click on either of two check boxess,,, the block b2/group g2 must be input enabled if i click only on 1st check box only but not on 2nd check box.

i.e.., if i click only on 2nd check box the block b1/group g1 must be input enabled and block b2/group g2 must be input disabled.

AT SELECTION-SCREEN OUTPUT.

IF CHK2 = 'X'  AND CHK1 NE 'X'.
      LOOP AT SCREEN.
            CASE SCREEN-GROUP.
                WHEN 'G1'.
                  SCREEN-INPUT = 1.
                  MODIFY SCREEN.
                WHEN 'G2'.
                  SCREEN-INPUT = 0.
                  MODIFY SCREEN.
           ENDCASE.
       ENDLOOP.
ELSE IF CHK1 = 'X' AND CHK2 NE 'X'.
       LOOP AT SCREEN.
            CASE SCREEN-GROUP.
                WHEN 'G1'.
                  SCREEN-INPUT = 1.
                  MODIFY SCREEN.
                WHEN 'G2'.
                  SCREEN-INPUT = 1.
                  MODIFY SCREEN.
           ENDCASE.
       ENDLOOP.
ELSE IF CHK1 = 'X' AND CHK2 = 'X'.
        LOOP AT SCREEN.
            IF SCREEN-GROUP = 'G1'.
                  SCREEN-INPUT = 1.
                  MODIFY SCREEN.
           ENDIF.
       ENDLOOP.
ELSE.
         LOOP AT SCREEN.
            IF SCREEN-GROUP = 'G1' OR SCREEN-GROUP = 'G2'.
                  SCREEN-INPUT = 0.
                  MODIFY SCREEN.
           ENDIF.
       ENDLOOP.
 ENDIF.

Hope this helps

Regards,

Jayanthi.K

Read only

Former Member
0 Likes
1,353

Hi,

Try out this code,

parameters: check1 as checkbox user-command act,
check2 as checkbox user-command act.

AT SELECTION-SCREEN OUTPUT.

  if check1 = 'X'.
    loop at screen.
      if screen-group1 = 'G1' or screen-group1 = 'G2'.
        screen-input = 1.
        modify screen.
      endif.
    endloop.
  elseif check2 = 'X'.
    loop at screen.
      if screen-group1 = 'G2'.
        screen-input = 0.
        modify screen.
      endif.
    endloop.
  elseif check1 = 'X' and check2 = 'X'.
    loop at screen.
      if screen-group1 = 'G2'.
        screen-input = 0.
        modify screen.
      endif.
    endloop.
  endif.

Hope this helps.

Regards,

Deepthi.

Read only

valter_oliveira
Active Contributor
0 Likes
1,353

but i really don't understand why i'm getting another small box in the selection screen beside the low value

Could you be a bit more specific? I could not understand the issue. Here, the code I wrote seems fine.


TABLES: mara.

SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECT-OPTIONS: field1 FOR mara-matnr MODIF ID g1,
                field2 FOR mara-matnr MODIF ID g1.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2.
SELECT-OPTIONS: field3 FOR mara-matnr MODIF ID g2,
                fiel24 FOR mara-matnr MODIF ID g2.
SELECTION-SCREEN END OF BLOCK b2.

PARAMETERS: check1 AS CHECKBOX DEFAULT 'X' USER-COMMAND rad,
            check2 AS CHECKBOX DEFAULT space USER-COMMAND rad.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    CASE screen-group1.
      WHEN 'G1'.
        IF check1 = 'X' OR check2 = 'X'.
          screen-input = '1'. "input enabling
        ELSE.
          screen-input = '0'. "input disabling
        ENDIF.
        MODIFY SCREEN.
      WHEN 'G2'.
        IF check1 = 'X' AND check2 = space.
          screen-input = '1'. "input enabling
        ELSE.
          screen-input = '0'. "input disabling
        ENDIF.
        MODIFY SCREEN.
      WHEN OTHERS.
    ENDCASE.
  ENDLOOP.

Regards,

Valter Oliveira.

Read only

0 Likes
1,353

Hi Valter,

If you can provide me your email-id , i can send you the screen shot, because i cannot paste the screen shots over here...so that u can get a clear picture about the current issue by seeing the screen shot..

thanks

Jack

Read only

0 Likes
1,353
Read only

0 Likes
1,353

Hi Valter,

I have sent screen shot regarding the issue which am facing now to your hotmail id.Pls have a look..,

Thanks in Advance

Jack