Wednesday, December 29, 2010

Function Module HR_INFOTYPE_OPERATION 

This function module enables you to maintain master data for employees. You can transfer one data record. All validation checks take place that would take place in the individual maintenance screens in the dialog.

Infotype Operation Types: 

This operation defines which editing mode should be used to process the infotype in an action.
Operation
Description
COP
Copy
DEL
Delete
DIS
Display
EDQ
Lock/unlock
INS
Create
LIS9
Delimit
MOD
Change
INSS
Create for Actions is not converted to Change

Insert Infotype Record 

When you create infotype records while processing actions, the system checks if an infotype with the same subtype already exists. If it does, the system switches from "Create" to "Change". It only makes sense to use the Create (INS) operation for the initial entry action.

REPORT  ztest_notepad .
DATA:p0015  TYPE p0015.
DATA:return LIKE  bapireturn1.
 
p0015-pernr = '00909089'.
p0015-subty = '1500'.
p0015-endda = '99991231'.
p0015-begda = sy-datum.
p0015-lgart = '1500'.
p0015-betrg = '100.00'.
 
CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
  EXPORTING
    number = '00909089'.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING
    infty         = '0015'
    number        = '00909089'
    subtype       = '1500'
    validityend   = '99991231'
    validitybegin = sy-datum
    record        = p0015
    operation     = 'INS'
    tclas         = 'A'
  IMPORTING
    return        = return.
WRITE return.
 
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
  EXPORTING
    number = '00909089'.

Modify Infotype Record

Read existing record before you modify record. Use operation MOD.
  call function 'HR_INFOTYPE_GETDETAIL'
       exporting
            infty         = '0006'
            number        = employeenumber
            subtype       = subtype
            objectid      = objectid
            lockindicator = lockindicator
            validityend   = validityend
            validitybegin = validitybegin
            recordnumber  = recordnumber
            tclas         = 'A'
       importing
            return        = return
            record        = p0006
       exceptions
            others        = 0.
  if not return is initial.
    exit.
  endif.
 
  p0006-pernr = employeenumber.
  p0006-subty = subtype.
  p0006-infty = '0006'.
  p0006-objps = objectid.
  p0006-sprps = lockindicator.
  p0006-begda = validitybegin.
  p0006-endda = validityend.
  p0006-seqnr = recordnumber.
  p0006-anssa = subtype.
  p0006-name2 = coname.
  p0006-stras = streetandhouseno.
  p0006-ort01 = city.
  p0006-ort02 = district.
  p0006-pstlz = postalcodecity.
  p0006-state = state.
  p0006-land1 = country.
  p0006-telnr = telephonenumber.
  p0006-entkm = distanceinkm.
  p0006-entk2  = distanceinkm1.
  p0006-wkwng  = companyownedapt.
  p0006-busrt  = busroute.
  p0006-com01 = commtype1.
  p0006-num01 = commnumber1.
  p0006-com02 = commtype2.
  p0006-num02 = commnumber2.
  p0006-com03 = commtype3.
  p0006-num03 = commnumber3.
 
  call function 'HR_INFOTYPE_OPERATION'
       exporting
            infty          = '0006'
            number         = employeenumber
            subtype        = subtype
            objectid       = objectid
            lockindicator  = lockindicator
            validityend    = validityend
            validitybegin  = validitybegin
            recordnumber   = recordnumber
            record         = p0006
            operation      = 'MOD'
            nocommit       = space
       importing
            return         = return
       exceptions
            others         = 0.
 

1 comment:

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.