Problem solve Get help with specific problems with your technologies, process and projects.

Using FM's to create, change and delete HR Infotypes

SAP makes maintance of HR infotypes very simple by using three FUNCTION MODULES.

SAP makes maintance of HR infotypes very simple by using three FUNCTION MODULES. The following operations are allowed,...

change (operation = 'MOD'), Create (operation ='INS'), DELETE (operation = 'DEL') and CREATESUCCESSOR (operation = 'COP').


* Updating IT0315.
* Create a new IT0315 with an activity type = '8888'.
* Use 'BAPI_EMPLOYEE_ENQUEUE' to lock the employee before updating
DATA: w_bapireturn LIKE bapireturn1.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
     EXPORTING
          number = p0315-pernr
     IMPORTING
          return = w_bapireturn.

IF w_bapireturn-id <> space.
  WRITE: / p0315-pernr, 'Enqueue failed'.
ENDIF.

  DATA: w_bapireturn LIKE bapireturn1.

  DATA: w_bapipakey LIKE bapipakey OCCURS 0 WITH HEADER LINE.

  p0315-lstar = '8888'.

  CALL FUNCTION 'HR_INFOTYPE_OPERATION'
       EXPORTING
            infty         = '0315'
            number        = p0315-pernr
            record        = p0315
            validitybegin = '20021001'
            validityend   = '99991231'
            operation     = 'INS'    
*           dialog_mode   = '0'  "Use default
*           nocommit      = '1'  "Use default unless rollback is possible
       IMPORTING
            return        = w_bapireturn
            key           = w_bapipakey.

  IF w_bapireturn-id <> space.
    WRITE: /   p0315-pernr,
            20 'Create was unsuccessful',
                w_bapireturn-id,
                w_bapireturn-message+0(40).
 ELSE.
    WRITE: /   p0315-pernr,
            20 'Create was successful',
                w_bapireturn-id,
                w_bapireturn-message+0(40).
ENDIF.


* Use 'BAPI_EMPLOYEE_DEQUEUE' to un-lock the employee before updating
  DATA: w_bapireturn LIKE bapireturn1.

  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
       EXPORTING
            number = p0315-pernr
       IMPORTING
            return = w_bapireturn.

This was last published in October 2002

Dig Deeper on SAP Basis administration and NetWeaver administration

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.

Where are the delete and modify instructions?? And which is the difference..
Cancel

-ADS BY GOOGLE

SearchERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchHRSoftware

Close