04-30-2007 4:36 PM
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
04-30-2007 4:40 PM
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
04-30-2007 4:43 PM
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.
04-30-2007 4:42 PM
Check the condition in the initialization event when true use screen-input = 0 else use screen-input = 1.
Regards,
Amit
04-30-2007 4:47 PM
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
04-30-2007 5:26 PM
hi narendran,
but i want it enable only if that code exist in the database table, not for any other value.
regards
vivek
04-30-2007 5:33 PM
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
04-30-2007 5:30 PM
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
04-30-2007 5:48 PM
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