Application Development 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: 

Table-control fields control by Username.

Former Member
0 Kudos

Hi,

I am having problem with Table control.

I created a screen having Table control.

This screen is used by 2 users . If User1 uses the 'Z' transaction for this table control screen, i want certain fields in Table control should be input.

The same when the User2 uses the same transaction for the screen, then the table control should not be input.

By userid , i have to made this.

I used If sy-uname = 'usr01'.

Loop at screen.

if screen-field = 'IT_TC1-MATNR'.

SCREEN-INPUT = 0.

endif.

modify screen.

endloop.

endif.

But it is not working.Pls suggest me.

Thanks in Advance,

Best Regards,

Pavan.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Pavan,

Could try out this piece of code instead ?

IF SY-UNAME = 'USER1'.
  LOOP AT TC-COLS-SCREEN.
    IF TC-COLS-SCREEN-NAME = 'IT_TC1-MATNR'
      TC-COLS-SCREEN-INPUT = 0.
      MODIFY TC-COLS-SCREEN.
    ENDIF. 
  ENDLOOP.
ENDIF.

Regards,

Anand Mandalika.

3 REPLIES 3

Former Member
0 Kudos

Hi,

1. Have you checked if this block of code is being executed? Is the IF condition being met? If you have written code exactly as you specified, you will have to change <b>IF sy-uname = 'USR01'</b> rather than <b>'usr01'</b>.

2. Have you put this code in PBO or PAI?

Regards

Message was edited by: Shehryar Khan

Former Member
0 Kudos

Hi Pavan,

Could try out this piece of code instead ?

IF SY-UNAME = 'USER1'.
  LOOP AT TC-COLS-SCREEN.
    IF TC-COLS-SCREEN-NAME = 'IT_TC1-MATNR'
      TC-COLS-SCREEN-INPUT = 0.
      MODIFY TC-COLS-SCREEN.
    ENDIF. 
  ENDLOOP.
ENDIF.

Regards,

Anand Mandalika.

Former Member
0 Kudos

Hi Pavan,

Put the code you have mentioned inside the LOOP... ENDLOOP for the table control. This will work. The LOOP AT SCREEN outside this loop only contains fields outside the table control.

Best regards,

Mayank