Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

F4 help for selection screen field

Former Member
0 Kudos

Hi,

i have Char10 field on selection screen which doesnt have f4 help.

i want f4 functionality for that particular filed,when press f4 i should get calander,so that i have to slect date.

note:selection screen field type should be of char10.

please post the answer as soon as possible.its an urgent requirement for me.

Regards,

Sunil.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

If you declare your parameter like SY-DATUM instead of CHAR10 you'll have automatically what you need:

PARAMETERS: P_DATE LIKE SY-DATUM.

Max

5 REPLIES 5

Former Member
0 Kudos

Hi

If you declare your parameter like SY-DATUM instead of CHAR10 you'll have automatically what you need:

PARAMETERS: P_DATE LIKE SY-DATUM.

Max

Former Member
0 Kudos

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ym.

PERFORM f4_ym.

&----


*& Form f4_ym

&----


  • F4 for Year and Month

----


FORM f4_ym .

DATA: li_ret_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

tabname = ' '

fieldname = ' '

searchhelp = 'BU_DATE_CHAR'

TABLES

return_tab = li_ret_tab

EXCEPTIONS

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) li_ret_tab-fieldval+0(2)

INTO p_ym separated by '.'.

ENDIF.

ENDIF.

ENDFORM. " f4_ym

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

When working with dates, you should be using the data type D or type sy-datum, this is how every date in the system is stored and internal formatting will be handled for you automatically, I would advise not use a character 10 field, and do as Max has suggested.

Regards,

Rich Heilman

former_member181962
Active Contributor
0 Kudos

If you still want to use char10 and do not want to use sy-datum as other have suggested, then use this code:

parameters: p_date like char10.

at selection-screen on value-request for p_date.

call function 'F4_DATE'

exporting

date_for_first_month = sy-datum

display = ' '

importing

select_date = p_date.

Regards,

ravi

Former Member
0 Kudos

Hi,

When you use the Date, then why don't you declare it as like SY-DATUM, so it will pick the calender when you press the F4. however, see the below code

Parameters: Date(10).

AT SELECTION-SCREEN ON VALUE-REQUEST FOR DATE.

DATA: DAte_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

tabname = ' '

fieldname = ' '

<b>searchhelp = 'BU_DATE_CHAR'</b>

TABLES

return_tab = date_tab

EXCEPTIONS

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 date_tab INDEX 1.

IF sy-subrc IS INITIAL.

CONCATENATE date_tab-fieldval6(4) li_ret_tab-fieldval3(2) li_ret_tab-fieldval+0(2)

INTO dateseparated by '/'.

ENDIF.

ENDIF.

Regards

Sudheer