2008 Jul 30 5:41 PM
Hi, I am writing some perform statements in the user exit include. It is giving the following syntax error.
Include ZXPBEU12.
Incorrect nesting: Before the statement "FORM", the structure introduced by "FUNCTION" must be concluded by "ENDFUNCTION" . .....
Can you advise?
Thanks,
Sai.
Hi, I am writing some perform statements in the user exit include. It is giving the following syntax error.
Include ZXPBEU12.
Incorrect nesting: Before the statement "FORM", the structure introduced by "FUNCTION" must be concluded by "ENDFUNCTION" . .....
Can you advise?
Thanks,
Sai.
2008 Jul 30 5:43 PM
2008 Jul 30 5:49 PM
INCLUDE FBEN0D05.
INCLUDE FBEN0D01.
*include LHRBEN00GENERALF01.
data: error_table like STANDARD TABLE OF rpbenerr,
non_elig_reasons like STANDARD TABLE OF rpbenerr.
data: subrc type sy-subrc.
infotypes: 0002 name i0002. "Personal Data
data: h5ubv like t5ubv,
minbd like p0000-begda,
newbd like p0000-begda,
maxbd like p0000-begda,
waitd like p0000-begda,
retcd like sy-subrc.
data: begda like sy-datum,
endda like sy-datum,
period_length type i,
num_of_days type i,
tdate like sy-datum.
*
data: wait_date_unknown type boolean.
constants high_date type d value '99991231'.
*
subrc = 0.
retcd = 0.
clear _elidt.
*
Need data from table T5UBV
perform re5ubv(sapfben0) tables error_table
using _barea
_belig
_eligr
_edate
_rect
changing h5ubv
subrc.
check subrc = 0.
Calculate the wait date
call function 'HR_BEN_CALC_WAIT_DATE_ELIGB'
exporting
pernr = _pernr
datum = _edate
dttyp = h5ubv-dttyp
waitn = h5ubv-waitn
waitu = h5ubv-waitu
waity = h5ubv-waity
enday = h5ubv-enday
enint = h5ubv-enint
reaction = _rect
importing
wait_date = waitd
wait_date_unknown = wait_date_unknown
subrc = subrc
tables
non_elig_reasons = non_elig_reasons
error_table = error_table.
check subrc = 0.
check wait_date_unknown = false.
*
Then get age related dates
clear i0002. refresh i0002.
call function 'HR_READ_INFOTYPE'
exporting
pernr = _pernr
infty = '0002'
begda = _edate
endda = _edate
importing
subrc = retcd
tables
infty_tab = i0002
exceptions
infty_not_found = 1
others = 2.
if ( retcd <> 0 ) or ( sy-subrc <> 0 ) or ( i0002-gbdat is initial ).
subrc = 8.
call function 'HR_BEN_HANDLE_ERROR'
exporting
pernr = _pernr
msg_class = msg_class3
msg_number = '152'
msg_par1 = ''
msg_par2 = ''
msg_par3 = ''
msg_par4 = ''
severity = subrc
reaction = _rect
tables
error_table = error_table.
exit.
endif.
*
read table i0002 index 1.
clear: minbd, maxbd.
if not ( h5ubv-minag is initial ).
subrc = 0.
*
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = i0002-gbdat
days = 0
months = 0
years = h5ubv-minag
signum = '+'
importing
calc_date = newbd.
subrc = 0.
if ( h5ubv-enint = ' ' ) or ( h5ubv-enint = '0' ).
minbd = newbd.
else.
case h5ubv-enint.
when '1'. " Months
begda = newbd.
begda+6(2) = '01'. " First day of month
call function 'RP_LAST_DAY_OF_MONTHS'
exporting
day_in = newbd
importing
last_day_of_month = endda " Last day of month
exceptions
day_in_no_date = 1.
if sy-subrc <> 0.
subrc = 8.
exit.
endif.
when '2'. " Quarter
tdate = newbd.
if tdate+4(4) > '1001'. " Date in 4th quarter
tdate+4(4) = '1001'.
elseif tdate+4(4) > '0701'. " Date in 3rd quarter
tdate+4(4) = '0701'.
elseif tdate+4(4) > '0401'. " Date in 2nd quarter
tdate+4(4) = '0401'.
else. " Date in 1st quarter
tdate+4(4) = '0101'.
endif.
begda = tdate.
subrc = 0.
*
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = begda
days = 0
months = 2
years = 0
signum = '+'
importing
calc_date = tdate.
*
if tdate < begda.
tdate = high_date.
endif.
check subrc = 0.
call function 'RP_LAST_DAY_OF_MONTHS'
exporting
day_in = tdate
importing
last_day_of_month = endda " Last day of quarter
exceptions
day_in_no_date = 1.
if sy-subrc <> 0.
subrc = 8.
exit.
endif.
when '3'. " Years
begda = newbd.
begda+4(4) = '0101'.
endda = newbd.
endda+4(4) = '1231'.
when '4'. " Pay period
perform get_dates_of_period tables error_table
using _pernr
newbd
_rect
changing begda
endda
subrc.
when others.
begda = newbd.
endda = newbd.
endcase.
endif.
Get eligibility date
Calculate the wait date
call function 'HR_BEN_CALC_WAIT_DATE_ELIGB'
exporting
pernr = _pernr
datum = newbd
dttyp = h5ubv-dttyp
waitn = 0
waitu = ''
waity = ''
enday = h5ubv-enday
enint = h5ubv-enint
reaction = _rect
importing
wait_date = minbd
wait_date_unknown = wait_date_unknown
subrc = subrc
tables
non_elig_reasons = non_elig_reasons
error_table = error_table.
check subrc = 0.
if subrc <> 0.
subrc = 8.
call function 'HR_BEN_HANDLE_ERROR'
exporting
pernr = _pernr
msg_class = msg_class3
msg_number = '165'
msg_par1 = ''
msg_par2 = ''
msg_par3 = ''
msg_par4 = ''
severity = subrc
reaction = _rect
tables
error_table = error_table.
exit.
endif.
*
if minbd < i0002-gbdat.
minbd = high_date.
endif.
check subrc = 0.
endif.
if not ( h5ubv-maxag is initial ).
perform calc_date tables error_table
using i0002-gbdat
0
0
h5ubv-maxag
_rect
changing maxbd
subrc.
check subrc = 0.
maxbd(4) = maxbd(4) + 1.
maxbd = maxbd - 1.
endif.
Finally compare them
if ( waitd < minbd ).
waitd = minbd.
if waitd > _edate.
call function 'HR_BEN_HANDLE_ERROR'
exporting
pernr = _pernr
msg_class = msg_class3
msg_number = '148'
severity = 8
reaction = no_msg
tables
error_table = non_elig_reasons.
endif.
endif.
*
if ( waitd <= maxbd and _edate <= maxbd ) or ( maxbd is initial ).
_elidt = waitd.
else.
clear _elidt.
call function 'HR_BEN_HANDLE_ERROR'
exporting
pernr = _pernr
msg_class = msg_class3
msg_number = '153'
severity = 8
reaction = no_msg
tables
error_table = non_elig_reasons.
endif.
*
form get_dates_of_period tables error_table structure rpbenerr
using value(pernr) like pskey-pernr
value(datum) like sy-datum
value(react) like sy-msgty
changing begda like sy-datum
endda like sy-datum
subrc like sy-subrc.
*
data: permo like t549q-permo.
*
subrc = 0.
*
call function 'HR_BEN_GET_EE_PAY_FREQUENCY'
exporting
pernr = pernr
datum = datum
reaction = react
importing
permo = permo
subrc = subrc
tables
error_table = error_table.
check subrc = 0.
*
clear t549q.
select * from t549q where permo = permo
and begda <= datum
and endda >= datum
order by primary key.
exit.
endselect.
begda = t549q-begda.
endda = t549q-endda.
if sy-subrc <> 0.
subrc = 8.
call function 'HR_BEN_HANDLE_ERROR'
exporting
pernr = pernr
msg_class = msg_class3
msg_number = '154'
msg_par1 = permo
msg_par2 = ''
msg_par3 = ''
msg_par4 = ''
severity = subrc
reaction = react
tables
error_table = error_table.
exit.
endif.
*
endform. " GET_DATES_OF_PERIOD
It gave an error on the perform routine defnition.
Thanks,
2008 Jul 30 5:44 PM
Hi,
Welcome to SDN.
Write a Include and call that in your User Exit. Write your code there.
User Exit dont allow use of PERFORM in it or write the whole code inside the exit only.
Regards,
Amit
2008 Jul 30 5:51 PM
hi,
As Amit pointed out remove all the performs and write the code outside to avoid the error...
Regards,
Santosh
2008 Jul 30 6:00 PM
I have written the performs in a separate include program and then inserted that include program. The same error.
Thanks,
2008 Jul 30 6:03 PM
hi,
Why do want to create a new & separate include program ..... Write all the data here in this include itself without using any performs ... forms and includes ...
Regards,
Santosh
2008 Jul 30 6:05 PM
We can do that. But using performs makes much robust way than writing everything right there.
Thanks,
2008 Jul 30 5:45 PM
hi Sai,
Welcome to SDN ... Check towards the end in your include that you might have missed the '.' also check if you have properly closed all the if ... endif ... loop ...endloop...statements ..
Regards,
Santosh
2008 Jul 30 6:07 PM
.....must be concluded by "ENDFUNCTION" . .....
Write "ENDFUNCTION." on the end of your function module.
FUNCTION cccccccccccccccc.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" ......
*" EXPORTING
*" .....
*" TABLES
*" .....
*" EXCEPTIONS
*" .....
**************************
coding...
coding...
coding...
coding...
ENDFUNCTION.
2008 Jul 30 6:08 PM
2008 Jul 30 6:30 PM
Ok, I try again:
Incorrect nesting: Before the statement "FORM", the structure introduced by "FUNCTION" must be concluded by "ENDFUNCTION" . .....
Write "ENDFUNCTION." on the end of your function module.
2010 Mar 23 7:12 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |