cancel
Showing results for 
Search instead for 
Did you mean: 

Country reassignment configuration

Former Member
0 Kudos

Dear experts,

I have a problem with Country Reassignment action.

When I run the action, I enter the hiring and leaving actions to combine, and run them one after the other, and my employee gets a new employee number for the new country, which is OK up to this point.

During the hiring action, some of the infotypes that are configured in the infogroup for Hiring action come with the data, like employee's name in Personal Data, or Internal data, or Communication infotypes. But others don't, for example Education.

How is it determined which infotype data are carried from the old employee number during a Country Reassignment? How can I automatically copy the existing records for the employee to the new employee number?

I thought of using a dynamic action, making a filter on action type, but action type Country Reassignment is not saved anywhere in the employee's records, so I do not think it's possible to have something that's triggered by the action type.

Any information on Country Reassignment is appreciated.

Thanks.

Nihan

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Dear Jun,

Thank you very much for the whole coding. I discussed this with the ABAP consultant that I work with, and he would like to have more information about the message class used in the program (zttmk_utility). It would be easier for us to interpret it if we have the details of these messages.

Thank you in advance.

Regards,

Nihan

Former Member
0 Kudos

This should solve your concern. I am therefore closing this thread.

Regards,

Jun

Former Member
0 Kudos

Hi Nihan

Please create own program in the system as follow so that you may copy existed employee to new one.

Report ZTTMK_EMPLOYEE_COPY

----


  • created on 27.01.2003 original system HRJ *

----


report zttmk_employee_copy message-id zttmk_utility.

include zttmk_employee_copy_data.

include zttmk_employee_copy_scrn.

include zttmk_employee_copy_main.

include zttmk_employee_copy_form.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Include ZTTMK_EMPLOYEE_COPY_DATA

----


  • created on 27.01.2003 original system HRJ *

----


tables: pa0003.

tables: t582a.

tables: pcl2.

data: ok type boole_d value 'X'.

data: not_ok type boole_d value ' '.

data: yes type c value 'J'.

data: no type c value 'N'.

data: cancel type c value 'A'.

data: gf_target_pernr type boole_d value 'X'.

data: gv_curr_pernr type pernr_d.

data gv_last_pernr type pernr_d.

data: gv_counter_loop type i.

data: gv_counter_pernr type i.

data: gt_t582a type table of t582a.

data: gt_log type table of string.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Include ZTTMK_EMPLOYEE_COPY_SCRN

----


  • created on 27.01.2003 original system HRJ *

----


selection-screen begin of block pernr with frame title text-s10.

selection-screen begin of block master with frame title text-s01.

parameters p_master type pernr_d obligatory.

selection-screen end of block master.

selection-screen begin of block target with frame title text-s02.

selection-screen begin of line.

selection-screen comment 1(20) text-sp1 for field p_target.

selection-screen position pos_low.

parameters p_target type pernr_d obligatory.

selection-screen pushbutton 50(30) text-s05 user-command srch.

selection-screen end of line.

parameters p_number type i obligatory.

selection-screen end of block target.

selection-screen end of block pernr.

selection-screen begin of block detail with frame title text-s11.

selection-screen begin of block infty with frame title text-s03.

select-options p_infty for t582a-infty.

selection-screen end of block infty.

selection-screen begin of block cluster with frame title text-s04.

parameters p_rjcopy as checkbox default 'X'.

parameters p_yjcopy as checkbox default 'X'.

parameters p_gjcopy as checkbox default 'X'.

selection-screen end of block cluster.

selection-screen end of block detail.

at selection-screen on p_master.

perform check_master_employee_screen

using

p_master.

at selection-screen on p_number.

perform check_number_screen

using

p_number.

at selection-screen.

perform user_command_on_sreen.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Include ZTTMK_EMPLOYEE_COPY_MAIN

----


  • created on 27.01.2003 original system HRJ *

----


start-of-selection.

perform sapgui_progress_indicator

using

'0'

text-000.

perform get_t582a

using

p_infty[]

changing

gt_t582a.

while gv_counter_pernr < p_number.

perform set_pernr

using

gv_counter_loop

p_target

changing

gv_curr_pernr.

perform check_target_employee

using

gv_curr_pernr

changing

gf_target_pernr.

perform increment_counter

changing

gv_counter_loop.

