Skip to Content
author's profile photo Former Member
Former Member

Date format

Hi Experts,

My requirement is as below.

On selection screen select options date is expected in a certain format MM/DD/YYYY. but for new design I want to make it work dynamically, that the program works for all date formats based on user settings.

it should be like making select options dynamic so that it would accept

any date format and pass it to system date format.

is there any logic or Function module to convert select-options date to system date format. system accepts date in sy-datum i.e. yyyymmdd.

Please let me know if thre is something FM or logic.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 05:37 AM

    Hi Yogesh

    If my understanding is correct, the user enter the date with respect to his/her own profile format and you need to get the date into a variable in format yyyymmdd.

    We can do this by using table <b>USR01</b> and FM: <b>DATE_STRING_CONVERT</b>.

    Field DATFM of table USR01 will give the format set in user's profile. Pass this and the date entered in the selection-screen to FM.

    Below sample code can help you understand the same:

    parameters: p_format type XUDATFM,
                p_date(10) type c.
    data: date type datum.
        DATE_FORMAT       = p_format
        DATE_STRING       = p_date
    *   START_DATE        = SY-DATUM
       RESULT_DATE       = date.
    write:/ date.


    Check the value in date when the break point is reached.

    Hope this helps.

    Kind Regards


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.