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: 

Dynpros

Former Member
0 Kudos
124

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

former_member181962
Active Contributor
0 Kudos
98

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

laxmanakumar_appana
Active Contributor
0 Kudos
98

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

Former Member
0 Kudos
98

Hi,

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

Cheers,

James

0 Kudos
98

Ensure the field name is all caps.

screen-name = 'FIELDNAME'.

hith

Sunil achyut

Former Member
0 Kudos
98

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

0 Kudos
98

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

0 Kudos
98

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?

0 Kudos
98

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

0 Kudos
98

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

0 Kudos
98

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