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: 

Want to disable a button in a module pool when i press enter on the screen

Former Member
0 Kudos
1,385

I cant write the event in PBO .

I have writeen in the PAI but the thing is after modification of the screen in one of my module .

its again get re-intialised to its initail value .

how to solve this problem ?

loop at SCREEN .

if screen-name eq 'CMD_OK' .

screen-invisible = '1' .

modify SCREEN .

endif .

ENDLOOP .

1 ACCEPTED SOLUTION

Former Member
0 Kudos
229

Hi,

Try like this,

in PAI,

loop at SCREEN .

if screen-name eq 'CMD_OK' .

flag = 'X'.

screen-invisible = '1' .

modify SCREEN .

endif .

ENDLOOP .

In PBO,

check the flag condition where it is again resetting.

Thanks,

Srilakshmi.

6 REPLIES 6

peter_ruiz2
Active Contributor
0 Kudos
229

Hi Ankit,

Declare this variable on your top include.

DATA: ok_press TYPE c.

=== in PBO Module ===

IF ok_press EQ 'X'.

LOOP AT screen.

IF screen-name EQ 'CMD_OK'.

screen-invisible = 1.

MODIFY screen.

ENDIF.

ENDLOOP.

CLEAR ok_press.

ENDIF.

=== in PAI Module ===

LOOP AT screen.

MOVE 'X' to ok_press.

ENDLOOP .

regards,

Peter

Former Member
0 Kudos
230

Hi,

Try like this,

in PAI,

loop at SCREEN .

if screen-name eq 'CMD_OK' .

flag = 'X'.

screen-invisible = '1' .

modify SCREEN .

endif .

ENDLOOP .

In PBO,

check the flag condition where it is again resetting.

Thanks,

Srilakshmi.

Former Member
0 Kudos
229

hi

in PAI

module user_command

case sy- ucomm.

when ' enter ' " field which triggers the action .

f = 1. " declare the flag f as i in prog.

endcase

endmodule

In PBO

in any module for ex : module Initializa.

Module Initialize

If f = 1.

loop at screen

if screen-name eq 'CMD_OK' .

screen-invisible = '1' .

modify screen.

endif

endif

endloop

endmodule

regards

rajye

hope the content is usefull

pls close the thread if its resolved .Thank you .

Former Member
0 Kudos
229

Hi,

When u press 'ENTER' or any button , PAI is triggered and PBO after that.

Assign ur button (to be disabled) a group (say G1 to group1) in the screen itself.

Don't write Screen modification code in PAI. Write it in PBO.

Loop at screen.

if screen-group1 = 'G1'.

screen-active = 0.

modify screen.

endif.

Endloop.

Hope this helps.

Regards,

Nibha

I355602
Product and Topic Expert
Product and Topic Expert
0 Kudos
229

Hi Ankit,

Check the value of sy-ucomm for enter.

I guess its space (' ').

Take the screen-group1 for the button as 'BTN1'.

So use code:-

At screen logic:-


PROCESS AFTER INPUT.
  MODULE modify_screen.

In PAI,


MODULE modify_screen.
 case sy-ucomm.
  when space.
    if ( screen-group1 = 'BTN1' ).    
      loop at screen.
        screen-active = 0.
        screen-invisible = 1. "to hide button from screen
      endloop.
      modify screen.
    endif.
 endcase.
ENDMODULE.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Former Member
0 Kudos
229

got the answer as per requirment