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: 

is there any fm to separate the date,month&year from a field.

Former Member
0 Kudos

hi dears,

can any give the function module for separate the month,date,year from the field and based on that i need the monthly,quaterly,yearly wise income.

9 REPLIES 9

Former Member
0 Kudos

Use below code:

E_DATE     = I_DATE+06(02).
E_MONTH  = I_DATE+04(02).
E_YEAR    = I_DATE+00(04).

Thanks and regards,

Former Member
0 Kudos

Hi,

Try this

HR_IN_GET_DATE_COMPONENTS

Former Member
0 Kudos

Hi,

check out these FM's

FM: HRGPBS_HESA_DATE_FORMAT

CONVERT_DATE_TO_INTERNAL and CONVERT_DATE_TO_EXTERNAL

Regards,

jaya

Former Member
0 Kudos

hi,

The use of FMs in this case actually depends on your business requirement.

if its of minimal processing, then better get the date month and year using offset positioning, because everytime a function module is called, the whole function group is loaded causing severe performance over head.

data:

w_date type d.

w_date(4)---> Year in the date,

w_date+4(2)---> month in the date,

w_date+6(2)---> corresponding day in the month.

provided the date format is YYYYMMDD, so please check your date format while performing this operation.

Thanks

Sharath

Former Member
0 Kudos

Hi,

Please find the link below

[Link|;

Hope this will be very helpful to you.

Thanks

Rajani.

Former Member
0 Kudos

Hi,

Try these links

Hope it gives you sum idea.

Regards,

Manish

former_member231368
Participant
0 Kudos

Dear Karthik,

This is the best function module to split the date and dont try to hard code.If I find new i will tell u

HR_IN_GET_DATE_COMPONENTS

Thanks N Regards

Yerukala Setty

Former Member
0 Kudos

use the fm u will get the output as bellow

HR_IN_GET_DATE_COMPONENT

DAY 22

MONTH 04

YEAR 2008

Regards

Former Member
0 Kudos

hi

use this FM CONVERSION_EXIT_PDATE_OUTPUT

input field date = 20090310

u get o/p = 03/10/2009

and then try to split DD,MM,YYYY seperately.

for example

DATA : v2(10).

DATA : d1(2),

d2(2),

d3(4).

PARAMETERS : p1 TYPE sy-datum.

START-OF-SELECTION.

CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'

EXPORTING

input = p1

IMPORTING

output = v2.

IF sy-subrc = 0.

SPLIT v2 AT '/' INTO d1 d2 d3.

WRITE : d1,d2,d3.

ENDIF.

Regards