Skip to Content
0
Former Member
Jul 31, 2011 at 07:27 PM

HR INFOTYPE OPERATION for infotype 2003

843 Views

Hello,

I am using FM' HR INFOTYPE OPERATION ' to create new infotype 2003.

I tried to fill all the required field,but it does not work.

It's my code. Please help me.

*-----------*
*  ENQUEUE  *
*-----------*
  CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
    EXPORTING
      NUMBER = ZPERNR.

  SELECT SINGLE VIEKN INTO Z_VIEKN FROM PA0003 WHERE PERNR = ZPERNR AND ENDDA = '99991231'.
  
*------------*
*  TESTDATA  *
*------------*
    CLEAR W_RECORD.
    W_RECORD-PERNR = ZPERNR.
    W_RECORD-INFTY = '2003'.
    W_RECORD-TPROG = 'WND1'.
    W_RECORD-SUBTY = '01'.
*    W_RECORD-OBJPS = ''.
*    W_RECORD-SPRPS = ''.
    W_RECORD-ENDDA = '20110328'.
    W_RECORD-BEGDA = '20110328'.
*    W_RECORD-SEQNR = ''.
    W_RECORD-VTART = '01'.
    W_RECORD-MOTPR = C_GROUP.
*    W_RECORD-AEDTM = ''.
*    W_RECORD-UNAME = ''.

    APPEND W_RECORD TO P_RECORD.

    CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.
    CALL FUNCTION 'HR_READ_INFOTYPE_AUTHC_DISABLE'.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
      INFTY                     = '2003'
      NUMBER                    = W_RECORD-PERNR
      SUBTYPE                   = W_RECORD-SUBTY
*      OBJECTID                  = W_RECORD-OBJPS
*      LOCKINDICATOR             = W_RECORD-SPRPS
      VALIDITYEND               = '20110328'
      VALIDITYBEGIN             = '20110328'
*      RECORDNUMBER              = W_RECORD-SEQNR
      RECORD                    = P_RECORD
      OPERATION                 = 'INS'
      TCLAS                     = 'A'
      NOCOMMIT                  = ''
      DIALOG_MODE               = '0'
      VIEW_IDENTIFIER           = Z_VIEKN
      SECONDARY_RECORD          = P_RECORD
    IMPORTING
      RETURN                    = RETURN_FM_TEST
      KEY                       = PERSONALDATAKEY.

  COMMIT WORK.

*-----------*
*  DEQUEUE  *
*-----------*
  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
    EXPORTING
      NUMBER = ZPERNR.