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

Dynpros

Former Member
0 Likes
1,159

I need to use this code, but It does not work in PAI. I want to disable a numc field when I push a button in PAI but it makes me nothing.

loop at screen.

if screen-name = ''.

screen-input = 0.

endif.

modify screen.

endloop.

What I should do?

thanks.

10 REPLIES 10
Read only

Former Member
0 Likes
1,133

Write your code in PBO.

loop at screen.

if screen-name = '<name of the field you want to disable>'.

screen-input = 0.

modify screen.

endif.

endloop.

Regards,

ravi

Read only

Laxmana_Appana_
Active Contributor
0 Likes
1,133

Hi,

Are you passing screen-name = 'screenstructure-fieldname'

to this?.

and write this logic at PBO event.

<b>then change code like below:</b>

Loop at screen.

if screen-name = 'AUX'.

screen-input = 0.

modify screen.

endif.

Endloop.

<b>whenever an event is fired from PAI , the execution of the code control goes from PAI to PBO. so if you put the code in PBO , this code will execute when screen re-displayed . if you put in PAI , first object will be disabled , if you press 'ENTER' then again it will enabled.</b>

Regards

Appana

Message was edited by: L Appana

Read only

Former Member
0 Likes
1,133

Hi,

Instead of screen-name = ' ' try using the field name of numc field you want to disable.

Cheers,

James

Read only

0 Likes
1,133

Ensure the field name is all caps.

screen-name = 'FIELDNAME'.

hith

Sunil achyut

Read only

Former Member
0 Likes
1,133

It is a field whose name is 'aux'. It does not have structure associated.

Read only

0 Likes
1,133

As suggested by Ravi put your logic in PBO module

loop at screen.

if screen-name = 'AUX'.

screen-input = 0.

modify screen.

endif.

endloop.

hith

Sunil Achyut

Read only

0 Likes
1,133

It is in caps but it still does not work and I need to put a button which makes me disabled in PAI the field. Why should I do in PBO?

Read only

0 Likes
1,133

The code I have is

PAI.

Case sy-ucomm

when 'SAVE' -> The button

loop at screen.

if screen-name = 'AUX'.

screen-input = 0.

modify screen.

endif.

endloop.

endcase.

But still not work

Read only

0 Likes
1,133

You might want to read the documentation about how the screen elements work before coding.

http://help.sap.com/saphelp_erp2005/helpdata/en/e4/2adbef449911d1949c0000e8353423/frameset.htm

hith

Sunil Achyut

Read only

0 Likes
1,133

Hi,

You need to do it in PBO because this is the event that occurs prior to displaying the screen. When you set screen-input = 0 in the PAI, the values are taken from the screen layout definition for the field causing the screen-input to be set to 1. You can override this during PBO. One way to "connect" your PAI 'SAVE' function to the PBO "loop at screen" is to use a flag variable.

Example:

PBO module

  
  IF my_flag = 'X'.
    LOOP AT SCREEN.
      IF screen-name = 'AUX'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

PAI module:


...
  when 'SAVE'.
    if my_flag is initial.
      my_flag = 'X'.
    endif.

- James