Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to Use BAPI_HRMASTER_SAVE_REPL_MULT. Thanks

Dear all,

Do you know how to update an employee's organization and postion using bapi 'BAPI_HRMASTER_SAVE_REPL_MULT'.

First, I get the Organizaiton Data By BAPI 'BAPI_EMPLOYEE_GETDATA'

Then I transfer them to the BAPI 'BAPI_HRMASTER_SAVE_REPL_MULT'

But, After commit, The Data in Table PA0001 has no change

Why? Thanks for you help ahead.

Below is my test program.

==============================================

REPORT z_hr_persondata_modify_03 MESSAGE-ID zm01

LINE-SIZE 132

LINE-COUNT 65

NO STANDARD PAGE HEADING.

*-< Header for an HR Object (Master Data or Organizational Data)

DATA: it_bapihrobj

LIKE BAPIHROBJ OCCURS 0 WITH HEADER LINE.

*-< HR: Transported Infotypes and Subtypes for an Object

DATA: it_bapihrinf

LIKE BAPIHRINF OCCURS 0 WITH HEADER LINE.

*-< HR Master Record: Infotype 0001 (Org. Assignment)

DATA: it_bapip0001b

LIKE BAPIP0001B OCCURS 0 WITH HEADER LINE.

*-< HR: HR Master Record Infotype 0001 (Org. Assignment)

DATA: it_bapihr0001

LIKE BAPIHR0001 OCCURS 0 WITH HEADER LINE.

*-< Return Parameter

DATA: it_return

LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

Refresh it_return.

CALL FUNCTION 'BAPI_EMPLOYEE_GETDATA'

EXPORTING

EMPLOYEE_ID = '00001732'

TABLES

ORG_ASSIGNMENT = it_bapip0001b.

REFRESH it_bapihrobj. CLEAR it_bapihrobj.

REFRESH it_bapihrinf. CLEAR it_bapihrinf.

REFRESH it_bapihr0001. CLEAR it_bapihr0001.

LOOP AT it_bapip0001b.

*-< Append Data to it_bapihrobj

it_bapihrobj-PLAN_VER = '01'.

it_bapihrobj-OBJ_TYPE = 'P '.

it_bapihrobj-OBJ_ID = it_bapip0001b-PERNO.

it_bapihrobj-PROOF = 'X'.

it_bapihrobj-OPERATOR = 'U'.

APPEND it_bapihrobj.

*-< Append Data to it_bapihrinf

it_bapihrinf-PLAN_VER = '01'.

it_bapihrinf-OBJ_TYPE = 'P '.

it_bapihrinf-OBJ_ID = it_bapip0001b-PERNO.

it_bapihrinf-INFOTYPE = it_bapip0001b-INFOTYPE.

it_bapihrinf-SUBTYPE = it_bapip0001b-SUBTYPE.

it_bapihrinf-FROM_DATE = '19980205'.

it_bapihrinf-TO_DATE = '99991231'.

APPEND it_bapihrinf.

*-< Append Data to it_bapihr0001

it_bapihr0001-OBJ_ID = it_bapip0001b-PERNO.

it_bapihr0001-INFOTYPE = it_bapip0001b-INFOTYPE.

it_bapihr0001-SUBTYPE = it_bapip0001b-SUBTYPE.

it_bapihr0001-OBJECT_IDENTIFICATION = it_bapip0001b-OBJECT_ID.

it_bapihr0001-LOCKINDIC = it_bapip0001b-LOCK_IND.

it_bapihr0001-TO_DATE = it_bapip0001b-TO_DATE.

it_bapihr0001-FROM_DATE = it_bapip0001b-FROM_DATE.

it_bapihr0001-IT_REC_NO = it_bapip0001b-SEQNO.

it_bapihr0001-CHANGED_ON = it_bapip0001b-CH_ON.

it_bapihr0001-CHANGED_BY = it_bapip0001b-CHANGED_BY.

  • it_bapihr0001-CHANGED_BY = 'LiangLiang'.

it_bapihr0001-HIST_FLAG = it_bapip0001b-HIST_FLAG.

it_bapihr0001-INFOTYPE_TEXT_EXISTS = it_bapip0001b-TEXTFLAG.

it_bapihr0001-REFERENCE_FILEDS_EXIST = it_bapip0001b-REF_FLAG.

