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: 

Download Acknowledgement after Changing IT0121 manually(PA30)

Former Member
0 Kudos

I am downloading acknowledgement using user exit ZXPADU02.

This Ack is to be downloaded with the Primary Employee being changed in infotype 121.

As soon as Prim EMP is changed in PA30 ...i want a Acknowledgment to be downloaded containing the New Primary Emp as per IT 0121.

I developed this code. But it always gives me the Previous Primary Emp in Infotype 121 and NOT the current one after changing IT121.

WHEN '0121'.

CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn

EXPORTING

prelp = innnn

IMPORTING

pnnnn = i0121.

IF i0121 IS NOT INITIAL.

SELECT * FROM pa0121 INTO TABLE wa_pa0121 WHERE pernr = i0121-pernr.

ENDIF.

LOOP AT wa_pa0121.

IF wa_pa0121-endda EQ '99991231'.

lv_hpern = wa_pa0121-hpern.

ENDIF.

ENDLOOP.

SELECT SINGLE plans FROM pa0001 INTO lv_plans WHERE pernr EQ lv_hpern AND endda = '99991231'.

IF lv_plans EQ '99999999'.

CLEAR : lv_hpern.

ELSE.

prim_pernr = lv_hpern.

prim_pos = lv_plans.

CONDENSE prim_pernr. CONDENSE prim_pos.

CONCATENATE 'MANAGE09~' prim_pernr '' prim_pos INTO wa_string.

APPEND wa_string TO it_string.

ENDIF.

lv_target = 'D:/secondary_ack_exit.txt'.

  • CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp

  • EXPORTING

  • pnnnn = i0121

  • IMPORTING

  • prelp = innnn.

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

filename = lv_target

filetype = 'ASC'

append = 'X'

write_field_separator = 'X'

CHANGING

data_tab = it_string

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

not_supported_by_gui = 22

error_no_gui = 23

OTHERS = 24.

  • CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp

  • EXPORTING

  • pnnnn = i0121

  • IMPORTING

  • prelp = innnn.

PLEASE ASSIST.

Edited by: Ajay84 on Apr 20, 2011 12:25 PM

1 REPLY 1

Former Member
0 Kudos

Hi

You can write code in the implementation of BADI HRPAD00INFTY (in IN_UPDATE method), there you can get the new and old values in NEW_IMAGE and OLD_IMAGE.

~~~Ganesh Kumar K.