‎2009 Feb 02 5:20 AM
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!
‎2009 Feb 02 5:28 AM
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.
‎2009 Feb 02 5:25 AM
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.
‎2009 Feb 02 5:27 AM
‎2009 Feb 02 5:28 AM
‎2009 Feb 02 5:28 AM
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.
‎2009 Feb 02 5:34 AM
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
‎2009 Feb 02 5:45 AM
Hi,
i don't really see how you are going to specify which texts to disable without specifying their names.
‎2009 Feb 02 5:48 AM
Hi Dev,
I mean is there a command like
LOOP AT SCREEN.
IF current object IS INITIAL.
‎2009 Feb 02 5:57 AM
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
‎2009 Feb 02 5:30 AM
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.
‎2009 Feb 02 5:45 AM
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
‎2009 Feb 02 5:59 AM
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
‎2009 Feb 02 6:01 AM
Ravi and Kumar,
Thanks guys, I really appreciate your help. This what exactly I am looking for.
Thanks again,
Richard
‎2009 Feb 02 6:01 AM
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.