Requirement : At times there is a requirement to add the F4 help for standard screen fields where the field has no default search help options .
Purpose : In Such cases where only option left is to go for an access key or modifying the standard , it can be achieved by using an implicit enhancement in FM HELP_START
In order to perform this task basic understanding of Implicit enhancement and and search helps.
Enhancements is technique provided by sap in order to insert the custom code inside the standard flow control. Enhancements are of different types intially we have techniques like 'user-exits', 'customer-exits', and 'BADI's' .
after the NW04 enhancement Framework has been introduced. Enhancement framework has brought all the enhancement techniques under one roof.Source code enhancement is one of technique for adding custom codes. There are two types of source code enhancements possible
1. Implicit Enhancement Option
2. Explicit Enhancement Option
Implicit enhancement : Almost in all the abap system Options are available by default at predefined places like At end of all the reports,includes ,Function Pools,Module Pools and at stating and ending of Form Subroutines and At end of all FM's.
Steps :
For Demonstration purpose i have taken the Purchase order transaction and adding Collective No Field F4 help. Collective No field SUBMI Doesn't have any search help by default, now assigning list of RFQ's to SUBMI in ME21 and ME21 Transaction on clicking F4 button.
1. Go to Se37-> Help_Start-> Click on display.
2. Click on Enhance Button( Shift F4 )
3. Go to -> Edit->Enhancement Operations-> Show Implicit Enhancement Options ,then you will see a line like below at the starting of FM
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Function Module HELP_START, Start
4. Right Click on the the Quoted Line -> Enhancement Operations -> Click On Create Implementation and select the option CODE and provide the name and Short text in the pop up.
Provide Meaningful Name
|
5. Do the following Coding .
Here in 'ZANFNR' is a custom search help which has exporting value of ANFNR is assigned to the collective No field of ME21N And ME22N.
IF ( sy-tcode = 'ME21N' OR sy-tcode = 'ME22N' ) AND
help_infos-fieldname = 'SUBMI' AND help_infos-dynprofld = 'MEPO1229-SUBMI'
AND help_infos-dynpprog = 'SAPLMEGUI' AND help_infos-menufunct = 'HC' .
DATA: tl_return TYPE STANDARD TABLE OF ddshretval,
wl_return TYPE ddshretval.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'MEPO1229'
fieldname = 'SUBMI'
searchhelp = 'ZANFNR' " Create a search help / use an existing one
shlpparam = 'ANFNR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'MEPO1229-SUBMI'
value = 'X'
TABLES
return_tab = tl_return
EXCEPTIONS
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
OTHERS = 5.
IF sy-subrc = 0 AND lines( tl_return ) = 1.
READ TABLE tl_return INTO wl_return INDEX 1.
selection = 'X'.
select_value = wl_return-fieldval.
EXIT.
ENDIF.
ENDIF.
6. After doing all these activate the enhancement .
Hope this will be helpful in case there are no options of standard search help in standard screen fields.
1 comments :
commentsTHANK YOU!!! it was very helpful!!!
Reply