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

FUNTION MODULE

Former Member
0 Likes
436

abap guru's

provide some mfuntion module program with some screen so that i can understsnd the use of funtion module.

Thanks

3 REPLIES 3
Read only

Former Member
0 Likes
412

hi

Function module: DATE_CREATE

Purpose: With help of this function module we increase no. of days, months and years to given

Date .

Program :

REPORT zcs_date_create.

PARAMETERS : date TYPE dvalut, " input date

dates(2) TYPE n, " dates to be increased

months(2) TYPE n, " months to be increased

years(4) TYPE n, " years to be increased

v_tag TYPE c, " parameter to get last

day of that month in output date

v_dayinc(2) TYPE n. " this is used to increase day of given date in the output

DATA: v_date TYPE dvalut,

v_day(2) TYPE n. " it returns the day of the given date

CALL FUNCTION 'DATE_CREATE'

EXPORTING

anzahl_jahre = years

anzahl_kaltage = dates

anzahl_monate = months

anzahl_tage = v_dayinc

datum_ein = date

ultimo_setzen = v_tag

IMPORTING

datum_aus = v_date

e_tt = v_day.

WRITE:/ 'given date', date.

IF v_tag = ' '.

WRITE:/ 'required date',v_date.

ELSEIF v_tag = 'X'.

WRITE:/ 'last date of that month in the output date ', v_date.

ELSE.

EXIT.

ENDIF.

IF v_dayinc IS INITIAL.

WRITE:/ 'day of given date', v_day.

ELSE.

WRITE:/ 'after incremented of',v_dayinc,'of given day',v_day.

ENDIF.

<REMOVED BY MODERATOR>

regards,

chandu

Edited by: Alvaro Tejada Galindo on Apr 30, 2008 3:49 PM

Read only

Former Member
0 Likes
412

hi ,

u see this also

Function module : HOLIDAY_GET

Purpose: This function module provides the list of all holidays based upon a Factory or Holiday

Calendar.

Program :

parameters: hol_id(2) type c , " holiday calender id

fact_id(2) type c, " factory calender id

fromdate type sydatum, " from date

enddate type sydatum. " end date

data: begin of holiday occurs 0.

include structure ISCAL_DAY.

data end of holiday.

data: v_yrfrm(4) type n, "year valid from

v_yrvlto(4) type n. "year valid to

CALL FUNCTION 'HOLIDAY_GET'

EXPORTING

HOLIDAY_CALENDAR = hol_id

FACTORY_CALENDAR = fact_id

DATE_FROM = fromdate

DATE_TO = enddate

IMPORTING

YEAR_OF_VALID_FROM = v_yrfrm

YEAR_OF_VALID_TO = v_yrvlto

  • RETURNCODE =

TABLES

holidays = holiday

  • EXCEPTIONS

  • FACTORY_CALENDAR_NOT_FOUND = 1

  • HOLIDAY_CALENDAR_NOT_FOUND = 2

  • DATE_HAS_INVALID_FORMAT = 3

  • DATE_INCONSISTENCY = 4

  • OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

write:/ 'year valid from ', v_yrfrm.

write:/ 'year valid to' ,v_yrvlto.

loop at holiday.

write:/ holiday-date, holiday- TXT_LONG.

endloop.

<REMOVED BY MODERATOR>

regards,

chandu

Edited by: Alvaro Tejada Galindo on Apr 30, 2008 3:50 PM