Question re: BAPI to add employee address (PA0006) records
Good day, everyone.
I am writing an ABAP program to load legacy address information into SAP (infotype 0006). I'll be reading in text files of legacy address data to do this.
I was looking for a function or BAPI to assist in adding employee address records, and I came across BAPI_ADDRESSEMP_CREATE. Aside from needing to call BAPI_EMPLOYEE_ENQUEUE before and BAPI_EMPLOYEE_DEQUEUE after, I think this is the BAPI I need to use.
Here's the quirk: We've added a few custom fields to infotype 0006. Obviously, the BAPI as is will not populate these new fields.
1. Is this the best method available to add address records, or is there a better BAPI or function out there that I might've missed that you'd recommend over BAPI_ADDRESSEMP_CREATE?
2. I've heard of making "z-versions" of SAP components; in my case, do I need to create a "z-version" of BAPI_ADDRESSEMP_CREATE and add code to populate the new custom fields? Is there anything else I need to be aware of when I do this?
Thanks so much! As always, points awarded to all helpful answers!
Luciano Bentivegna replied
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
infty = p2006-infty
number = pernr-pernr
subtype = p2006-subty
validityend = p2006-endda
validitybegin = p2006-begda
record = p2006
operation = 'MOD' " 'INS' 'DEL'
nocommit = 'X'
return = l_return
key = l_key.