it_bapihr0001-CONFIRMATION_FIELDS_EXIST = it_bapip0001b-CNFRM_FLAG.

it_bapihr0001-INFOTYPE_SCREEN_CONTROL = it_bapip0001b-SCREENCTRL.

it_bapihr0001-REASON_TO_CHANGE_MASTER_DATA = it_bapip0001b-REASON.

it_bapihr0001-FLAG_1 = it_bapip0001b-FLAG1.

it_bapihr0001-FLAG_2 = it_bapip0001b-FLAG2.

it_bapihr0001-FLAG_3 = it_bapip0001b-FLAG3.

it_bapihr0001-FLAG_4 = it_bapip0001b-FLAG4.

it_bapihr0001-RESERVED_FIELD_1 = it_bapip0001b-RESERVED1.

it_bapihr0001-RESERVED_FIELD_2 = it_bapip0001b-RESERVED2.

it_bapihr0001-COMP_CODE = it_bapip0001b-COMP_CODE.

it_bapihr0001-PERS_AREA = it_bapip0001b-PERS_AREA.

it_bapihr0001-EMPLOYEE_GROUP = it_bapip0001b-EGROUP.

it_bapihr0001-EMPLOYEE_SUBGROUP = it_bapip0001b-ESUBGROUP.

it_bapihr0001-ORGANIZATIONAL_KEY = it_bapip0001b-ORG_KEY.

it_bapihr0001-BUSINESS_AREA = it_bapip0001b-BUS_AREA.

it_bapihr0001-PERSONNEL_SUBAREA = it_bapip0001b-P_SUBAREA.

it_bapihr0001-LEGAL_PERSON = it_bapip0001b-LEG_PERSON.

it_bapihr0001-PAYROLL_AREA = it_bapip0001b-PAYAREA.

it_bapihr0001-EMPLOYMENT_CONTRACT = it_bapip0001b-CONTRACT.

it_bapihr0001-COSTCENTER = it_bapip0001b-COSTCENTER.

  • it_bapihr0001-ORG_UNIT = it_bapip0001b-ORG_UNIT.

it_bapihr0001-ORG_UNIT = '50020339'.

it_bapihr0001-POSITION = it_bapip0001b-POSITION.

it_bapihr0001-JOB = it_bapip0001b-JOB.

it_bapihr0001-SUPERVISOR_AREA = it_bapip0001b-SUPERVISOR.

it_bapihr0001-PAYROLL_ADMINISTRATOR = it_bapip0001b-PAYR_ADMIN.

it_bapihr0001-MASTER_DATA_ADMINISTRATOR = it_bapip0001b-PERS_ADMIN.

it_bapihr0001-TIME_ADMINISTRATOR = it_bapip0001b-TIME_ADMIN.

it_bapihr0001-SORT_NAME = it_bapip0001b-SORT_NAME.

it_bapihr0001-FORMATTED_NAME = it_bapip0001b-NAME.

it_bapihr0001-OBJ_TYPE = it_bapip0001b-OBJECTTYPE.

it_bapihr0001-ADMINISTRATOR_GROUP = it_bapip0001b-ADMINGROUP.

it_bapihr0001-CO_AREA = it_bapip0001b-CO_AREA.

it_bapihr0001-FUNDS_CTR = it_bapip0001b-FUNDS_CTR.

it_bapihr0001-FUND = it_bapip0001b-FUND.

  • it_bapihr0001- = it_bapip0001b-ORGTXT

  • it_bapihr0001- = it_bapip0001b-JOBTXT

  • it_bapihr0001- = it_bapip0001b-POSTXT

  • it_bapihr0001- = it_bapip0001b-FKBER

  • it_bapihr0001- = it_bapip0001b-GRANT_NBR

APPEND it_bapihr0001.

ENDLOOP.

CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'

EXPORTING

NUMBER = '00001732'.

REFRESH it_return. CLEAR it_return.

CALL FUNCTION 'BAPI_HRMASTER_SAVE_REPL_MULT'

TABLES

HR_OBJECT_HEADER = it_bapihrobj

HR_INFOTYPE_HEADER = it_bapihrinf

  • EMPLOYEE_PERSONNEL_ACTION =

EMPLOYEE_ORG_ASSIGNMENT = it_bapihr0001

RETURN = it_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'

EXPORTING

NUMBER = '00001732'.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question