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

Former Member
0 Likes
1,505

I was trying to loop on every object on the screen using the LOOP AT SCREEN code. What I'm trying to do is to disable all textbox that has a value. I was trying to do something like the code below:

LOOP AT SCREEN.

  IF current textbox has a value.

    SCREEN-INPUT = '0'.

    MODIFY SCREEN.

  ENDIF.

ENDLOOP.

can anyone help me with the correct syntax or code for this? Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,432

Hi,

Try using this code,

PARAMETERS: field1 modif id fid.

LOOP AT SCREEN.

IF screen-group1 = 'FID'.

IF field1 IS NOT INITIAL.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

You can assign different modif id to the textboxes, check the screen-group1 and do the processing.

Hope this helps.

Regards,

Deepthi.

13 REPLIES 13
Read only

Former Member
0 Likes
1,432

Hi,

Check this one , will help u

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS : p_meth1 RADIOBUTTON GROUP g1 USER-COMMAND g1,

p_meth2 RADIOBUTTON GROUP g1.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK matnr

WITH FRAME TITLE text-002.

SELECTION-SCREEN SKIP 1.

SELECT-OPTIONS : so_matnr FOR marc-matnr MODIF ID m1.

SELECTION-SCREEN SKIP 1.

SELECT-OPTIONS : so_werks FOR marc-werks MODIF ID m1 .

SELECTION-SCREEN END OF BLOCK matnr.

SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-003.

SELECTION-SCREEN SKIP 1.

PARAMETERS: p_fpath TYPE ibipparms-path MODIF ID m2 LOWER CASE.

SELECTION-SCREEN END OF BLOCK file.

SELECTION-SCREEN BEGIN OF BLOCK date WITH FRAME TITLE text-004.

SELECTION-SCREEN SKIP 1.

PARAMETERS : p_date TYPE datuv. "CCT51576.

SELECTION-SCREEN END OF BLOCK date.

***************************************************************************************

***********************Screen Validation*********************************************

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

CASE screen-group1.

WHEN 'M1'.

IF p_meth1 <> 'X'.

screen-active = 1.

ENDIF.

IF p_meth2 = 'X'.

screen-active = 0.

ENDIF.

WHEN 'M2'.

IF p_meth2 = 'X'.

screen-active = 1.

ELSE.

screen-active = 0.

ENDIF.

IF p_meth1 = 'X'.

screen-active = 0.

ENDIF.

ENDCASE.

MODIFY SCREEN.

Read only

Former Member
0 Likes
1,432

Guess u gve the correct syntax.

Read only

Former Member
0 Likes
1,432

Hi.

The following link contain the detail abt ur issue.Hope it will help u a lot

Read only

Former Member
0 Likes
1,433

Hi,

Try using this code,

PARAMETERS: field1 modif id fid.

LOOP AT SCREEN.

IF screen-group1 = 'FID'.

IF field1 IS NOT INITIAL.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

You can assign different modif id to the textboxes, check the screen-group1 and do the processing.

Hope this helps.

Regards,

Deepthi.

Read only

0 Likes
1,432

Deepthi,

Thanks for your reply, but I dont want to hardcode the field name like "IF field1 IS NOT INITIAL". I have more than 30 textboxes on a single screen and I want to disable all textbox that already has a value every time a user view the screen. So is there any way I can do this with out harcoding every textboxes one by one.

Thanks,

Richard

Read only

0 Likes
1,432

Hi,

i don't really see how you are going to specify which texts to disable without specifying their names.

Read only

0 Likes
1,432

Hi Dev,

I mean is there a command like

LOOP AT SCREEN.

&nbsp;&nbsp;IF current object IS INITIAL.

Read only

0 Likes
1,432

Hi Richard,

Can you try this code and check. Does this satisfy your requirement ?

PARAMETERS: P1 MODIF ID P,
            P2 MODIF ID P,
            P3 MODIF ID P.

FIELD-SYMBOLS : <FS> TYPE ANY.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'P'.

      ASSIGN (SCREEN-NAME) TO <FS>.

      IF <FS> IS NOT INITIAL.
        SCREEN-INPUT = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

Regards

Read only

Former Member
0 Likes
1,432

Hi,

Hope this will help u.


PARAMETER: val type string,
           val1 TYPE string DEFAULT 'hi' .

AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN .
if val1 is NOT INITIAL.
   screen-input = 0.
  MODIFY SCREEN.
  ENDIF.

ENDLOOP.

Thanks.

Read only

0 Likes
1,432

Rajkumar,

Thanks for your reply, but I dont want to hardcode the field name like "IF field1 IS NOT INITIAL". I have more than 30 textboxes on a single screen and I want to disable all textbox that already has a value every time a user view the screen. So is there any way I can do this with out harcoding every textboxes one by one.

Thanks,

Richard

Read only

Former Member
0 Likes
1,432

Hi,

Assign screen-group1 as 'G1' for all i/o boxes, then

FIELD-SYMBOLS: <fs_txt> TYPE ANY.
....
   LOOP AT SCREEN.
    IF screen-group1 = 'G1'.
      ASSIGN (screen-name) TO <fs_txt>.
      IF NOT <fs_txt> IS INITIAL.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

Hope this helps you.

Regards,

Manoj Kumar P

Read only

0 Likes
1,432

Ravi and Kumar,

Thanks guys, I really appreciate your help. This what exactly I am looking for.

Thanks again,

Richard

Read only

former_member784222
Active Participant
0 Likes
1,432

Hi Richard,

Try something like this:

data: fieldtext(60).
field-symbols:<fs> type any.

loop at screen.
  fieldtext = screen-name.
  assign (fieldtext) to <fs>.
   if sy-subrc <> 4. 
    if <fs> is not initial.
         SCREEN-INPUT = '0'.
          MODIFY SCREEN.      
         endif.
   endif.
endloop.

regards,

S. Chandramouli.