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: 

Date Format

Former Member
0 Kudos

Hi,

I want to print the date in this format on my smartform 31 August 2006

Now I am getting this format only 31. August2006

Thanks in Advace.

Regards,

chandra.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

Try this..

DATA: DATE_CHAR(20).

DATA: DATE TYPE SY-DATUM.

DATA: MONTH_NAME LIKE T247-LTX.

DATE = SY-DATUM.

SELECT SINGLE LTX FROM T247

INTO MONTH_NAME

WHERE SPRAS = SY-LANGU

AND MNR = SY-DATUM+4(2).

CONCATENATE SY-DATUM+6(2) MONTH_NAME SY-DATUM(4)

INTO DATE_CHAR SEPARATED BY SPACE.

WRITE: / DATE_CHAR.

Thanks,

Naren

5 REPLIES 5

Former Member
0 Kudos

HI,

Try this..

DATA: DATE_CHAR(20).

DATA: DATE TYPE SY-DATUM.

DATA: MONTH_NAME LIKE T247-LTX.

DATE = SY-DATUM.

SELECT SINGLE LTX FROM T247

INTO MONTH_NAME

WHERE SPRAS = SY-LANGU

AND MNR = SY-DATUM+4(2).

CONCATENATE SY-DATUM+6(2) MONTH_NAME SY-DATUM(4)

INTO DATE_CHAR SEPARATED BY SPACE.

WRITE: / DATE_CHAR.

Thanks,

Naren

0 Kudos

Thanks Narendran.

Regards,

chandra.

0 Kudos

Okay I am able to get the date built but unable to access the date_char field within SMARTFORMS. How do I get to use this new field>

0 Kudos

I just sent a question about this formatting please send answer back to bcarter@teleflexmedical.com

ferry_lianto
Active Contributor
0 Kudos

Hi Chandra,

Welcome to SDN.

You can also try like this.

DATA: GD_DATE LIKE SY-DATUM, 
      GD_STRING(20) TYPE C,
      GD_DAYS(10) TYPE C,
      GD_MONTH(10) TYPE C,
      GD_YEAR(10) TYPE C,
      GD_TEXT LIKE T247-LTX.

GD_DATE = SY-DATUM.      <--- giving the date here

CALL FUNCTION 'HR_IN_GET_DATE_COMPONENTS'
  EXPORTING
    IDATE = GD_DATE
  IMPORTING
    DAY = GD_DAYS
    MONTH = GD_MONTH
    YEAR = GD_YEAR
    LTEXT = GD_TEXT.
 
IF SY-SUBRC = 0.
  CONCATENATE GD_DAYS GD_TEXT GD_YEAR 
              INTO GD_STRING SEPARATED BY SPACE.
ENDIF.

WRITE:/ GD_STRING.

Hope this will help.

Regards,

Ferry Lianto