F4 Search Help on Screen Painter Date Element
Assign Search Help for Date Field on Screen Painter
The easiest method to assign search help for date type fields on Screen Painter is using the standard search help BU_DATE_CHAR (Search Help for Date in Character Format)
Double click on the screen to launch Screen Painter. When screen elements are displayed on Element list tab, switch to References titled sub-tab as seen in below screenshot.
Enter the BU_DATE_CHAR search help name as the Search Help attribute of the related date element in its References tab
Call F4_Date Function Module on Value-Request Process
An other method for displaying calendar search help for date elements on a Dynpro screen for ABAP programs is using F4_Date function module. This method requires some coding in ABAP but can also be used as an alternative to assigning BU_DATE_CHAR elemantary search help.
Here is the Layout view of a sample Dynpro screen with some elements as well as two date input elements for VBAK-ERDAT field. One field will be used for the minimum date and the other date element will be used for the maximum date for filtering sales orders using the date range object.
When I clicked on the date elements, you will see I named first one as S_ERDAT_LOW.
In Attributes section, I set format as DATS
The second date field is configured similar.
I defined the below data types in the TOP include of the ABAP program where I defined all global variables of the report.
And in the Flow Logic of the ABAP program screen, I added below code fragment.
Here is the source codes of the ABAP module f4_date_low. The second module is similar to this one but for the s_erdat_high date element.
Now ABAP programmer can activate all ABAP codes and run the report.
When you click on one of the date controls and press F4 for search help, following calendar will be displayed to pick a date.
Later in the "process after input", I use below ABAP code to build the date range object to use in data selection for filtering sales orders.