if gf_target_pernr eq ok.

perform confirm_continuation

using

gv_curr_pernr

gv_last_pernr

p_target.

perform display_progress_indicator

using

1

0

p_master

gv_curr_pernr.

perform increment_counter

changing

gv_counter_pernr.

perform copy_infotypes

using

p_master

gv_curr_pernr

gt_t582a.

perform copy_clusters

using

p_master

gv_curr_pernr

p_rjcopy

p_gjcopy

p_yjcopy.

perform append_log_file

using

gv_curr_pernr

ok.

gv_last_pernr = gv_curr_pernr.

else.

perform append_log_file

using

gv_curr_pernr

not_ok.

endif.

endwhile.

end-of-selection.

perform display_log.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Include ZTTMK_EMPLOYEE_COPY_FORM

----


  • created on 27.01.2003 original system HRJ *

----


&----


*& Form check_master_employee_screen

&----


form check_master_employee_screen

using

iv_master_pernr type pernr_d.

select * from pa0003 up to 1 rows

where pernr = iv_master_pernr.

endselect.

if sy-subrc <> 0.

message e000 with iv_master_pernr.

endif.

endform. " check_master_employee_screen

----


  • FORM display_pop_up_for_new_pernr *

----


form display_pop_up_for_new_pernr

using

iv_target_pernr type pernr_d

iv_empty_pernr type pernr_d

changing

cv_answer.

data: lv_title(70).

data: lv_diagnosetext1(70).

data: lv_diagnosetext2(70).

data: lv_diagnosetext3(70).

data: lv_textline1(70).

data: lv_textline2(70).

data: lv_pernr type pernr_d.

lv_title = text-p10.

lv_diagnosetext1 = text-p11.

lv_diagnosetext2 = text-p02.

lv_diagnosetext3 = text-p03.

lv_textline1 = text-p04.

lv_textline2 = text-p06.

replace '&' with iv_target_pernr into lv_diagnosetext1.

replace '&' with iv_empty_pernr into lv_diagnosetext3.

perform popup_to_confirm_with_message

using

lv_diagnosetext1

lv_diagnosetext2

lv_diagnosetext3

lv_textline1

lv_textline2

lv_title

changing

cv_answer.

endform.

&----


*& Form set_pernr

&----


form set_pernr

using

iv_increment_number type i

iv_target_pernr type pernr_d

changing

cv_pernr type pernr_d.

cv_pernr = iv_target_pernr + iv_increment_number.

endform. " set_pernr

&----


*& Form check_target_employee

&----


form check_target_employee

using

iv_target_pernr type pernr_d

changing

cf_target_pernr type boole_d.

select * from pa0003 up to 1 rows

where pernr = iv_target_pernr.

endselect.

if sy-subrc = 0.

cf_target_pernr = not_ok.

else.

cf_target_pernr = ok.

endif.

endform. " check_target_employee

&----


*& Form copy_infotypes

&----


form copy_infotypes

using

iv_master_pernr type pernr_d

iv_curr_pernr type pernr_d

it_t582a like gt_t582a[].

data: lv_dbname(6) type c value 'Pyxxxx'.

data: lv_number_of_lines type i.

field-symbols: <fs_t582a> type t582a.

describe table it_t582a lines lv_number_of_lines.

loop at it_t582a assigning <fs_t582a>.

perform set_db_name

using

<fs_t582a>

changing

lv_dbname.

perform display_progress_indicator

using

lv_number_of_lines

sy-tabix

p_master

gv_curr_pernr.

check lv_dbname+1(1) ca 'AB'.

perform copy_infotype

using

iv_master_pernr

iv_curr_pernr

lv_dbname.

endloop.

endform. " copy_infotypes

&----


*& Form set_db_name

&----


form set_db_name

using

is_t582a type t582a

changing

cv_dbname type c.

cv_dbname+1(1) = is_t582a-dbidn(1).

cv_dbname+2(4) = is_t582a-infty.

endform. " set_db_name

&----


*& Form copy_infotype

&----


form copy_infotype

using

iv_master_pernr type pernr_d

iv_curr_pernr type pernr_d

iv_dbname type c.

data: begin of ls_infotype.

data: mandt type mandt.

include structure: prelp.

data: end of ls_infotype.

select * into ls_infotype from (iv_dbname)

