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

Disable pushbutton in module pool

Former Member
0 Likes
3,182

Hi Experts,

I have read certain discussions on the same but it is not getting disabled. Please check the following screenshots:

The requirement is when the user clicks on create button, it should get disable so that duplicate record should not be created.

I have written the following code after all the data in the screen fields gets updated in the database in the PAI 'WHEN CREATE'.

why it does not work? Where I am lacking?

Regards

Mani

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,590

Screen settings made in PAI will not be reflected on screen.

You need to code it in PBO.

You can set a variable in PAI, when a record is created.

PAI.

eg,

if sy-surbc = 0.

  messag...

  created = 'X'

endif.

In PBO.

if created = 'X'.

  loop at screen.

* Screen setting to disable push button.

endloop.

endif.

5 REPLIES 5
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
2,590

Hi Mani

What is CREATE push button name...?

Nabheet

Read only

Bhushan_hs
Participant
0 Likes
2,590

Hi Bhushan,

Please write the loop at screen code in PBO also, it will work just fine.

Regards,

Bhushan

Read only

Former Member
0 Likes
2,591

Screen settings made in PAI will not be reflected on screen.

You need to code it in PBO.

You can set a variable in PAI, when a record is created.

PAI.

eg,

if sy-surbc = 0.

  messag...

  created = 'X'

endif.

In PBO.

if created = 'X'.

  loop at screen.

* Screen setting to disable push button.

endloop.

endif.

Read only

sivaganesh_krishnan
Contributor
0 Likes
2,590

Hi mani,

For making any changes in screen layout you have to code in PBO. (Process Before Output).

you could declare a flag of type char01.

in pai if the button is clicked set the flag to X. also in pbo write as,

IF flag EQ 'X'.

loop at screen.

if screen-name EQ 'CREATE'.

screen-input = 0.

modify screen.

endloop.

ENDIF.

Regards,

sivaganesh

Read only

former_member209120
Active Contributor
0 Likes
2,590

Hi mani bhushan

Try like this

Data : Flag type C.

CALL SCREEN 9000.
*&---------------------------------------------------------------------*
*&      Module  STATUS_9000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
   SET PF-STATUS 'PF_9000'.
*  SET TITLEBAR 'xxx'.

ENDMODULE.                 " STATUS_9000  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_9000 INPUT.

   CASE sy-ucomm.

   when 'REPORT'.

    CALL TRANSACTION 'MB5B'.

   When 'EXIT'.

   Leave TO SCREEN 0.

  When 'CREATE'.

   FLAG = 'C'.

   endcase.

   ENDMODULE.                 " USER_COMMAND_9000  INPUT
*&---------------------------------------------------------------------*
*&      Module  hide_head  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module hide_head output.

loop at screen .

       if flag eq 'C'.
         if  screen-group1 eq 'G1'.
           screen-input = 0.
           modify screen.
         endif.
       ELSE.
         if  screen-group1 eq 'G1'.
           screen-input = 1.
           modify screen.
         endif.
       endif.



ENDLOOP.

endmodule.                 " hide_head  OUTPUT