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

TOGGLE - MAKE FIELDS VISIBLE AND INVISIBLE

Former Member
0 Likes
1,466

Hi All,

I have placed a Table control . I have 6 fields including Customer and Customer Name field. It will not be displayed by default. If I press a button , those two fields should be made visible. Again if i press the Button , it should be invisible. toggle between Vsible and Invisible.

Example : Its like the Customer Button in MD04 transaction.

Kindly give me the code to do this.

Regards and thanks in advance.

Suki

8 REPLIES 8
Read only

Former Member
0 Likes
1,005

case sy-ucomm.

when 'ENT1'.

loop at screen.

if screen-name = field name.

screen-input = '1'.

modify screen .

endif.

when 'ur disable button'.

loop at screen.

if screen-name = field name.

screen-input = '0'..

modify screen .

endif.

endcase.

reward points if it is useful

Thanks

Seshu

Read only

Former Member
0 Likes
1,005

Suki,

Check the below links ..... similar queries discussed here

~~Guduri

Read only

0 Likes
1,005

Ya Naveen,

Thank you for the response.

My requirement is first time when i click the button it should display the fields.

Second time when i click the button , the fields should be invisible. Like this the fields should be made visible and invisible when ever iclick the same button.

waiting for ur response.

Suki.

Read only

0 Likes
1,005

can you send the code ?

Read only

0 Likes
1,005

hai Seshu,

If u go to MD04 transaction , u can see a button "CUSTOMER" at the bottom.

just the same functionality i need.

The code :

MODULE TC_LSTAT_CHANGE_TC_ATTR.

DATA: BEGIN OF WA_CTRL,

SCREEN LIKE SCREEN,

INDEX TYPE I,

SELECTED(1) TYPE C,

VISLENGTH LIKE ICON-OLENG,

INVISIBLE(1) TYPE C,

END OF WA_CTRL.

LOOP AT TC_LSTAT-COLS INTO WA_CTRL.

IF WA_CTRL-SCREEN-GROUP1 = 'G1'.

IF FLAGCUST = 'X'.

WA_CTRL-SCREEN-INPUT = 0.

WA_CTRL-INVISIBLE = '0'.

MODIFY TC_LSTAT-COLS FROM WA_CTRL.

ELSEIF FLAGCUST = ' '.

WA_CTRL-SCREEN-INPUT = 0.

WA_CTRL-INVISIBLE = '1'.

MODIFY TC_LSTAT-COLS FROM WA_CTRL.

ENDIF.

ENDIF.

CLEAR WA_CTRL.

ENDLOOP.

ENDMODULE. "TC_LSTAT_CHANGE_TC_ATTR OUTPUT

MODULE TC_LSTAT_USER_COMMAND INPUT.

CASE OKCODE.

WHEN 'CUST'.

FLAGCUST = 'X'.

ENDMODULE.

Thanks in advance.

Suki.

Read only

0 Likes
1,005

I have given first reply,then try to use same logic you will get it.

Reward points if it is helpful

Thanks

Seshu

Read only

Former Member
0 Likes
1,005

Hi Suki,

We can perform various manipulation on the screen elements using the statement LOOP AT SCREEN.

But that is useful in PBO only...

I suppose your requirement is like this....

When you click on a button, the screen element should be made visible or invisible...

You can do like this...

Initially, you can keep the two fields under the same group (say 'GR1')

1) Define a global variable (say FLAG) which is initialised to zero.

2) In PBO module , write like this

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'GR1' AND FLAG = 0.

SCREEN-ACTIVE = 0.

ELSE.

SCREEN-ACTIVE = 1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

) At PAI Module, set the flag to 1 for the function code for button click

CASE SY-UCOMM.

WHEN 'CLICK'.

if flag = 0.

flag = 1.

else

flag = 0.

endif.

ENDCASE.

This will solve your problem .

Regards,

SP.

Read only

Former Member
0 Likes
1,005

hi suki,

I have placed a Table control . I have 6 fields including Customer and Customer Name field. It will not be displayed by default. If I press a button , those two fields should be made visible. Again if i press the Button , it should be invisible. toggle between Vsible and Invisible.

Example : Its like the Customer Button in MD04 transaction.

IN PBO MODULE.

LOOP AT SCREEN.

IF SCREEN-NAME = 'CUSTOMER'

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

IF SCREEN-NAME = 'CUSTOMERNAME'

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

IN PBO MODULE.

CASE SY-UCOMM.

WHEN 'OTHERS'

SCREEN-NAME = 'CUSTOMER'.

SCREEN-INPUT = 1.

SCREEN-NAME = 'CUSTOMERNAME'

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDCASE.

if helpful reward some points.

with regards,

suresh babu aluri.