where pernr = iv_master_pernr.

ls_infotype-pernr = iv_curr_pernr.

insert into (iv_dbname) values ls_infotype.

endselect.

endform. " copy_infotype

&----


*& Form increment_counter

&----


form increment_counter

changing

cv_counter type i.

cv_counter = cv_counter + 1.

endform. " increment_counter

----


  • FORM sapgui_progress_indicator *

----


form sapgui_progress_indicator

using

iv_percentage type i

iv_text type c.

call function 'SAPGUI_PROGRESS_INDICATOR'

exporting

percentage = iv_percentage

text = iv_text.

endform.

&----


*& Form get_t582a

&----


form get_t582a

using

ip_infty like p_infty[]

changing

ct_t582a like gt_t582a[].

select * from t582a into table ct_t582a where infty in ip_infty.

if sy-subrc ne 0.

message e001.

endif.

endform. " get_t582a

&----


*& Form display_progress_indicator

&----


form display_progress_indicator

using

iv_total_number type i

iv_curnt_number type i

iv_master_pernr type pernr_d

iv_currnt_pernr type pernr_d.

data: lv_percentage type i.

data: lv_percent_c(3) type c.

data: lv_text(100) type c.

data: lv_mod type i.

if iv_curnt_number = 0.

lv_percentage = 1.

else.

lv_mod = iv_curnt_number mod 37.

lv_percentage = iv_curnt_number * 100 / iv_total_number.

endif.

check lv_mod = 0.

lv_text = text-001.

lv_percent_c = lv_percentage.

replace '&1' with iv_master_pernr into lv_text.

replace '&2' with iv_currnt_pernr into lv_text.

replace '&3' with lv_percent_c into lv_text.

perform sapgui_progress_indicator

using

lv_percentage lv_text.

endform. " display_progress_indicator

&----


*& Form append_log_file

&----


form append_log_file

using

iv_pernr type pernr_d

iv_flag type boole_d.

data: lv_string type string.

case iv_flag.

when ok.

lv_string = text-002.

replace '&' with iv_pernr into lv_string.

concatenate ok lv_string into lv_string.

when not_ok.

lv_string = text-003.

replace '&' with iv_pernr into lv_string.

endcase.

append lv_string to gt_log.

endform. " append_log_file

&----


*& Form display_log

&----


form display_log.

field-symbols: <fs_log> type string.

loop at gt_log assigning <fs_log>.

  • check <fs_log>(1) eq ok.

  • write: / <fs_log>+1.

endloop.

skip.

loop at gt_log assigning <fs_log>.

  • check <fs_log>(1) ne ok.

write: / <fs_log>.

endloop.

endform. " display_log

&----


*& Form copy_clusters

&----


form copy_clusters

using

iv_master_pernr type pernr_d

iv_target_pernr type pernr_d

iv_rjcopy type c

iv_gjcopy type c

iv_yjcopy type c.

perform copy_cluster

using

'CU'

iv_master_pernr

iv_target_pernr

iv_rjcopy.

perform copy_cluster

using

'RJ'

iv_master_pernr

iv_target_pernr

iv_rjcopy.

perform copy_cluster

using

'GJ'

iv_master_pernr

iv_target_pernr

iv_gjcopy.

perform copy_cluster

using

'YJ'

iv_master_pernr

iv_target_pernr

iv_yjcopy.

endform. " copy_cluster

&----


*& Form copy_cluster

&----


form copy_cluster

using

iv_cluster_id type relid

iv_master_pernr type pernr_d

iv_target_pernr type pernr_d

iv_copy_ok type boole_d.

data: lv_srtfd type pclkey value '________%'.

check iv_copy_ok = ok.

lv_srtfd(8) = iv_master_pernr.

select * from pcl2 where relid = iv_cluster_id and

srtfd like lv_srtfd.

pcl2-srtfd(8) = iv_target_pernr.

insert pcl2.

endselect.

endform. " copy_cluster

&----


*& Form display_pop_up_to_continue

&----


form display_pop_up_to_continue

using

iv_pernr type pernr_d.

data: lv_title(35).

data: lv_textline1(35).

data: lv_textline2(35).

data: lv_answer.

lv_title = text-p00.

lv_textline1 = text-p01.

lv_textline2 = text-p02.

replace '&' with iv_pernr into lv_title.

