Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

FM 'HR_INFOTYPE_OPERATION' problem

Former Member
0 Likes
1,794

Hi experts, I use FM 'HR_INFOTYPE_OPERATION' to change infotype 0002. But it hasn't been changed. Can anyone tell me where is the problem? (In debug all the fields I want to change have currect values) The code as following.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0002'

number = L_PERNR

validityend = LS_PA0002-ENDDA

validitybegin = LS_PA0002-BEGDA

record = LS_PA0002

operation = 'MOD' "MODIFY

nocommit = ''

IMPORTING

return = ls_return

key = ls_key

EXCEPTIONS

OTHERS = 1.

Thanks!

Edited by: wuyia nata on Aug 26, 2008 11:24 AM

Edited by: wuyia nata on Aug 26, 2008 11:25 AM

Edited by: wuyia nata on Aug 26, 2008 11:27 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,562

Hi,

Check this below code

We need to explicitly use the Enqueue and Dequeue FM.

READ TABLE t_res INTO fs_res INDEX 1. " only one record this tabke has. you can also loop the table for N entires.

CALL FUNCTION 'ENQUEUE_EPPRELE'
     EXPORTING
*   MODE_PREL            = 'E'
*   MANDT                = SY-MANDT
       pernr                = fs_res-pernr
       infty                = '0002'
*   SUBTY                =
*   OBJPS                =
*   SPRPS                =
*   ENDDA                =
*   BEGDA                =
*   SEQNR                =
  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.

    IF fs_res-pernr = '00000004'.
      fs_rec = fs_res.
      fs_rec-inits = 'tom'.
      fs_rec-nachn = 'hanks'.
      fs_rec-vorna = 'L'.
    ENDIF.

    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
      EXPORTING
        infty                  = '0002'
        number                 = fs_rec-pernr
*   SUBTYPE                =
*   OBJECTID               =
*   LOCKINDICATOR          =
   validityend            = fs_rec-endda
   validitybegin          = fs_rec-begda
*   RECORDNUMBER           =
        record                 = fs_rec
        operation              = 'MOD'
  IMPORTING
   return                 = fs_return
*   KEY                    =
              .
    APPEND fs_return TO t_return.
    CLEAR fs_return.

    CALL FUNCTION 'DEQUEUE_EPPRELE'
  EXPORTING
*   MODE_PREL       = 'E'
*   MANDT           = SY-MANDT
   pernr           = fs_res-pernr
   infty           = '0002'
*   SUBTY           =
*   OBJPS           =
*   SPRPS           =
*   ENDDA           =
*   BEGDA           =
*   SEQNR           =

.

Regards

Lekha

Hi experts, I use FM 'HR_INFOTYPE_OPERATION' to change infotype 0002. But it hasn't been changed. Can anyone tell me where is the problem? (In debug all the fields I want to change have currect values) The code as following.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0002'

number = L_PERNR

validityend = LS_PA0002-ENDDA

validitybegin = LS_PA0002-BEGDA

record = LS_PA0002

operation = 'MOD' "MODIFY

nocommit = ''

IMPORTING

return = ls_return

key = ls_key

EXCEPTIONS

OTHERS = 1.

Thanks!

Edited by: wuyia nata on Aug 26, 2008 11:24 AM

Edited by: wuyia nata on Aug 26, 2008 11:25 AM

Edited by: wuyia nata on Aug 26, 2008 11:27 AM

11 REPLIES 11
Read only

Former Member
0 Likes
1,563

Hi,

Check this below code

We need to explicitly use the Enqueue and Dequeue FM.

READ TABLE t_res INTO fs_res INDEX 1. " only one record this tabke has. you can also loop the table for N entires.

CALL FUNCTION 'ENQUEUE_EPPRELE'
     EXPORTING
*   MODE_PREL            = 'E'
*   MANDT                = SY-MANDT
       pernr                = fs_res-pernr
       infty                = '0002'
*   SUBTY                =
*   OBJPS                =
*   SPRPS                =
*   ENDDA                =
*   BEGDA                =
*   SEQNR                =
  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.

    IF fs_res-pernr = '00000004'.
      fs_rec = fs_res.
      fs_rec-inits = 'tom'.
      fs_rec-nachn = 'hanks'.
      fs_rec-vorna = 'L'.
    ENDIF.

    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
      EXPORTING
        infty                  = '0002'
        number                 = fs_rec-pernr
*   SUBTYPE                =
*   OBJECTID               =
*   LOCKINDICATOR          =
   validityend            = fs_rec-endda
   validitybegin          = fs_rec-begda
*   RECORDNUMBER           =
        record                 = fs_rec
        operation              = 'MOD'
  IMPORTING
   return                 = fs_return
*   KEY                    =
              .
    APPEND fs_return TO t_return.
    CLEAR fs_return.

    CALL FUNCTION 'DEQUEUE_EPPRELE'
  EXPORTING
*   MODE_PREL       = 'E'
*   MANDT           = SY-MANDT
   pernr           = fs_res-pernr
   infty           = '0002'
*   SUBTY           =
*   OBJPS           =
*   SPRPS           =
*   ENDDA           =
*   BEGDA           =
*   SEQNR           =

.

Regards

Lekha

Read only

Former Member
0 Likes
1,562

HI

check the following

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0002'

number = L_PERNR --> check whether this variable is correct or not

validityend = LS_PA0002-ENDDA

validitybegin = LS_PA0002-BEGDA

record = LS_PA0002 --> check LS_PA0002 is of type p0002

