SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

BAPI_PERSDATA_CHANGE



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Sep 22, 2007 4:24 pm    Post subject: BAPI_PERSDATA_CHANGE Reply with quote

Code:
*&---------------------------------------------------------------------*
*& Report Z_HR_PersonData_Modify *
*& *
*&---------------------------------------------------------------------*

REPORT z_hr_persondata_modify MESSAGE-ID zm_hp01
LINE-SIZE 132
LINE-COUNT 65
NO STANDARD PAGE HEADING.

*------------------------<< Data Define >>-----------------------------*
*-< Table >
TABLES: pa0000, "HR Master Record: Infotype 0000 (Actions)
pa0001, "HR Master Record: Infotype 0001 (Actions)
pa0002, "HR Master Record: Infotype 0002 (Actions)
pa0003. "HR Master Record: Infotype 0003 (Actions)

*-< BAPI Related Tables >
TABLES:
bapip0002l,
bapireturn1. "Return Parameter

*-< Internal Table >
*& Internal Table For Getting Employee Personal Data - Begin
DATA: BEGIN OF itab_bapip0002l OCCURS 0.
INCLUDE STRUCTURE bapip0002l.
DATA: END OF itab_bapip0002l,
wk_bapip0002l_lines TYPE I.

*& Return Messages
DATA: BEGIN OF itab_return1 OCCURS 0.
INCLUDE STRUCTURE bapireturn1.
DATA: END OF itab_return1,
wk_itab_return1_lines TYPE I.
*& Internal Table For Getting Employee Personal Data - End

*-< Parameters And Selection Screen >
SELECTION-SCREEN BEGIN OF BLOCK blk0 WITH FRAME TITLE text-001.
PARAMETERS: p_pernr LIKE pa0003-pernr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk0.

*-------------------------<< Main Program >>---------------------------*
*-< Start-of-Selection >
START-OF-SELECTION.
PERFORM bapi_read_person_data.
PERFORM bapi_modify_person_data.
*&---------------------------------------------------------------------*
*& Form bapi_read_person_data
*&---------------------------------------------------------------------*
* Read Employee Personal Data: BAPI_PERSDATA_GETDETAILEDLIST
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM bapi_read_person_data .
CLEAR: itab_return1, itab_bapip0002l.
REFRESH: itab_return1, itab_bapip0002l.

CALL FUNCTION 'BAPI_PERSDATA_GETDETAILEDLIST'
EXPORTING
EMPLOYEENUMBER = p_pernr
* TIMEINTERVALLOW = '18000101'
* TIMEINTERVALHIGH = '99991231'
IMPORTING
RETURN = itab_return1
TABLES
PERSONALDATA = itab_bapip0002l.

DESCRIBE TABLE itab_bapip0002l LINES wk_bapip0002l_lines.

IF wk_bapip0002l_lines < 1.
MESSAGE s001.
STOP.
ENDIF.

ENDFORM. " bapi_read_person_data
*&---------------------------------------------------------------------*
*& Form bapi_modify_person_data
*&---------------------------------------------------------------------*
* Modify Employee Personal Data: BAPI_PERSDATA_CHANGE
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM bapi_modify_person_data .
CLEAR: itab_return1.
REFRESH: itab_return1.

LOOP AT itab_bapip0002l.

CALL FUNCTION 'BAPI_PERSDATA_CHANGE'
EXPORTING
EMPLOYEENUMBER = itab_bapip0002l-employeeno
SUBTYPE = itab_bapip0002l-subtype
OBJECTID = itab_bapip0002l-objectid
LOCKINDICATOR = itab_bapip0002l-lockindic
VALIDITYBEGIN = itab_bapip0002l-validbegin
VALIDITYEND = itab_bapip0002l-validend
RECORDNUMBER = itab_bapip0002l-recordnr
FORMOFADDRESS = itab_bapip0002l-formofaddress
FIRSTNAME = 'TestFirstName'
LASTNAME = 'LName'
NAMEATBIRTH = itab_bapip0002l-NAMEATBIRTH
SECONDNAME = itab_bapip0002l-SECONDNAME
MIDDLENAME = itab_bapip0002l-MIDDLENAME
FULLNAME = itab_bapip0002l-FULLNAME
KNOWNAS = itab_bapip0002l-KNOWNAS
ACADEMICGRADE = itab_bapip0002l-ACADEMICGRADE
SECONDACADGRADE = itab_bapip0002l-SECONDACADGRADE
ARISTROCRATICTITLE = itab_bapip0002l-ARISTROCRATICTITLE
SURNAMEPREFIX = itab_bapip0002l-SURNAMEPREFIX
SECONDNAMEPREFIX = itab_bapip0002l-SECONDNAMEPREFIX
INITIALS = itab_bapip0002l-INITIALS
GENDER = itab_bapip0002l-GENDER
DATEOFBIRTH = itab_bapip0002l-DATEOFBIRTH
* UPDATE_ONLY_GBDAT = itab_bapip0002l-UPDATE_ONLY_GBDAT
BIRTHPLACE = itab_bapip0002l-BIRTHPLACE
STATEOFBIRTH = itab_bapip0002l-STATEOFBIRTH
COUNTRYOFBIRTH = itab_bapip0002l-COUNTRYOFBIRTH
MARITALSTATUS = itab_bapip0002l-MARITALSTATUS
MARITALSTATUSSINCE = itab_bapip0002l-MARITALSTATUSSINCE
NUMBEROFCHILDREN = itab_bapip0002l-NUMBEROFCHILDREN
RELIGION = itab_bapip0002l-RELIGION
LANGUAGE = itab_bapip0002l-LANGUAGE
LANGUAGE_ISO = itab_bapip0002l-LANGUAGE_ISO
NATIONALITY = itab_bapip0002l-NATIONALITY
SECONDNATIONALITY = itab_bapip0002l-SECONDNATIONALITY
THIRDNATIONALITY = itab_bapip0002l-THIRDNATIONALITY
IDNUMBER = itab_bapip0002l-IDNUMBER
* NOCOMMIT = itab_bapip0002l-NOCOMMIT
NAME_FORMAT_INDICATOR = itab_bapip0002l-NAME_FORMAT_INDICATOR
IMPORTING
RETURN = itab_return1.

ENDLOOP.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.


DESCRIBE TABLE itab_return1 LINES wk_itab_return1_lines.

IF wk_itab_return1_lines = 0.
MESSAGE s000 WITH 'Modify Error'.
STOP.
ELSE.
MESSAGE s000 WITH 'Modify Succ'.
STOP.
ENDIF.

ENDFORM. " bapi_modify_person_data

PS: Need locked the entry first.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.