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

loop at screen query

Former Member
0 Likes
2,136

Hi all,

i want to make a particular field inactive when i select a checkbox.. for this i need to write loop at screen.

but how ll i mention for this filed inactive a particular field and where do we need to write this loop at.?? in which event?

16 REPLIES 16
Read only

Former Member
0 Likes
1,898

Hi ,

use can use this.

AT SELECTION-SCREEN OUTPUT.

if chekbox = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC1'.

SCREEN-INTENSIFIED = '1'.

MODIFY SCREEN.

CONTINUE.

ENDIF.

IF SCREEN-GROUP1 = 'SC2'.

SCREEN-INTENSIFIED = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

endif.

Please let me know if you still need any more help.

Thanks and regards,

Rajeshwar.

Read only

sridhar_meesala
Active Contributor
0 Likes
1,898

Hi,

I think you have to write it in AT SELECTION-SCREEN EVENT

LOOP AT SCREEN.
IFscreen-name = 'p_name'.
Screen-Input = 0.
Modify Screen.
ENDIF.
ENDLOOP.

Thanks,

Sri.

Edited by: Sri on Jul 16, 2009 10:35 AM

Read only

Former Member
0 Likes
1,898

HI,

Use AT SELECTION-SCREEN EVENT as follows:

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF PR_FERT = 'X' AND SCREEN-NAME = 'P_MTART' AND P_MTART EQ SPACE.

P_MTART = 'FERT'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ELSEIF PR_FERT = 'X' AND SCREEN-NAME = 'P_MTART'.

P_MTART = 'FERT'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ELSEIF PR_FGBO = 'X' AND SCREEN-NAME = 'P_MTART'.

P_MTART = 'FGBO'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ELSEIF PR_FGEQ = 'X' AND SCREEN-NAME = 'P_MTART'.

P_MTART = 'FGBO'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ELSEIF PR_ALL = 'X'.

IF P_MTART = 'FGBO' OR P_MTART = 'FERT'.

CLEAR P_MTART.

ENDIF.

ENDIF.

ENDLOOP.

This is a sample code for material related Selection Screen.

Regds,

Anil

Read only

Former Member
0 Likes
1,898

Hi,

Check this



PARAMETERS: P_CHECK AS CHECKBOX USER-COMMAND FLAG,
                         P_FPATH TYPE RLGRAP-FILENAME.


AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF P_CHECK EQ 'X'.
        IF SCREEN-NAME EQ 'P_FPATH'.
          SCREEN-INPUT = '1'.
          MODIFY SCREEN.
        ENDIF.
      ELSE.
          IF SCREEN-NAME EQ 'P_FPATH'.
          SCREEN-INPUT = '0'.
          MODIFY SCREEN.
        ENDIF.
      ENDIF.
    ENDLOOP.

Read only

Former Member
0 Likes
1,898

Hi ,

You should write the code means loop at screen at the AT SELECTION-SCREEN OUTPUT event.

"AT SELECTION-SCREEN OUTPUT event--------------------------------------
AT SELECTION-SCREEN OUTPUT .
*Looping at SCREEN table to modify the table----------------------------
  LOOP AT SCREEN .
    IF  p_chkbox EQ 'X' .
      IF screen-name CS 'FIELD_NAME' .
        screen-active = 0 .
      ENDIF.                           " IF SCREEN-GROUP1 EQ 'GRP' .
      MODIFY SCREEN.
    ENDIF.                             " IF P_USER IS INITIAL .
  ENDLOOP.                             " LOOP AT SCREEN .

You can check this link also for similar type reqirement with radiobuttons - -

[https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=111870085]

Regards

Pinaki

Read only

0 Likes
1,898

its not working for me...

Read only

0 Likes
1,898

Hi Poonam,

Try like this.

AT SELECTION-SCREEN OUTPUT .

*Looping at SCREEN table to modify the table----


LOOP AT SCREEN .

IF p_chkbox EQ 'X' .

IF screen-name = s_field-low .

screen-active = 0 .

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Regards,

Vijay

Read only

0 Likes
1,898

Are u doing module Pool programming or normal Report.

