Skip to Content
author's profile photo Former Member
Former Member

Adding/Creating new records


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,


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 02, 2005 at 07:40 PM

    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.


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 02, 2005 at 04:31 AM

    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.
                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
                return           = return.
      if not ( return is initial ).
    *   there were some messages sent back by the BAPI
    *   appropritae processing to be done here....

    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.


    Anand Mandalika.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.