‎2009 Jan 06 9:41 AM
Hi experts,
I have a table control on a screen, and I have a Display/Change button. I want to change the attributes according to this button.
I try to do the following:
LOOP AT SCREEN.
IF screen-group1 = 'G1'.
screen-input = 1.
screen-display_3d = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
If I execute the program, no matter wheter it is a change or display mode, the attributes do not change on screen. However I can see the change in debuge mode, the screen parameters are set to 1 (input, display_3d).
‎2009 Jan 06 10:10 AM
hi,
i think that you have two transaction one is for display and second is for change.. right???
so for this
for transaction display
this module should be in pbo
module DEACTIVATE output.
if sy-tcode = 'ZDISPLAY' >>>> name of transaction
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'G1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
endmodule.
for change
if sy-tcode = 'ZCHANGE' >>>> name of transaction
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'G1'.
SCREEN-INPUT = 1 .
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
endmodule.
hope it helps you.
revert me back if u have ny queries
thanks
Sachin
‎2009 Jan 06 9:51 AM
Hi,
Say for a set of textboxes you take group1 in their attributes as 'ABC', and on some condition you want to switch their mode from CHANGE/DISPLAY and vice-a-versa.
Use it this way, its working:-
In PBO of screen.
if <condition>.
loop at screen.
if screen-group1 = 'ABC'.
screen-input = 0. " to change the mode of textbox as display mode
screen-active = 0.
endif.
modify screen.
endloop.
elseif <condition>.
loop at screen.
if screen-group1 = 'ABC'.
screen-input = 1. " to change the mode of textbox as change mode
screen-active = 1.
endif.
modify screen.
endloop.
endif.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
‎2009 Jan 06 9:59 AM
Tarun,
I set the group on the screen before, I set the attributes also, but my code has no effect :'(
Maybe I'm wrong, but I don't know what could be the solution to fix the program.
‎2009 Jan 06 10:02 AM
Hi,
In attributes for textbox controls that you have placed on the screen, take group1 as 'ABC' i.e., for all fields whose mode neeed to be changed.
See if it works, or provide me with your code.
I will try and solve ASAP.
Thanks & Regards,
Tarun Gambhir
‎2009 Jan 06 10:14 AM
Hi,
Say if you have button DISPLAY and CHANGE to swap the modes of the fields, then you need to check the sy-ucomm and then use the earlier code.
CASE sy-ucomm.
WHEN 'CHANGE'.
loop at screen.
if screen-group1 = 'ABC'.
screen-input = 1. " to change the mode of textbox as change mode
screen-active = 1.
endif.
modify screen.
endloop.
WHEN 'DISPLAY'
loop at screen.
if screen-group1 = 'ABC'.
screen-input = 0. " to change the mode of textbox as display mode
screen-active = 0.
endif.
modify screen.
endloop.
ENDCASE.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
‎2009 Jan 06 10:44 AM
I have the MODIFY SCREEN statement, and in DEBUG mode it seems to set it, but nothing has changed on the screen. It can be set somewhere else also? I don't understand because I have simple input fields on the screen also, and in case of them the Change/display is working properly.
‎2009 Jan 06 11:00 AM
Hi,
If you are using table control, you can only enable/disable the columns for the records.
You can't enable/disable a row to edit or display.
Either all fields for all records will be in display or change mode.
But you can definitely enable/disable common columns for all the records in the table control.
So its advisable that when you swap the mode, then in change mode keep the primary key fields of the table in display mode and apply change mode to other columns using the above code.
And disable input when you click display button i.e., input = 0.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
‎2009 Jan 06 10:10 AM
hi,
i think that you have two transaction one is for display and second is for change.. right???
so for this
for transaction display
this module should be in pbo
module DEACTIVATE output.
if sy-tcode = 'ZDISPLAY' >>>> name of transaction
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'G1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
endmodule.
for change
if sy-tcode = 'ZCHANGE' >>>> name of transaction
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'G1'.
SCREEN-INPUT = 1 .
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
endmodule.
hope it helps you.
revert me back if u have ny queries
thanks
Sachin
‎2009 Jan 13 9:33 AM