In module pool write in PBO

Read only

0 Likes
1,898

Hi,

I guess its better to add it to PBO and PAI both. i.e to 'at selection screen' and 'at selection screen output'.

Also you need to analyze at runtime as where exactly you are missing. ensure that you are using Uppercase in quotes while mentioning the fieldname/fieldgroup.

Regards,

Nirmal

Read only

0 Likes
1,898

I have used as default 'X' for that check box so it ll not work in at selection-screen output..

i guess i shud not write it here/.

Read only

0 Likes
1,898

Hi Poonam,

Would you please send your code so that I can analyze because the following code

is working fine here only you need to ENTER after clicking or unchecking the checkbox.

PARAMETERS : p_chkbox TYPE c AS CHECKBOX DEFAULT 'X',
             field TYPE char5.

AT SELECTION-SCREEN OUTPUT .

  LOOP AT SCREEN .
    IF  p_chkbox EQ 'X' .
      IF screen-name CS 'FIELD' .
        screen-active = 0 .
      ENDIF.                          
      MODIFY SCREEN.
    ENDIF.                            
  ENDLOOP.                             " LOOP AT SCREEN .

Regards

Pinaki

Read only

0 Likes
1,898

Hi pinaki,

i want to check if checkbox is initial.

then make screen-active = 0.

Read only

0 Likes
1,898

Then write the code like that only --

PARAMETERS : p_chkbox TYPE c AS CHECKBOX DEFAULT 'X',
             field TYPE char5.
 
AT SELECTION-SCREEN OUTPUT .
 
  LOOP AT SCREEN .
    IF  p_chkbox NE 'X' .  " Instead of EQ use NE
      IF screen-name CS 'FIELD' .
        screen-active = 0 .
      ENDIF.                          
      MODIFY SCREEN.
    ENDIF.                            
  ENDLOOP.                             

Hope this will resolve issue .

Regards

Pinaki

Read only

0 Likes
1,898

Hi,

I guess you are missing the addition USER-COMMAND. Try this.

PARAMETERS : p_chkbox TYPE c AS CHECKBOX DEFAULT 'X' USER-COMMAND rad,

field TYPE char5.

AT SELECTION-SCREEN OUTPUT .

IF p_chkbox EQ 'X'.

LOOP AT SCREEN .

IF screen-name CS 'FIELD' .

screen-active = 1 .

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSE.

LOOP AT SCREEN .

IF screen-name CS 'FIELD' .

screen-active = 0 .

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

AT SELECTION-SCREEN.

IF p_chkbox EQ 'X'.

LOOP AT SCREEN .

IF screen-name CS 'FIELD' .

screen-active = 1 .

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSE.

LOOP AT SCREEN .

IF screen-name CS 'FIELD' .

screen-active = 0 .

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Regards,

Nirmal

Read only

0 Likes
1,898

PARAMETERS : p_cst as checkbox DEFAULT 'X' USER-COMMAND gtx.

AT SELECTION-SCREEN.

LOOP AT SCREEN .

*Disabling the field rep name

IF screen-name CS 'p_pname'. " name of the parameter you want to mak in active...

screen-input = '0'.

screen-output = '1'.

ENDIF.

MODIFY SCREEN.

CLEAR screen.

ENDLOOP.

Read only

Former Member
0 Likes
1,898

To do this, you need to use the event AT SELECTION-SCREEN OUTPUT.

Here, you should check according to field group, and for both "checked and "unchecked" options. So there will be four scenarios to check as follows (don't forget to write MODIFY SCREEN!!):

If rb = 'X'.

loop at screen.

if screen-group1' = 'G1'.

screen-invisible = '1'.

screen-active = '0'.

modify screen.

else.

screen-invisible = '0'.

screen-active = '1'.

modify screen.

endif.

endloop.

elseif rb = ' '.

loop at screen.

if screen-group1' = 'G1'.

screen-invisible = '0'.

screen-active = '1'.

modify screen.

else.

screen-invisible = '1'.

screen-active = '0'.

modify screen.

endif.

endloop.

endif.

Hope this helps!

Cheers,

Shailesh.