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: 

fields disable and enable in screen, dialog program

Former Member
0 Kudos

hi all,

i have two screens in my program , in first screen there r option to creat & modify data .on selecting modify control shoud go to second screen and all the screen fields and table control field should be disable , except for the 'customer code' field

after entering a valid customer code all the fields should become editable with the current values on preesing 'enter' after entering valid 'customer code' .

But i am able to getting fields disable using loop at screen and making screen-input = 0, but after entering a valid code and pressing enter the all other fields r not getting editable with current values .

plz help.

thanks in advance

regards

vivek

8 REPLIES 8

Former Member
0 Kudos

Hi,

Check if the customer code field is populated...Then open up the fields for input..otherwise don't..

Ex..

PROCESS BEFORE OUTPUT.

LOOP AT ITAB WITH CONTROL TC.

MODULE DISABLE_FIELDS.

ENDLOOP.

MODULE DISABLE_FIELDS OUTPUT.

LOOP AT SCREEN

IF NOT ITAB-CUSTOMER_CODE IS INITIAL.

SCREEN-INPUT = '1'. " Enable

ELSE.

SCREEN-INPUT = '0'. " Disable

ENDIF.

ENDLOOP..

ENDMODULE.

Thanks,

Naren

0 Kudos

Hi Narendran,

You have forgotten to modify the screen.

LOOP AT SCREEN.

IF NOT ITAB-CUSTOMER_CODE IS INITIAL.

SCREEN-INPUT = '1'. " Enable

ELSE.

SCREEN-INPUT = '0'. " Disable

ENDIF.

<b> MODIFY SCREEN.</b>

ENDLOOP.

amit_khare
Active Contributor
0 Kudos

Check the condition in the initialization event when true use screen-input = 0 else use screen-input = 1.

Regards,

Amit

Former Member
0 Kudos

Very good catch Mark...:-))

LOOP AT SCREEN

IF NOT ITAB-CUSTOMER_CODE IS INITIAL.

SCREEN-INPUT = '1'. " Enable

ELSE.

SCREEN-INPUT = '0'. " Disable

ENDIF.

<b> MODIFY SCREEN.</b>

ENDLOOP.

Thanks,

Naren

0 Kudos

hi narendran,

but i want it enable only if that code exist in the database table, not for any other value.

regards

vivek

0 Kudos

Hi

U should insert a flag to manage the output characteristics:

PROCESS PBO

   MODULE LOOP_SCREEN.

PROCESS PAI

   FIELD <MY FIELD> MODULE CHECK_VALUE.

MODULE LOOP_SCREEN.
   CHECK NO_INPUT = 'X'.

   LOOP AT SCREEN.
      IF SCREEN-NAME = ......
        SCREEN-INPUT = 0.
        MODIFY SCREEN.
      ENDIF.  
   ENDLOOP. 
   
ENDMODULE.

MODULE CHECK_VALUE.
    SELECT * FROM <TABLE> WHERE .....
    IF SY-SUBRC <> 0.
      NO_INPUT = 'X'.
   ELSE.
     CLEAR NO_INPUT.
   ENDIF. 
ENDMODULE.

Max

Former Member
0 Kudos

Hi,

In the PAI..

Validate the value before it goes to the PBO..

PROCESS AFTER INPUT.

LOOP AT ITAB.

FIELD ITAB-VALUE MODULE CHECK_DATA.

ENDLOOP.

MODULE CHECK_DATA.

  • Validating the value given in the screen..

SELECT SINGLE * FROM ZTABLE WHERE VALUE = ITAB-VALUE.

IF SY-SUBRC <> 0.

  • Raise an error message..

ENDIF.

ENDMODULE.

OR

If the screen field name is database structure - field name (EX..ZSCREEN_001-FIELDNAME) then you can give the check table for the corresponding field in SE11..

Then sap will automatically check for the valid value...

Once the above checks are successful then the control goes to the PBO...which has a valid value..

Thanks,

Naren

gopi_narendra
Active Contributor
0 Kudos

hi vivek,

the problem is you should use the chain end chain.

in the PAI module of the flow logic for the table control screen.

LOOP AT ITAB WITH CONTROL TC.

chain.

field : <mention all the fileds of the table control which u wnt to edit>

module READ_DATA.

endchain.

ENDLOOP.

Regards

Gopi