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 calculation check in a badi

Former Member
0 Kudos
99

Hi all I want to do a check calculation in a badi - on an internal table of dates. In normal abap I was able to do it easily. but in oo abap, its not allowing me to do the arethmatic calculation on date fields.Below is the code:

method IF_EX_PT_ABS_REQ~GET_WORKFLOW_ATTRIBS.

begda type pa2001-begda,

end of date1.

data: zbegda type table of date1,

zbegdah type table of date1,

line1 like line of zbegdah.

*data zbegda like pa2001-begda occurs 0 with header line.

*data zbegdah like pa2001-begda occurs 0 with header line.

select begda from pa2001 into table zbegda

where pernr = pernr1.

zbegdah[] = zbegda[].

clear zbegda[].

loop at zbegdah into line1.

add 1 to zbegdah. "<------ THIS LINE IS GIVING ME ERROR

*line1-begda = zbegdah + 1.

append line1 to zbegda.

endloop.

loop at zbegda into line1.

if line1-begda eq bdate.

MESSAGE i074(hrtim_abs_req).

endif.

endloop.

endmethod.

Actually, in my EP leave request workflow I want to give an error message, if the user applies for a leave of say 5th april, and he already has an approved leave of 6th of april - which is stored in infotype 21.

There is a badi - SE18 -> Enhancement Spots PT_ABS_REQ. In this, I am creating implimentation and I am writing the code in the method - IF_EX_PT_ABS_REQ~GET_WORKFLOW_ATTRIBS.

I also want to know that if i declare 2 fields - PERNR1 and bdate ( begin date of leave) in attributes, which I did, would they be passed from EP at runtime? if not, what should I do to get them in my method?

Please suggest.

Thanks

Ribhu

1 REPLY 1

Former Member
0 Kudos
66

put like this.

<b>loop at zbegdah into line1.

add 1 to zbegdah-begda. "<------ THIS LINE IS GIVING ME ERROR

*line1-begda = zbegdah-begda + 1.

append line1 to zbegda.

endloop.</b>

Regards

Peram