on 02-02-2005 12:12 AM
Hi,
I am new in ABAP and would appreciate help with sample code on how I can add employee address record into SAP HR. I know there is a method called EmployeePrivateAddrUS.Creat but I don't have a clue how I can use it or whether there is a better way to add record .
Thank you in advance,
Sunny
Hello Anand,
Thank you for your help. I have another related question. I need to add all the information for a new employee. It appears this method to create only the address information for an employee. Is there a different BAPI I must use to first add a new employee?
I appreciate your help.
Sunny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sunny,
Yes, there is a Business Object for Employee Address - EmployeePrivateAdrUS. And there's a method for this object called Create. The employee address data in maintained in the Infotype 0006.
In SAP this method is implemented by a special kind of Function Module, called BAPI. In this case, the BAPI you would have to use is BAPI_ADDRESSEMPUS_CREATE. Please read the documentation for this BAPI carefully before you go ahead with it.
Here's the code sample of how this BAPI is called :-
* define the structure which is to contain the
* employee's address data
tables bapip0006.
* Fill the vaious fields of this structure as appropriate.
* But the first three fiedls , PERNR , BEGDA and ENDDA are mandatory.
* Define the structure for capturing the error messages
* from the BAPI, if any.
data return type bapireturn1.
CALL FUNCTION 'BAPI_ADDRESSEMPUS_CREATE'
EXPORTING
employeenumber = bapip0006-pernr
validitybegin = bapip0006-begda
validityend = bapip0006-endda
addresstype = bapip0006-anssa
coname = bapip0006-name2
streetandhouseno = bapip0006-stras
scndaddressline = bapip0006-locat
city = bapip0006-ort01
district = bapip0006-ort02
postalcodecity = bapip0006-pstlz
state = bapip0006-state
country = bapip0006-land1
telephonenumber = bapip0006-telnr
commtype1 = bapip0006-com01
commnumber1 = bapip0006-num01
commtype2 = bapip0006-com02
commnumber2 = bapip0006-num02
commtype3 = bapip0006-com03
commnumber3 = bapip0006-num03
commtype4 = bapip0006-com04
commnumber4 = bapip0006-num04
COMMTYPE5 = bapip0006-com05
COMMNUMBER5 = bapip0006-num05
COMMTYPE6 = bapip0006-com06
COMMNUMBER6 = bapip0006-num06
nocommit = nocommit
IMPORTING
return = return.
if not ( return is initial ).
* there were some messages sent back by the BAPI
* appropritae processing to be done here....
endif.
Before you call the above BAPI, you need to Enqueue the Employee Record and after you call it, you will have to Dequeue the same. For more information, refer to the BAPI's documentation.
Regards,
Anand Mandalika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.