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

Modifying Screen Attributes Dynamically

Former Member
0 Likes
1,317

Hi Everyone!

I have added three custom fields into a new infotype/subtype.

Everything is working fine when I use PA20 to display a persons

data for this new infotype i.e. the three new fields are being displayed.

However, if I use PA30 (Change) the three new fields are still in display only

mode and does not allow any user input for these new fields.

The code below is what I am using:

IF p0019-tmart = '61'. " New Subtype 61

LOOP AT SCREEN.

IF screen-group1 = 'CRB'. " I have added this as a modification group

screen-active = '1'.

MODIFY SCREEN.

ELSE.

screen-active = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Do I have to make the distinction between PA20/PA30 when activating?

Cheers

Andy

9 REPLIES 9
Read only

Former Member
0 Likes
1,043

Hi Andy,

IF screen-group1 = 'CRB'.

screen-active = '1'.

screen-input = 1 . " you can use it for input

MODIFY SCREEN.

ELSE.

screen-active = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

hope this helps

Read only

Former Member
0 Likes
1,043

Hi Andy,

You just need to include the transaction codes as well while checking for the modification groups.

Suppose you have 3 fields on the screen A,B & C-->MOD is modification group for them. You wan to keep them display only in T1 transaction & allowed for change in T2 transaction. Then the code would be:

LOOP AT SCREEN.

IF screen-group1 = 'MOD' AND sy-tcode = 'T1'.

screen-active = 0.

ELSE.

screen-active = 1.

ENDIF.

Regards,

Chetan.

Reward points if this helps.

Read only

0 Likes
1,043

Chetan,

Thanks very much for your reply, much appreciated.

Is there anyway I can capture if the user has pressed the display icon

or the change icon. They have the option to do both from PA30

Cheers

Andy

Read only

0 Likes
1,043

Hi Andy,

When it is from PA30, then you can go with the help of SY-UCOMM = 'DIS'.

along with TCODE. that way you can solve.

Regards

Vijay

Read only

0 Likes
1,043

in the command line put ' /h ' and in the debugging mode check for sy-ucomm

if sy-ucomm eq 'DISP'. " for example this is for display

.. " some code here

elseif sy-ucomm eq 'CHNG'. " this one is for change mode

..

endif.

hope this helps.

Read only

0 Likes
1,043

I have used debug mode and the sy-ucomm is blank when I choose

both display and change options

Read only

Former Member
0 Likes
1,043

yes u have to distinguish

if sy-tcode = 'PA20'.
  var = 0.
elseif sy-tcode = 'PA30'.
  var = 1.
endif.

LOOP AT SCREEN.
IF screen-group1 = 'CRB'. " I have added this as a modification group
screen-active = '1'.
scree-input = var.
MODIFY SCREEN.
ELSE.
screen-active = '0'.
scree-input = var.
MODIFY SCREEN.
ENDIF.
ENDLOOP.

Message was edited by:

chandrasekhar jagarlamudi

Read only

Former Member
0 Likes
1,043

Hey Andy,

Sorry for the late reply mate.

The function code for the Change icon is MOD & that for the Display icon is DIS.

I don't think you will be able to capture this event using sy-ucomm.

Please compare these values against the system variable SY-PFKEY. The SY-PFKEY value when you press change icon is MOD & when you press Display icon is DIS.

Do let me know if this works or not.

Regards,

Chetan.

PS: Reward points if this helps.

Message was edited by:

Chetan H. Dubey

Read only

0 Likes
1,043

Thanks Guys for your replies.

I have now managed to solve it now.

Cheers

Andy