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: 

disabling & enabling fields in module pool programming

Former Member
0 Kudos

Hi all.

In module pool programming, I have a field which has default value. when I click on clear push button the value in the field shoul d get cleared & it should get enabled , so that user can enter value in it. Pls let me know how to do this.

cheers,

sami.

6 REPLIES 6

former_member226203
Active Contributor
0 Kudos

AT SELECTION SCREEN.

IF ( ur condition)

LOOP AT SCREEN.

screen-input = 1.

MODIFY SCREEN.

ENDIF.

u can clear it with in the condition

nirajgadre
Active Contributor
0 Kudos

Hi,

try this..

If sy-ucomm = 'Fcode for clear button'

clear the field.

loop at screen.

if screen-name = field name.

screen-input = 1.

modify screen.

endif.

endloop.

endif.

nabheetscn
Active Contributor
0 Kudos

Hi,

Please assign FCODE to the button say DISA

In PAI

If gv_okcode eq 'DISA'.

Clear Field.

Loop at screen

if screen-name eq 'FIELD_NAME'.

screen-input = 0.

Modify Screen.

endif.

endloop.

endif.

Regards,

Nabheet

venkat_o
Active Contributor
0 Kudos

Hi Sami, <li>Lets say you have one field .That is Date field. Field name for date is PA0001-BEGDA. <li>Screen flow logic.

PROCESS BEFORE OUTPUT.
  MODULE init_1001.
  FIELD pa0001-begda.

PROCESS AFTER INPUT.
  FIELD pa0001-begda.
  MODULE user_command_1001.
<li>Program code which contains PBO and PAI Modules code.

REPORT  sapmztest_notepad.
TABLES:pa0001.
DATA:ok_code TYPE sy-ucomm.
DATA:flag.
*&---------------------------------------------------------------------*
*&      Module  INIT_1001  OUTPUT
*&---------------------------------------------------------------------*
MODULE init_1001 OUTPUT.
  IF flag IS INITIAL.
    pa0001-begda = sy-datum. "Default date to system date
  ENDIF.
  IF pa0001-begda IS INITIAL.
    LOOP AT SCREEN.
      IF screen-name = 'PA0001-BEGDA'.
        screen-input = '1'. "It makes screen field in display mode
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-name = 'PA0001-BEGDA'.
        screen-input = '0'."It makes screen field in change mode
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

ENDMODULE.                 " INIT_1001  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_1001  INPUT
*&---------------------------------------------------------------------*
MODULE user_command_1001 INPUT.
  CLEAR ok_code.
  ok_code = sy-ucomm.
  IF ok_code = 'CLEAR'.
    CLEAR pa0001-begda. "Clear date value when you click on Clear button
    flag = 'X'.
  ENDIF.
ENDMODULE.                 " USER_COMMAND_1001  INPUT
Thanks Venkat.O

Former Member
0 Kudos

Hi,

Lets say that the FCODE of the clear button is CLEAR and let the name of the field be t_clear

And let the field group of t_clear be 'A'.

IN PAI write the below code.

IF SY-UCOMM = 'CLEAR'.            "checking whether the clear button is clicked.
t_clear = ' '.                                  "clearing the field

LOOP AT SCREEN.
IF GROUP1 = 'A'.                            "checking the group of the field

screen-input = 1.                           "making the field editable
MODIFY SCREEN.
ENDIF.
ENDLOOP.

ENDIF.

Former Member
0 Kudos

Moderator message - Please do not ask or answer basic questions or questions that could be solved by simply searching - thread locked

Rob