cancel
Showing results for 
Search instead for 
Did you mean: 

How to modify HR Personal Data with BAPI_PERSDATA_CHANGE

Former Member
0 Kudos

I have started working with BAPIs using JCo and Java. I've encountered a problem which has left me without an answer.

With BAPIs like BAPI_PERSDATA_CHANGE to modify HR Personal Data( and also BAPI_ADDRESSEMP_CHANGE to modify HR Address Data ) , there are required fields that must be passed into the Import Parameters.

The problem is that some of these fields are empty/blank, like the Subtype & OBJECTID & LOCKINDICATOR, for example. Within the Source codes, I have attempted to pass in "null," empty Strings, empty Object, and the corresponding value from Get BAPIs. (Like BAPI_EMPLOYEE_GETDATA for BAPI_PERSDATA_CHANGE Subtype fields.) All to no avail.

I am commonly returned the message: "Make an entry in all required fields." Though I have managed, previously, to get No Data for the selected fields (when I have verified that data does exist) and similar messages. If I filled some values in the import parameters, the BAPI returned the message: "No data stored for 0002 in the selected period".

How do I approach changing data? Or specific to BAPI_PERSDATA_CHANGE, how can I make it work? Please advise.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

It's my first question, thanks for you help!

The test Source Code:

data:v_UMBER LIKE BAPIP0002-PERNR,

v_SUBTYPE LIKE BAPIP0002-SUBTY,

v_OBJECTID LIKE BAPIP0002-OBJPS,

v_LOCK LIKE BAPIP0002-SPRPS,

v_VALID LIKE BAPIP0002-BEGDA,

v_TYEND LIKE BAPIP0002-ENDDA,

v_RECOR LIKE BAPIP0002-SEQNR,

v_NAME1 LIKE BAPIP0002-VORNA,

v_NAME2 LIKE BAPIP0002-NACHN,

it_return like BAPIRETURN1 occurs 0 with header line.

select single PERNR SUBTY OBJPS SPRPS

BEGDA ENDDA SEQNR

into (v_UMBER,v_SUBTYPE,v_OBJECTID,

v_LOCK,v_VALID, v_TYEND,v_RECOR)

from PA0002

where PERNR = '00000003'.

v_NAME1 = 'TestLastName'. v_NAME2 = 'TestFirsName'.

CALL FUNCTION 'BAPI_PERSDATA_CHANGE'

EXPORTING

EMPLOYEENUMBER = v_UMBER

SUBTYPE = v_SUBTYPE

OBJECTID = v_OBJECTID

LOCKINDICATOR = v_LOCK

VALIDITYBEGIN = v_VALID

VALIDITYEND = v_TYEND

RECORDNUMBER = v_RECOR

  • FORMOFADDRESS =

FIRSTNAME = v_NAME1

LASTNAME = v_NAME2

IMPORTING

RETURN = it_return.

But it does not work.

Former Member
0 Kudos

Help me, pls

Thanks

Former Member
0 Kudos

Try this CODE... but BEGDA will not be changed so it will not be synchronized with the GBDAT... if particular on BEGDA = GBDAT use BDC instead

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = <pernr here>

.

SELECT SINGLE * FROM pa0002 WHERE pernr EQ <pernr here>.

CALL FUNCTION 'BAPI_PERSDATA_CHANGE'

EXPORTING

employeenumber = pa0002-pernr

subtype = pa0002-subty

objectid = pa0002-objps

lockindicator = pa0002-sprps

validitybegin = pa0002-begda

validityend = pa0002-endda

recordnumber = 000

firstname = pa0002-vorna

lastname = pa0002-nachn

dateofbirth = pa0002-gbdat

idnumber = pa0002-perid

IMPORTING

return = return

.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = <pernr here>.