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

need to change the date format i have written pls correct me if i m wrong

Hi All, Here in Write Statement I only need to chage DDMMYY with DD/MM/YYYY, but one question, as BLDAT taking 8 char and DD/MM/YYYY will take 10 char so in internal table data declaration while declaring bldat need to put like: DATA: t_dat(10) LIKE BSID-BLDAT. Pls suggest me as code is alo attached. Thanks and Regards Sankil

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Posted on Feb 18, 2014 at 06:26 AM

    Hi Sankil,

    Write a code like below.

    PARAMETERS: P_DATE TYPE MKPF-BUDAT.
    DATA: DATE1(8) TYPE C.

    WRITE P_DATE TO DATE1 DDMMYY.
    WRITE DATE1.


    Arivazhagan S

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 18, 2014 at 06:31 AM

    Date separators depend upon the user parameters maintained in transaction SU3.

    However if you want to display date always as DD/MM/YYYY, than you can try something like this

    DATA : LV_DATE TYPE CHAR10.

    CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum+0(4) into LV_DATE

    SEPARATED BY '/'

    Thanks, Abhinab

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 18, 2014 at 06:37 AM

    HI sankil,

    You just want to write the date right ??

    Try writing the write statement as this ,

    data: date type BSID-BLDAT.

    WRITE: date USING EDIT MASK '__/__/____'.



    Regards,

    Sivaganesh.


    Untitled.png (1.4 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 18, 2014 at 06:38 AM

    Check this example...

    DATA : v_date(10) TYPE c,

    i_date(8) TYPE c,

    day(2) TYPE c,

    month(2) TYPE c,

    year(4) TYPE c,

    result(12) TYPE c.

    i_date = 201213.

    day = i_date+1(2).

    month = i_date+3(2).

    year = i_date+5(2).

    year = year + 2000.

    concatenate day '/' month '/' year into v_date.

    WRITE v_date.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 18, 2014 at 06:39 AM

    Hi Sankil Pandiya,

    SAP standard format is DDMMYYYY like this only.. while printing or writing it will become DD.MM.YYYY . if you need to print as your desired format mean you have to code little bit.

    Consider:

    DATA: date TYPE sy-datum .
    data: date_new(10).

    date = sy-datum.
    CONCATENATE date+6(2) '/' date+4(2) '/' date+0(4) INTO date_new.

    WRITE : DATE_NEW .

    let me know after facing the same problem.

    Regards,

    Thangam.P


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 18, 2014 at 06:51 AM

    hi sankil

    BSID-BLDAT is a DATS type variable.

    for DATS the input length is 8 but the output length is 10. so you dont have to make any changes in the declaration. it will automatically print in DD/MM/YYYY format.

    for test purpose you can try this piece of code.

    TABLES:

    BSID.

    PARAMETERS:

    p_date TYPE BSID-BLDAT.

    write:/ p_date.

    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.