09-10-2008 12:48 PM
hi all,
May i also know what are record and operation fields in HR_INFOTYPE_OPERATION and what should be given opposite to it.
thanks,
09-10-2008 12:54 PM
09-10-2008 1:04 PM
Record is the actual record u are trying to update with..
Operation is either, Insert(INS), Update(MOD) or Delete(DEL)..
for example,, if i want to update a Infotype 8 record.. i give:
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = p_pskey-infty
number = p_pskey-pernr
subtype = p_pskey-subty
objectid = p_pskey-objps
lockindicator = p_pskey-sprps
validityend = p_pskey-endda
validitybegin = p_pskey-begda
recordnumber = p_pskey-seqnr
record = p_nnnn
operation = 'MOD'
nocommit = 'X'
IMPORTING
return = wa_return
key = wa_record_key.
where p_nnnn can be of type pskey.
before all these,, declare the Infotype on the Top
Infotype: 0008.
and assign p0008-infty,p0008-begda and so on..
Award Points if Useful!
09-10-2008 1:07 PM
Hi,
In Record field you have to pass the work area.
And in operation field you have to pass the operation type, i.e MOD, DEL, if you want to modify the or delete the Infotype.
Check this sample code for Inserting into Infotype
tables
pa0001.
parameters:
p_number type pa0001-pernr.
data:
fs_p0002 like p0002,
fs_pa0002 like pa0002,
wa_p0002 like p0002,
t_pa0002 like standard table of p0002.
data:lfs_return type bapireturn1.
select *
from pa0002
into fs_pa0002
where pernr = p_number.
endselect.
move-corresponding fs_pa0002 to fs_p0002.
*fs_p0002-pernr = '0000045'.
fs_p0002-inits = 'MR'.
fs_p0002-nachn ='Pal'.
fs_p0002-name2 = 'VKHUDUFB'.
fs_p0002-vorna ='Sujit'.
*fs_p0002-gbdat = '19831117'.
*fs_p0002-infty = '0002'.
fs_p0002-begda = '20090926'.
*fs_p0002-begda = '99991231'.
call function 'ENQUEUE_EPPRELE'
exporting
mode_prel = 'E'
* MANDT = SY-MANDT
pernr = p_number
infty = '0002'
* SUBTY =
* OBJPS =
* SPRPS =
* ENDDA = '99991231'
* BEGDA = '19611016'
* SEQNR =
* X_PERNR = ' '
* X_INFTY = ' '
* X_SUBTY = ' '
* X_OBJPS = ' '
* X_SPRPS = ' '
* X_ENDDA = ' '
* X_BEGDA = ' '
* X_SEQNR = ' '
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = ' '
exceptions
foreign_lock = 1
system_failure = 2
others = 3
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'HR_INFOTYPE_OPERATION'
exporting
infty = '0002'
number = p_number
* SUBTYPE =
* OBJECTID =
* LOCKINDICATOR =
* VALIDITYEND = '99991231'
* VALIDITYBEGIN = '20080624'
* RECORDNUMBER =
record = fs_p0002 <--------Check here
operation = 'INS' <--------check here
* TCLAS = 'A'
* DIALOG_MODE = '0'
* NOCOMMIT =
* VIEW_IDENTIFIER =
* SECONDARY_RECORD =
importing
return = lfs_return
* KEY =
.
call function 'DEQUEUE_EPPRELE'
exporting
* MODE_PREL = 'E'
* MANDT = SY-MANDT
pernr = p_number
infty = '0002'
* SUBTY =
* OBJPS =
* SPRPS =
* ENDDA =
* BEGDA =
* SEQNR =
* X_PERNR = ' '
* X_INFTY = ' '
* X_SUBTY = ' '
* X_OBJPS = ' '
* X_SPRPS = ' '
* X_ENDDA = ' '
* X_BEGDA = ' '
* X_SEQNR = ' '
* _SCOPE = '3'
* _SYNCHRON = ' '
* _COLLECT = ' '
.
**
**CALL FUNCTION 'HR_READ_INFOTYPE'
** EXPORTING
*** TCLAS = 'A'
** pernr = p_number
** infty = '0002'
*** BEGDA = '18000101'
*** ENDDA = '99991231'
*** BYPASS_BUFFER = ' '
*** IMPORTING
*** SUBRC =
** tables
** infty_tab = t_pa0002
*** EXCEPTIONS
*** INFTY_NOT_FOUND = 1
*** OTHERS = 2
** .
**IF sy-subrc <> 0.
*** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
**sort t_pa0002 by pernr begda descending.
**ENDIF.
**
**
**Loop at t_pa0002 into wa_p0002.
**Write:/
** fs_pa0002-pernr,
** fs_pa0002-vorna,
** fs_pa0002-nachn,
** fs_pa0002-gbdat.
**Endloop.
*"-------------------------------------------------------------------"*
*End of Program.
*"-------------------------------------------------------------------"*
Regards,
Sujit
09-10-2008 1:15 PM
>
> In Record field you have to pass the Pernr parameter.
Wrong answer.. you would pass the Infotype record (on which the OPERATION needs to be performed) to the RECORD parameter.
~Suresh
09-10-2008 1:11 PM
different operations are
COP Copy
DEL Delete
DIS Display
EDQ Lock/unlock
INS Create
LIS9 Delimit
MOD Change
INSS Create for Actions is not converted to Change
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0002'
NUMBER = EMPNO
SUBTYPE = P0002-SUBTY
OBJECTID = P0002-OBJPS
LOCKINDICATOR = P0002-SPRPS
VALIDITYEND = P0002-ENDDA
VALIDITYBEGIN = P0002-BEGDA
RECORDNUMBER = P0002-SEQNR
RECORD = P0002
OPERATION = 'EDQ'
TCLAS = 'A'
DIALOG_MODE = '0'
IMPORTING
RETURN = RETURN
~hitesh
close this thread once your query is solved