Application Development and Automation 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: 
Read only

dats

Former Member
0 Likes
622

Hi, I need a function that returns the month of the date that I pass as parameter.

For example:

Function X

Input: dats

Output: integer (month of date input)

Can someone help me?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
583

is more easy do this..

data: month type integer.

move dats+4(2) to month.

4 REPLIES 4
Read only

Former Member
0 Likes
584

is more easy do this..

data: month type integer.

move dats+4(2) to month.

Read only

Former Member
0 Likes
583

Hi,

Have a look on the following code, I think this is the solution

Display the month in word format.

27/03/2008 displays it as 27 Mar 2008.

data: date1(15),

date2(15).

*CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'

  • EXPORTING

  • input = sy-datum

  • IMPORTING

  • OUTPUT = date1

  • .

*write:/ date1.

*write:/ date1 using edit mask '__ ___ ____'.

*concatenate date10(2) date12(3) date1+5 into date2 separated by

*space.

*write:/ date2.

OR

CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'

EXPORTING

input = sy-datum

IMPORTING

OUTPUT = date1

.

write:/ date1.

Reward,if useful.

Thanks,

Chandu

Read only

Former Member
0 Likes
583

Try this FM ISP_GET_MONTH_NAME but it is there in ECC6.0 only

or try this

IF ( DATE IS INITIAL ) AND ( MONTH_NUMBER IS INITIAL ).

RAISE WRONG_INPUT.

ENDIF.

*

IF NOT MONTH_NUMBER IS INITIAL.

IF ( MONTH_NUMBER < '01' ) OR ( MONTH_NUMBER > '12' ).

RAISE WRONG_INPUT.

ENDIF.

IF ( NOT DATE IS INITIAL ) AND ( DATE+4(2) <> MONTH_NUMBER ).

RAISE WRONG_INPUT.

ENDIF.

ENDIF.

*

IF NOT DATE IS INITIAL.

CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'

EXPORTING

DATE = DATE

EXCEPTIONS

PLAUSIBILITY_CHECK_FAILED = 1

OTHERS = 2.

IF SY-SUBRC NE 0.

RAISE DATE_ERROR.

ENDIF.

MONTH_NUMBER = DATE+4(2).

ENDIF.

*

SELECT SINGLE * FROM T247 WHERE SPRAS = LANGUAGE

AND MNR = MONTH_NUMBER.

IF SY-SUBRC NE 0.

SELECT SINGLE * FROM T247 WHERE SPRAS = SY-LANGU

AND MNR = MONTH_NUMBER.

IF SY-SUBRC NE 0.

RAISE NOT_FOUND.

ENDIF.

ENDIF.

SHORTTEXT = T247-KTX.

LONGTEXT = T247-LTX.

LANGU_BACK = T247-SPRAS.

Edited by: S@N on May 20, 2008 7:45 PM

Read only

Former Member
0 Likes
583

hi check this..

REPORT ZMONTH.

DATA X_MONTH(11).

CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'

EXPORTING

INPUT = SY-DATUM

IMPORTING

OUTPUT = X_MONTH.

regards,

venkat