cancel
Showing results for 
Search instead for 
Did you mean: 

Question re: BAPI to add employee address (PA0006) records

former_member210148
Participant
0 Kudos

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!

Accepted Solutions (1)

Accepted Solutions (1)

LucianoBentiveg
Active Contributor
0 Kudos

Try with:

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = p2006-infty

number = pernr-pernr

subtype = p2006-subty

validityend = p2006-endda

validitybegin = p2006-begda

record = p2006

operation = 'MOD' " 'INS' 'DEL'

nocommit = 'X'

IMPORTING

return = l_return

key = l_key.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hey Dave,

I suggest you to go with the 2nd approach..

U can create a "ZBAPI..." and copy paste the code from the standard BAPI..

U can then add the custom code to populate data in the Ztables n Zfields..

Reason:

If u r using the first approach and if there is a COMMIT in the standard BAPi, the first part gets stored.. now if there is a problem in populating Zfields, u would want to roll back.. but that would b dificult in case u have run a batch program for 1000s of records..

Its better to go with ur 2nd approach and COMMIT all together..

So, "U get all or u get nothin"..(Atomicity)

Regards,

Tanveer.

Please mark helpful answers

suresh_datti
Active Contributor
0 Kudos

Hi Dave,

You are on the right track.. Just copy the bapi BAPI_ADDRESSEMP_CREATE & add your custom fields.. that should work.. as far as I know there is nothing else that meeds to be done..

Regards,

Suresh Datti