I would like to add an existing Search Help on a screen field in Screen painter.
Of course it's possible to just click on th screen field and in the property box, I just have to set the name of teh search help.
The problem is that I need the screen field to be grey and user musn't be able to change the field value if he doens't use the search help.
I'm not allowed to modify the existing search help or to built it on my own from source code, I must use the existing one.
Do you have an idea on how to do so?
If I understood you correctly, you want to assign a existing search help to your input enabled field in the screen , and if the user doesnt enter a value or doesn't use F4Help values then you want to grey out, if it is your question ,
Then do like this.
In the PBO of the screen make the field disabled for input and in the PAI provide an option by putting a button beside the screen field where your providing the search help to make it input enabled , thus if the user want to enter a value in it then he will hit the button and will make it edit enabled and enters the value or just he can skip.
PSEUDO CODE PBO LOOP AT SCREEN. IF SCREEN-GROUP1 = 1. SCREEN-INPUT = 0 . ENDIF. ENDLOOP. PAI. MODULE EDIT_ENABLED. .. MODULE EDIT_ENABLED. IF SY-UCOMM = EDIT_BUTTON. LOOP AT SCREEN. IF SCREEN-GROUP1 = 1. SCREEN-INPUT = 1 . ENDIF. ENDLOOP. END MODULE.
it's not really what I want. Your solution provide a way for user to change between a screen field that is grey or not. I want the field to be grey all the time and user to be obliged to use the match code to fill the screen field.
screen field is grey
if user use match code he can change screen field value
if he use keyboard, he can't change screen field value.
That is what I want.
Thanks for your help
In the screen painter for that field goto properties -> Dropdown ->select listbox.
Instead let that field be in change mode and if user enters any wrong entry which is not there in the table give a error messgae.
MODULE modify_screenfields1 INPUT.
WHEN 'ENTER' OR 'EXECUTE'.
IF NOT addr1_data-country IS INITIAL.
SELECT SINGLE landx FROM t005t INTO lws_landx WHERE
land1 = addr1_data-country
AND spras = 'EN'.
IF sy-subrc <> 0.
MESSAGE e000(zo_spa) WITH text-022. " Invalid Country code
t005t-landx = lws_landx.
ENDMODULE. " modify_screenfields1 INPUT
Option 2: Other than if u want the way u like, let that field be greyed out. don't attach the search help.
In the PROCESS ON VALUE-REQUEST.
FIELD addr1_data-region MODULE region_pov.
MODULE region_pov INPUT.
Using the F4IF_INT_TABLE_VALUE_REQUEST table value request show the search help.
also make that field input enabled.
ENDMODULE. " region_pov INPUT
I think this will solve ur problem.
Message was edited by: Prakash Ramu
Thanks but none of your solutiosn can be applied to my problem :
in each of this case, I have to select values on my own.
case 1 : I do a select to check user entry and I don't use the matchcode, it doesn't match the reuqirement
case 2: I replace the existing search help by an internal table that I provide to a module taht transform my internal table in a Search Help.
The probleme is that I MUST NOt select values on my own cause the customer gave me the search help he developed himself. That is the reason why I MUST use the existing search help.
No need to bring all the values to the internal table. You can directly use FM <b>'F4IF_FIELD_VALUE_REQUEST'</b> to bring the data directly from search help.
FORM f4_ym CHANGING p_ym.
DATA: li_ret_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
tabname = ' '
fieldname = ' '
searchhelp = 'BU_DATE_CHAR'
return_tab = li_ret_tab
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
OTHERS = 5.
IF sy-subrc IS INITIAL.
READ TABLE li_ret_tab INDEX 1.
IF sy-subrc IS INITIAL.
CONCATENATE li_ret_tab-fieldval6(4) li_ret_tab-fieldval3(2)
ENDFORM. " f4_ym
Check this for <a href="http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm">Help</a> for how to use list box.