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 the Date field in Module-Pool program

Former Member
0 Kudos
5,849

Hi,

I have a requirement wherein the user shud be allowed to choose a date on the calendar using F4 help and after choosing, it shud get displayed as dd.mm.yyyy format in the field. Is there any functional module to implement this.

Thanks in Advance,

Saranya.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
1,036

Hi Saranya ,

chk this FM

CALL FUNCTION 'F4_DATE'
       EXPORTING
            DATE_FOR_FIRST_MONTH = DATE
            DISPLAY              = HELPDISP
       IMPORTING
            SELECT_DATE          = DATE
       EXCEPTIONS
            OTHERS               = 4.

12 REPLIES 12

Former Member
0 Kudos
1,037

Hi Saranya ,

chk this FM

CALL FUNCTION 'F4_DATE'
       EXPORTING
            DATE_FOR_FIRST_MONTH = DATE
            DISPLAY              = HELPDISP
       IMPORTING
            SELECT_DATE          = DATE
       EXCEPTIONS
            OTHERS               = 4.

0 Kudos
1,036

Chandrasekhar,

This FM is not working and it throws exception as my date field is 10 char. Pls suggest an alternative solution. Pls note that the date field that I am using is in

Module-pool programming.

thanks in advance,

Saranya

0 Kudos
1,036

HI Saranya,

Firstly, you have to define a field like this in your module pool main program.

data: date type sy-datum.

Then in the screen painter, click on CHOOSE FROM PROGRAM option. YOu will get a list of all program variables.

Chose the date field and continue.

YOu can place the date field wherever you like.

Save it and activate.

The f4 help come by default.

Regards,

Ravi

Former Member
0 Kudos
1,036

Hi Saranya,

For this use one of the database date reference field and regarding the date formate, it is based on the user settings. Still you want the same dd.mm.yyyy format just take one label field to speicy this and validate the value of this field to check the format.

Regards,

Satya

former_member181962
Active Contributor
0 Kudos
1,036

If you use a field which is referiing to the domain datum or data element ERDAT, it would come up automatically.

To display it in the format you have mentioned, you have to set your user parameters. (System->User Profile->SEt status)

Regards,

ravi

0 Kudos
1,036

For this help we dont need to have the function module

we can use the date field as type of system variable

Ex: date type sy-datum.

it will enable the F4 help for the field that u r going to specify in the module programming

Regards,

Shanmuga.

Former Member
1,036

Hello Saranya,

In the attribute of the field give the following

Format - DATS

Possible entry - 1

Input checkbox should be checked.

If useful reward.

Vasanth

0 Kudos
1,036

Ideally speaking this should be the right answer for the Question asked.

anversha_s
Active Contributor
0 Kudos
1,036

hi,

no need for any FM.

decakre like this. automatically f4 will come.

data : f_data like sy-datum.

rgds

anver

Former Member
0 Kudos
1,036

You can check this also F4_DATE_CONTROL

are u writing the code in PROCESS ON VALUE-REQUEST

Message was edited by:

chandrasekhar jagarlamudi

Former Member
0 Kudos
1,036

Hi Saranya,

Try this.

1. Define the field on the screen as type dats.

2. In the Screen layout, Under field Attributes, choose Poss. entries value as 1.

3. Goto Systems -> User Profile -> Own Data -> Defaults tab. Change the date format to 'DD.MM.YYYY'.

This should display the date in the format you require.

Pls. mark helpful answers.

Best Regards,

Biju V

Former Member
0 Kudos
1,036

Hi,

Please try the below code in your prgm.

You have to write the below code in the POV of the required field.

----


***INCLUDE MZDATE_POV_DATEI01 .

----


&----


*& Module pov_date INPUT

&----


  • text

----


module pov_date input.

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.

wrk_date = li_ret_tab-fieldval. "The required field

ENDIF.

ENDIF.

endmodule. " pov_date INPUT

Hope it suits ur requirement.

Reward points if useful.

Thanks and regards,

Litta.