call function 'POPUP_TO_DECIDE_INFO'

exporting

textline1 = lv_textline1

textline2 = lv_textline2

titel = lv_title

importing

answer = lv_answer.

if lv_answer ne 'J'.

message s002.

reject.

endif.

endform. " display_pop_up_to_continue

&----


*& Form check_number_screen

&----


form check_number_screen

using

iv_number type i.

check iv_number => 100.

message w004 with '100'.

endform. " check_number_screen

&----


*& Form popup_to_confirm_with_message

&----


form popup_to_confirm_with_message

using

iv_diagnosetext1 type c

iv_diagnosetext2 type c

iv_diagnosetext3 type c

iv_textline1 type c

iv_textline2 type c

iv_title type c

changing

cv_answer type c.

call function 'POPUP_TO_CONFIRM_WITH_MESSAGE'

exporting

defaultoption = 'Y'

diagnosetext1 = iv_diagnosetext1

diagnosetext2 = iv_diagnosetext2

diagnosetext3 = iv_diagnosetext3

textline1 = iv_textline1

textline2 = iv_textline2

titel = iv_title

cancel_display = 'X'

importing

answer = cv_answer.

endform. " popup_to_confirm_with_message

&----


*& Form confirm_continuation

&----


form confirm_continuation

using

iv_curr_pernr type pernr_d

iv_last_pernr type pernr_d

iv_target_pernr type pernr_d.

data: lv_last_pernr type pernr_d.

if iv_last_pernr = '00000000'.

lv_last_pernr = iv_target_pernr.

else.

lv_last_pernr = iv_last_pernr + 1.

endif.

check iv_curr_pernr <> lv_last_pernr.

data: lv_title(70).

data: lv_diagnosetext1(70).

data: lv_diagnosetext2(70).

data: lv_diagnosetext3(70).

data: lv_textline1(70).

data: lv_textline2(70).

data: lv_answer.

data: lv_pernr type pernr_d.

lv_title = text-p00.

lv_diagnosetext1 = text-p01.

lv_diagnosetext2 = text-p02.

replace '&' with lv_last_pernr into lv_diagnosetext1.

if iv_curr_pernr < lv_last_pernr.

lv_diagnosetext3 = text-p07.

lv_textline1 = text-p08.

lv_textline2 = text-p09.

else.

lv_diagnosetext3 = text-p03.

lv_textline1 = text-p04.

lv_textline2 = text-p06.

replace '&' with iv_curr_pernr into lv_diagnosetext3.

endif.

perform popup_to_confirm_with_message

using

lv_diagnosetext1

lv_diagnosetext2

lv_diagnosetext3

lv_textline1

lv_textline2

lv_title

changing

lv_answer.

if iv_curr_pernr < lv_last_pernr.

message e003 with lv_last_pernr.

else.

case lv_answer.

when yes.

when no.

message e002.

when cancel.

message e002.

endcase.

endif.

endform. " confirm_continuation

&----


*& Form user_command_on_sreen

&----


form user_command_on_sreen.

case sy-ucomm.

when 'SRCH'.

perform serch_new_pernr

changing

p_target.

endcase.

endform. " user_command_on_sreen

&----


*& Form serch_new_pernr

&----


form serch_new_pernr

changing

iv_target_pernr type pernr_d.

data: lv_pernr type pernr_d.

data: lv_answer type c.

lv_pernr = iv_target_pernr.

select * from pa0003 up to 1 rows where pernr = lv_pernr.

endselect.

if sy-subrc ne 0.

message s005 with lv_pernr.

else.

do.

lv_pernr = iv_target_pernr + sy-index.

select * from pa0003 up to 1 rows

where pernr = lv_pernr.

endselect.

check sy-subrc ne 0.

perform display_pop_up_for_new_pernr

using

iv_target_pernr

lv_pernr

changing

lv_answer.

case lv_answer.

when yes.

message s006 with iv_target_pernr lv_pernr.

iv_target_pernr = lv_pernr.

when no.

message s007.

when cancel.

message s007.

endcase.

exit.

enddo.

endif.

endform. " serch_new_pernr

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Regards

Jun

Former Member
0 Kudos

I am not sure of where to do the settings for copying the relevant infotype..But I do know where to find the action type for an employee. Check out the field, PA0000-MASSN for the pernr and do necessary coding.