09-24-2013 11:08 AM
HI Folks,
Need help to Check if a Field is populated by F4 help (Search help) or Manually in a Module pool program.
Basically the search help already contains all validation required for the field,so if i get to know that the user has selected value from F4 Popup i need not validate the value entered but when user had a manually populated the field i have to validate it with some conditions.
09-24-2013 3:11 PM
You may require to "interceot" the F4. In the POV section call a module for your field, in this module
Now in your program if the current value is equal to this saved value, you can consider it comes from F4
Regards,
Raymond
09-24-2013 11:27 AM
Hello Abhishek.
It is better to validate that field without worrying if it is entered manually or via F4 help. It will atleast be a single step process.
If you opt for the other method, it involves two or more additional steps:
1) Identifying how the input came.
2) Using some variable to identify manual input.
3) If the input is entered manually, perform validation.
Regards.
09-24-2013 12:06 PM
Hi Arun,
Thanks for your reply ,you are right i would had done that if the validation where simple and small...But this is not the case here..The validation is complicated and time taking too..so i am trying to avoid doing it again.
09-24-2013 12:27 PM
Hi Abhishek,
Instead of validating by checking for manual entries and search help entries why can't we make the field in display mode and allow values of search help which can be selected by user.
Check out the code.
PARAMETERS:p_matnr(18) TYPE c MODIF ID mid.
DATA:BEGIN OF itab OCCURS 0,
matnr TYPE matnr,
END OF itab.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN .
IF screen-group1 EQ 'MID'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
LOOP AT SCREEN .
IF screen-group1 EQ 'MID'.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
IF itab IS INITIAL.
itab-matnr = 'ABC123456788'.
APPEND itab.
itab-matnr = 'BCS123456788'.
APPEND itab.
itab-matnr = 'DFC123456788'.
APPEND itab.
itab-matnr = 'ASW123456788'.
APPEND itab.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_MATNR'
value_org = 'S'
TABLES
value_tab = itab.
LOOP AT SCREEN .
IF screen-group1 EQ 'MID'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
endloop. " SEARCH INPUT
Hope this logic would help you..
Regards,
Sivaganesh.
09-24-2013 1:26 PM
Hi Siva
Thanks for your reply.But i cant make the field restrict only F4 help (Search help) entries.The field should be able to take both F4 and manual entries.
09-24-2013 12:31 PM
Hi Abhishek,
Get the values of the search help from FM F4IF_SELECT_VALUES and then validate the value entered by user from the internal got from FM. Hope my understand is fine...
Regards,
Lokesh
09-24-2013 1:29 PM
Hi Lokesh
Thanks for your reply.You are very right on this but wouldn't it fail in the scenario where user doesn't press F4 (i.e. search help is not triggered) and directly makes an Manual entry.
09-24-2013 1:47 PM
Hi Abhishek,
Is F4 help value for that field depends on any other fields? if not give the search help name in FM
F4IF_SELECT_VALUES it will return search help values in internal table.
read internal table with the value user enters manually in screen.
Regards,
Lokesh
09-24-2013 2:02 PM
What kind of search help is it ?
- fixed values domain ?
- standard SAP search help (which one) ?
- custom search help ?
- on value request event ?
09-24-2013 2:43 PM
Hi Peter,
Thanks for your reply.It is a collective search help,Using Search help exit.
09-24-2013 3:11 PM
You may require to "interceot" the F4. In the POV section call a module for your field, in this module
Now in your program if the current value is equal to this saved value, you can consider it comes from F4
Regards,
Raymond
09-24-2013 3:38 PM
You may require to "interceot" the F4.
You meant "intercept", didn't you? For a few minutes i was wondering if this is some parameter in the Search-help exit FMs
- Suhas
09-24-2013 4:03 PM
09-26-2013 4:00 AM
But even with the method suggested by Raymond, there is one loophole.
Suppose user selects a record using F4 help and then changes it in the resultant input field....
It will not be validated as system will understand it has come from F4 help and not manually.
I feel it will be better to validate all the records irrespective of how they came.
It is ultimately up to you to decide based on the criticality of the App....
09-26-2013 7:34 AM
Not exactly, I didn't keep in memory the fact that a value has been selected, but the actual value selected, so this value can be assumed as correct.
Regards,
Raymond
09-26-2013 8:33 AM
09-26-2013 10:08 AM
Hi Abhishek,
You can make the field as a dropdown list and then set the value range using VRM_SET_VALUES function module. This way validation can be avoided. Also you might be aware that manual input is possible in dropdown list (but limited only to the entries present i.e for eg if the drop down is for country code it will allow you to input I, IN etc as soon as you put IN it will show you entries which start with IN lke India, Indonesia etc...)
Please try this option and please reward if found useful.
Thanks,
Ajay