badi for infotypes
METHOD if_ex_hrpad00infty~after_input.
DATA lv_datum TYPE datum.
DATA lv_adrs TYPE text60.
DATA lv_check(10) TYPE n VALUE '1234567890'.
DATA lv_days TYPE tfmatage.
DATA lv_months TYPE tfmatage.
DATA lv_years TYPE tfmatage.
DATA badi_message_handler TYPE REF TO cl_hrpa_message_list.
DATA message_handler TYPE REF TO if_hrpa_message_handler.
DATA msg TYPE symsg.
DATA is_ok TYPE boole_d.
* CONSTANTS :
CREATE OBJECT badi_message_handler.
message_handler = badi_message_handler.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '030'.
* msg-msgv1 = c_ . "'Invalid Plan'(z09).
DATA : ls_p0591 TYPE p0591.
IF new_innnn-infty = '0591'.
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = new_innnn
IMPORTING
pnnnn = ls_p0591.
IF ls_p0591-dat01 IS NOT INITIAL
AND ls_p0591-dat01 GT 0.
IF ls_p0591-gra01 IS INITIAL .
lv_datum = ls_p0591-dat01.
lv_adrs = ls_p0591-gra01.
ENDIF.
ENDIF.
IF ls_p0591-dat02 IS NOT INITIAL
AND ls_p0591-dat02 GT 0.
IF ls_p0591-gra02 IS INITIAL .
lv_datum = ls_p0591-dat02.
lv_adrs = ls_p0591-gra02.
ENDIF.
ENDIF.
IF ls_p0591-dat03 IS NOT INITIAL
AND ls_p0591-dat03 GT 0.
IF ls_p0591-gra03 IS INITIAL .
lv_datum = ls_p0591-dat03.
lv_adrs = ls_p0591-gra03.
ENDIF.
ENDIF.
IF ls_p0591-dat04 IS NOT INITIAL
AND ls_p0591-dat04 GT 0.
IF ls_p0591-gra04 IS INITIAL .
lv_datum = ls_p0591-dat04.
lv_adrs = ls_p0591-gra04.
ENDIF.
ENDIF.
IF ls_p0591-dat05 IS NOT INITIAL
AND ls_p0591-dat05 GT 0.
IF ls_p0591-gra05 IS INITIAL .
lv_datum = ls_p0591-dat05.
lv_adrs = ls_p0591-gra05.
ENDIF.
ENDIF.
IF lv_datum IS NOT INITIAL
AND lv_adrs IS INITIAL .
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
i_date_from = lv_datum
* I_KEY_DAY_FROM =
i_date_to = sy-datum
* I_KEY_DAY_TO =
* I_FLG_SEPARATE = ' '
IMPORTING
e_days = lv_days
e_months = lv_months
e_years = lv_years.
IF lv_years LT 18 AND lv_adrs IS INITIAL .
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
ENDIF.
CLEAR : lv_datum,
lv_adrs,
lv_days,
lv_months,
lv_years.
ENDIF.
*BREAK ABAP07.
* data : lv_name1(30) type c.
***--logic for gratuity nominations
* if ls_p0591-nam01 is not initial.
* lv_name1 = ls_p0591-nam01.
* endif.
*
**set PARAMETER ID 'ABC' FIELD LV_NAME1.
*EXPORT LV_NAME1 FROM LV_NAME1 TO MEMORY ID 'LV_NAME1'.
ENDIF.
* IF new_innnn-infty = '0008'.
*
* DATA:
* ls_p0008 TYPE p0008.
*
* CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
* EXPORTING
* prelp = new_innnn
* IMPORTING
* pnnnn = ls_p0008.
*
*
* DATA : lv_char(10) TYPE c.
* DATA: lv_chr(10) TYPE c,
* lv_num TYPE p.
*
* lv_chr = new_innnn-data1+92(10).
**lv_num
* CALL FUNCTION 'MOVE_CHAR_TO_NUM'
* EXPORTING
* chr = lv_chr
* IMPORTING
* num = lv_num
* EXCEPTIONS
* convt_no_number = 1
* convt_overflow = 2
* OTHERS = 3.
* IF sy-subrc <> 0.
** Implement suitable error handling here
* ENDIF.
* ENDIF.
ENDMETHOD.
METHOD if_ex_hrpad00infty~after_input .
CHECK i001p-molga EQ '21' AND
new_innnn-infty EQ '2006'.
DATA:
* lt_0001 TYPE TABLE OF p0001,
* lt_0007 TYPE TABLE OF p0007,
* lt_0008 TYPE TABLE OF p0008,
* lt_0016 TYPE TABLE OF p0016,
* lv_quomo TYPE quomo,
ls_2006 TYPE p2006,
ls_old_2006 TYPE p2006,
lv_mandt TYPE sy-mandt,
lv_ok TYPE c.
INCLUDE mp326011.
PERFORM use_3260 IN PROGRAM mp326000
USING new_innnn-begda
i001p-molga
lv_ok.
CHECK lv_ok IS NOT INITIAL.
* A 3260 használatban van!
CLASS cl_hr_pnnnn_type_cast DEFINITION LOAD.
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = new_innnn
IMPORTING
pnnnn = ls_2006.
PERFORM memory_id IN PROGRAM mp326000
USING gv_memory_id.
IMPORT gv_from_3260 TO gv_from_3260
FROM MEMORY ID gv_memory_id.
IF sy-subrc NE 0.
CLEAR gv_from_3260.
ENDIF.
IF gv_from_3260 NE '3260'.
* { C5066700 2009.12.13 - Nem pontos kulccsal ellenőrizzük
* CALL FUNCTION 'HR_READ_INFOTYPE'
* EXPORTING
** TCLAS = 'A'
* pernr = ls_2006-pernr
* infty = '0001'
* begda = ls_2006-begda
* endda = ls_2006-endda
** BYPASS_BUFFER = ' '
** LEGACY_MODE = ' '
** IMPORTING
** SUBRC =
* TABLES
* infty_tab = lt_0001
* EXCEPTIONS
* infty_not_found = 1
* OTHERS = 2.
* CALL FUNCTION 'HR_READ_INFOTYPE'
* EXPORTING
** TCLAS = 'A'
* pernr = ls_2006-pernr
* infty = '0007'
* begda = ls_2006-begda
* endda = ls_2006-endda
** BYPASS_BUFFER = ' '
** LEGACY_MODE = ' '
** IMPORTING
** SUBRC =
* TABLES
* infty_tab = lt_0007
* EXCEPTIONS
* infty_not_found = 1
* OTHERS = 2.
* CALL FUNCTION 'HR_READ_INFOTYPE'
* EXPORTING
** TCLAS = 'A'
* pernr = ls_2006-pernr
* infty = '0008'
* begda = ls_2006-begda
* endda = ls_2006-endda
** BYPASS_BUFFER = ' '
** LEGACY_MODE = ' '
** IMPORTING
** SUBRC =
* TABLES
* infty_tab = lt_0008
* EXCEPTIONS
* infty_not_found = 1
* OTHERS = 2.
* CALL FUNCTION 'HR_READ_INFOTYPE'
* EXPORTING
** TCLAS = 'A'
* pernr = ls_2006-pernr
* infty = '0016'
* begda = ls_2006-begda
* endda = ls_2006-endda
** BYPASS_BUFFER = ' '
** LEGACY_MODE = ' '
** IMPORTING
** SUBRC =
* TABLES
* infty_tab = lt_0016
* EXCEPTIONS
* infty_not_found = 1
* OTHERS = 2.
* PERFORM det_quomo IN PROGRAM saplhrlv
* TABLES lt_0001
* lt_0007
* lt_0008
* lt_0016
* USING ls_2006-begda
* ls_2006-pernr
* CHANGING lv_quomo.
* SELECT SINGLE mandt
* INTO lv_mandt
* FROM t5hpbs64
* WHERE mopgk EQ i503-konty
* AND mozko EQ i001p-mozko
* AND quomo EQ lv_quomo
* AND endda GE ls_2006-begda
* AND begda LE ls_2006-endda
* AND zosker EQ ls_2006-ktart.
SELECT SINGLE mandt
INTO lv_mandt
FROM t5hpbs64
WHERE endda GE ls_2006-begda
AND begda LE ls_2006-endda
AND zosker EQ ls_2006-ktart.
* } C5066700 2009.12.13 - Nem pontos kulccsal ellenőrizzük
IF sy-subrc EQ 0.
* { A felhasználás kezdete és vége változhat!
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = old_innnn
IMPORTING
pnnnn = ls_old_2006.
CLEAR: ls_2006-desta,
ls_2006-deend,
ls_2006-aedtm,
ls_2006-uname,
ls_old_2006-desta,
ls_old_2006-deend,
ls_old_2006-aedtm,
ls_old_2006-uname.
IF ls_2006 NE ls_old_2006 OR
ipsyst-ioper EQ 'DEL' OR
ipsyst-ioper EQ 'LIS9' OR
ipsyst-ioper EQ 'EDQ' OR
ipsyst-ioper EQ 'MEDQ' OR
ipsyst-ioper EQ 'DLIM'.
MESSAGE e801(hrpbshu).
ENDIF.
* } A felhasználás kezdete és vége változhat!
ELSE.
* { C5066700 2009.12.03 - Nem pontos kulccsal ellenőrizzük
* SELECT SINGLE mandt
* INTO lv_mandt
* FROM t5hpbs64
* WHERE mopgk EQ i503-konty
* AND mozko EQ i001p-mozko
* AND quomo EQ lv_quomo
* AND endda GE ls_2006-begda
* AND begda LE ls_2006-endda
* AND fajta EQ ls_2006-ktart.
SELECT SINGLE mandt
INTO lv_mandt
FROM t5hpbs64
WHERE endda GE ls_2006-begda
AND begda LE ls_2006-endda
AND fajta EQ ls_2006-ktart
AND zosker NE space.
* } C5066700 2009.12.03 - Nem pontos kulccsal ellenőrizzük
IF sy-subrc EQ 0.
MESSAGE e801(hrpbshu).
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
No comments:
Post a Comment