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

Table control attribute change

Former Member
0 Likes
1,278

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).

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,067

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

8 REPLIES 8
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,067

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

Read only

Former Member
0 Likes
1,067

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.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,067

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

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,067

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

Read only

Former Member
0 Likes
1,067

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.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,067

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

Read only

Former Member
0 Likes
1,068

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

Read only

Former Member
0 Likes
1,067

Thanks