operation = 'MOD' "MODIFY

nocommit = ''

IMPORTING

return = ls_return

key = ls_key

EXCEPTIONS

OTHERS = 1.

regards

padma

Read only

Former Member
0 Likes
1,562

Hi,

When you create the internal table that you are passing in the Function module HR_READ_INFOTYPE then use the

p structure i.e P0002.

And before modifying lock the infotype.

Here is a sample code for your reference-


all function 'ENQUEUE_EPPRELE'
 exporting
   mode_prel            = 'E'
*   MANDT                = SY-MANDT
   pernr                = fs_p0015-pernr
   infty                = '0015'
 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                  = '0015'
    number                 = fs_p0015-pernr
*   SUBTYPE                = fs_p0015-lgart
*   OBJECTID               =
*   LOCKINDICATOR          =
*   VALIDITYEND            = sy-datum
*   VALIDITYBEGIN          = sy-datum
*   RECORDNUMBER           =
    record                 = fs_p0015
    operation              = 'MOD'
*   TCLAS                  = 'A'
*   DIALOG_MODE            = '0'
*   NOCOMMIT               =
*   VIEW_IDENTIFIER        =
*   SECONDARY_RECORD       =
 importing
   return                 = w_return
*   KEY                    =
          .

call function 'DEQUEUE_EPPRELE'
 exporting
*   MODE_PREL       = 'E'
*   MANDT           = SY-MANDT
   pernr           = fs_p0015-pernr
   infty           = '0015'
          .

*endloop.

use those fm for locking and unlocking

Regards,

Sujit

Read only

Former Member
0 Likes
1,562

hi,

Please check the mandatory fields from the transaction and pass the values of the fields in your values.

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
1,562

hi,

as far as i am aware, i think the MOD function of this FM does not work correctly.

i had to use the same functionality once. i used the alternate solution.

first retrieve the details of the record to be updated in a work-area and then delete the record using the same FM and passing operation = DEL. now, we can insert the same record using the FM and passing operation = INS.

before inserting, the data should be modified as required.

you should call FM in following sequence

'BAPI_EMPLOYEE_ENQUEUE'

'HR_INFOTYPE_OPERATION'

'BAPI_EMPLOYEE_DEQUEUE'

Read only

Former Member
0 Likes
1,562

Hi,

Instead of the above FM use 'HR_MAINTAIN_MASTERDATA'.

SAMPLE CODE

CLEAR : w_pvalues.

*---> Fill the pernr

MOVE c_0105 TO w_pvalues-infty.

MOVE c_00 TO w_pvalues-seqnr.

MOVE 'P0105-PERNR' TO w_pvalues-fname.

MOVE rv_pernr TO w_pvalues-fval.

APPEND w_pvalues TO ri_pvalues.

*---> Fill the Begin date

MOVE c_0105 TO w_pvalues-infty.

MOVE c_00 TO w_pvalues-seqnr.

MOVE 'P0105-BEGDA' TO w_pvalues-fname.

MOVE sy-datum TO w_pvalues-fval.

APPEND w_pvalues TO ri_pvalues.

*---> Fill the End date

MOVE c_0105 TO w_pvalues-infty.

MOVE c_00 TO w_pvalues-seqnr.

MOVE 'P0105-ENDDA' TO w_pvalues-fname.

MOVE c_endda TO w_pvalues-fval.

APPEND w_pvalues TO ri_pvalues.

*---> Fill the User ID

MOVE c_0105 TO w_pvalues-infty.

MOVE c_00 TO w_pvalues-seqnr.

MOVE 'P0105-USRID' TO w_pvalues-fname.

MOVE v_enum TO w_pvalues-fval.

APPEND w_pvalues TO ri_pvalues.

*---> This FM is to Initialise the buffer

CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.

*---> This FM is to create the New records of IT0032 and IT0105

CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'

EXPORTING

pernr = rv_pernr

actio = c_ins

tclas = c_a

begda = sy-datum

endda = c_endda

dialog_mode = c_space

luw_mode = c_2

no_existence_check = c_x

no_enqueue = c_x

IMPORTING

return = v_return

TABLES

proposed_values = ri_pvalues.

IF v_return-type EQ c_error_e OR v_return-type EQ c_error_a.

MESSAGE e000 WITH v_return-message.

ENDIF.

Regards,

Satish

Read only

Former Member
0 Likes
1,562

Hi,

Plz check whether it is giving any error msg in the return structure.

Regards,

Aleem.

Read only

Former Member
0 Likes
1,562

Thanks for you all. I've used the FM ''HR_EMPLOYEE_ENQUEUE'' and 'HR_EMPLOYEE_DEQUEUE'.

But it doesn't work either. Actually the 'ls_return' which from importing of FM says '009 no data found in 0002'. That's strange that in debug all the fields necessary have values. How could that happen?

Thanks!

Read only

0 Likes
1,562

hi,

the "LS_PA0002" structure that you are using should be of type P0002 and not of type PA0002.

confirm whether you are using the correct type or not.

Read only

0 Likes
1,562

Yes the structure 'LS_PA0002' is well at the type 'P0002'.

But it always says 'no data exists for 0002'. I don't reach to understand.

Waiting for be answered. Thanks!!

Read only

0 Likes
1,562

hi,

if you are trying to modify any of the key fields of the record then it might give you the error you are getting.

in debugging check the value of all key fields of LS_PA0002 and then goto transaction SE11 and table PA0002. enter the values of key fields that you found in the debuggind screen. probably there might not be any record existing with that key.