2014 Oct 01 12:59 PM
Hi ,
I have an issue with the below scenario.
I am adding dependants using an inbound interface file .
When i am trying to add a new spouse to an employee, i need to delimit the the previous spouse in PA0021.
I have tried using the below code but it shows the below error.
If the file comes with a Domestic partner, then first check if the employee has a spouse record active, if it does, then delimit the existing spouse record first (begin date for the DP-1), before creating the Domestic partner record.
The same applies if the file comes with spouse and an active DP record exists.
IF wa_data-relation = gc_dp
OR wa_data-relation = gc_spouse.
READ TABLE p_gt_pa0021 INTO wa_pa0021 WITH KEY
pernr = wa_pa0002-pernr
sub_type = gc_1.
IF sy-subrc NE 0.
READ TABLE p_gt_pa0021 INTO wa_pa0021 WITH KEY
pernr = wa_pa0002-pernr
sub_type = gc_13.
ENDIF.
PERFORM modify USING wa_data
wa_p0021
wa_p0106
wa_pa0002
wa_pa0021
CHANGING p_gt_error.
ENDIF.
FORM modify USING wa_data TYPE ty_data
wa_p0021 TYPE p0021
wa_p0106 TYPE p0106
wa_pa0002 TYPE ty_pa0002
wa_pa0021 TYPE ty_pa0021
CHANGING p_p_gt_error.
IF NOT p_test IS INITIAL.
EXIT.
ENDIF.
DATA: lv_date TYPE datum,
lv_end_date TYPE datum,
lv_subty TYPE char4.
lv_date = wa_data-eff_start_dt.
* lv_end_date = gc_99991231.
IF wa_data-relation = gc_spouse.
wa_p0021-subty = wa_pa0021-sub_type.
wa_p0021-infty = gc_0021.
wa_p0021-pernr = wa_pa0002-pernr.
wa_p0021-famsa = wa_p0021-subty.
wa_p0021-objps = wa_pa0021-object_type.
wa_p0021-begda = wa_pa0021-begda.
wa_p0021-endda = lv_date - 1.
wa_p0021-aedtm = sy-datum.
wa_p0106-pernr = wa_pa0002-pernr.
wa_p0106-infty = gc_0106.
wa_p0106-objps = wa_pa0021-object_type.
wa_p0106-subty = wa_p0021-subty.
wa_p0106-begda = wa_pa0021-begda.
wa_p0106-endda = lv_date - 1.
wa_p0021-aedtm = sy-datum.
ENDIF.
IF wa_data-relation = gc_dp.
wa_p0021-pernr = wa_pa0002-pernr.
wa_p0021-infty = gc_0021.
wa_p0021-objps = wa_pa0021-object_type.
wa_p0021-begda = wa_pa0021-endda.
wa_p0021-endda = lv_date - 1.
wa_p0021-aedtm = sy-datum.
wa_p0021-famsa = gc_1.
wa_p0021-favor = wa_pa0021-depftname.
wa_p0021-fanam = wa_pa0021-depltname.
wa_p0021-fgbdt = wa_pa0021-dep_dob.
wa_p0021-fasex = wa_pa0021-dep_gender.
wa_p0106-pernr = wa_pa0002-pernr.
wa_p0106-infty = gc_0106.
wa_p0106-objps = wa_pa0021-object_type.
wa_p0106-begda = wa_pa0021-endda.
wa_p0106-endda = lv_date - 1.
wa_p0106-aedtm = sy-datum.
wa_p0106-subty = gc_1.
wa_p0106-perid = wa_pa0021-depssn.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = wa_pa0002-pernr
IMPORTING
return = wa_return.
IF wa_return IS NOT INITIAL.
* popualte the error table
PERFORM error_table USING wa_pa0002-pernr
wa_pa0002-vorna
wa_data-depftname
wa_return-message
CHANGING p_p_gt_error.
ELSE.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = wa_p0021-infty
number = wa_pa0002-pernr
subtype = wa_p0021-subty
objectid = wa_p0021-objps
validityend = wa_p0021-endda
validitybegin = wa_p0021-begda
record = wa_p0021
operation = gv_upd
dialog_mode = gv_mode
secondary_record = wa_p0106
view_identifier = gc_10
IMPORTING
return = wa_return.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = wa_pa0002-pernr
IMPORTING
return = wa_return.
ENDFORM. " MODIFY
when i execute the above program it gives the error as "no data for the family/dependants with the selection period.
I have already checked the record exists in pa0021.
Hi ,
I have an issue with the below scenario.
I am adding dependants using an inbound interface file .
When i am trying to add a new spouse to an employee, i need to delimit the the previous spouse in PA0021.
I have tried using the below code but it shows the below error.
If the file comes with a Domestic partner, then first check if the employee has a spouse record active, if it does, then delimit the existing spouse record first (begin date for the DP-1), before creating the Domestic partner record.
The same applies if the file comes with spouse and an active DP record exists.
IF wa_data-relation = gc_dp
OR wa_data-relation = gc_spouse.
READ TABLE p_gt_pa0021 INTO wa_pa0021 WITH KEY
pernr = wa_pa0002-pernr
sub_type = gc_1.
IF sy-subrc NE 0.
READ TABLE p_gt_pa0021 INTO wa_pa0021 WITH KEY
pernr = wa_pa0002-pernr
sub_type = gc_13.
ENDIF.
PERFORM modify USING wa_data
wa_p0021
wa_p0106
wa_pa0002
wa_pa0021
CHANGING p_gt_error.
ENDIF.
FORM modify USING wa_data TYPE ty_data
wa_p0021 TYPE p0021
wa_p0106 TYPE p0106
wa_pa0002 TYPE ty_pa0002
wa_pa0021 TYPE ty_pa0021
CHANGING p_p_gt_error.
IF NOT p_test IS INITIAL.
EXIT.
ENDIF.
DATA: lv_date TYPE datum,
lv_end_date TYPE datum,
lv_subty TYPE char4.
lv_date = wa_data-eff_start_dt.
* lv_end_date = gc_99991231.
IF wa_data-relation = gc_spouse.
wa_p0021-subty = wa_pa0021-sub_type.
wa_p0021-infty = gc_0021.
wa_p0021-pernr = wa_pa0002-pernr.
wa_p0021-famsa = wa_p0021-subty.
wa_p0021-objps = wa_pa0021-object_type.
wa_p0021-begda = wa_pa0021-begda.
wa_p0021-endda = lv_date - 1.
wa_p0021-aedtm = sy-datum.
wa_p0106-pernr = wa_pa0002-pernr.
wa_p0106-infty = gc_0106.
wa_p0106-objps = wa_pa0021-object_type.
wa_p0106-subty = wa_p0021-subty.
wa_p0106-begda = wa_pa0021-begda.
wa_p0106-endda = lv_date - 1.
wa_p0021-aedtm = sy-datum.
ENDIF.
IF wa_data-relation = gc_dp.
wa_p0021-pernr = wa_pa0002-pernr.
wa_p0021-infty = gc_0021.
wa_p0021-objps = wa_pa0021-object_type.
wa_p0021-begda = wa_pa0021-endda.
wa_p0021-endda = lv_date - 1.
wa_p0021-aedtm = sy-datum.
wa_p0021-famsa = gc_1.
wa_p0021-favor = wa_pa0021-depftname.
wa_p0021-fanam = wa_pa0021-depltname.
wa_p0021-fgbdt = wa_pa0021-dep_dob.
wa_p0021-fasex = wa_pa0021-dep_gender.
wa_p0106-pernr = wa_pa0002-pernr.
wa_p0106-infty = gc_0106.
wa_p0106-objps = wa_pa0021-object_type.
wa_p0106-begda = wa_pa0021-endda.
wa_p0106-endda = lv_date - 1.
wa_p0106-aedtm = sy-datum.
wa_p0106-subty = gc_1.
wa_p0106-perid = wa_pa0021-depssn.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = wa_pa0002-pernr
IMPORTING
return = wa_return.
IF wa_return IS NOT INITIAL.
* popualte the error table
PERFORM error_table USING wa_pa0002-pernr
wa_pa0002-vorna
wa_data-depftname
wa_return-message
CHANGING p_p_gt_error.
ELSE.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = wa_p0021-infty
number = wa_pa0002-pernr
subtype = wa_p0021-subty
objectid = wa_p0021-objps
validityend = wa_p0021-endda
validitybegin = wa_p0021-begda
record = wa_p0021
operation = gv_upd
dialog_mode = gv_mode
secondary_record = wa_p0106
view_identifier = gc_10
IMPORTING
return = wa_return.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = wa_pa0002-pernr
IMPORTING
return = wa_return.
ENDFORM. " MODIFY
when i execute the above program it gives the error as "no data for the family/dependants with the selection period.
I have already checked the record exists in pa0021.
2014 Oct 01 1:31 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |