Application Development 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: 

Updating Employee with HR_INFOTYPE_OPERATION

Former Member
0 Kudos

How do I update an employee with HR_INFOTYPE_OPERATION?

This is my code, but it returns error "Fill in all required entry fields"...

DATA: P0002 like p0002 occurs 0 with header line.
DATA: RC1 TYPE BAPIRETURN1.
DATA: RC3 TYPE BAPIRETURN1.

P0002-NACHN = NACHN.
P0002-VORNA = VORNA.
P0002-GESCH = GESCH.
P0002-GBDAT = GBDAT.
P0002-PERID = PERID.

*Lock Employee
*-------------
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
  EXPORTING
    number = PERNR
  IMPORTING
    return = RC3.


CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING
    INFTY                  = '0002'
    NUMBER                 = PERNR
*   SUBTYPE                =
*   OBJECTID               =
*   LOCKINDICATOR          =
    VALIDITYEND            = '99991231'
    VALIDITYBEGIN          = '19780625'
*   RECORDNUMBER           =
    RECORD                 = P0002
    OPERATION              = 'MOD'
*   TCLAS                  = 'A'
*   DIALOG_MODE            = '0'
*   NOCOMMIT               =
*   VIEW_IDENTIFIER        =
*   SECONDARY_RECORD       =
 IMPORTING
   RETURN                  = RC1
*   KEY                    =
    .

*Unlock Employee
*---------------
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
  EXPORTING
    number = PERNR.

What am I doing wrong?

Thanks in advance.

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Go to PA30 transaction with the same employee and see what is the mandatory information you have to pass for the infotype 0002. this way you can cross check what you are missing. and supply the information which you are missing.

17 REPLIES 17

former_member188685
Active Contributor
0 Kudos

Go to PA30 transaction with the same employee and see what is the mandatory information you have to pass for the infotype 0002. this way you can cross check what you are missing. and supply the information which you are missing.

0 Kudos

Go to PA30 transaction with the same employee and see what is the mandatory information you have to pass for the infotype 0002. this way you can cross check what you are missing. and supply the information which you are missing.

I've tried this and there is no mandatory info missing

0 Kudos

try to pass BEGDA and ENDDA in p0002 structure and see.

0 Kudos

try to pass BEGDA and ENDDA in p0002 structure and see.

That was also my idea, but no luck

Try to use the Function module HR_MAINTAIN_MASTERDATA

How do I need to use this if IT0000 and IT0001 don't need to be changed?

Which MASSN do I need to use then?

Which other parameters do I need to pass?

0 Kudos

do one thing, just select the record from pa0002 directly into p0002 structure, now override the values what ever you want. and call the function and see.

0 Kudos

Hi

HR_MAINTAIN_MASTERDATA if you open and see the definiton of this function module then you can observer that all the import parameters are OPTIONAL Either you can send or you may not but what evr the values that you pass those values are considered and its default INFOTYPE ACTION is INSERT all you have to write MOD and coming to the tables part it is mandartory to pass the PROPOSED_VALUES it is of type structure PROP so all you need to pass is the field name(FNAME) and fieldvalue(FVAL)

0 Kudos

do one thing, just select the record from pa0002 directly into p0002 structure, now override the values what ever you want. and call the function and see.

Then I get a dump... :'-(

ASSIGN_BASE_TOO_SHORT

ROW 271 in HR_INFOTYPE_OPERATION

0 Kudos

the error may be because of your select, since pa0002 and p0002 is different in structures. so the fields will be shifted, so you get wrong data to p0002 structure.

select * from pa0002
into corresponding fields of p0002
where....

try this way and se..

0 Kudos

the error may be because of your select, since pa0002 and p0002 is different in structures. so the fields will be shifted, so you get wrong data to p0002 structure.

select * from pa0002
into corresponding fields of p0002
where....

try this way and se..

Now I get "Infotype does not exist" :-s

0 Kudos

HR_MAINTAIN_MASTERDATA if you open and see the definiton of this function module then you can observer that all the import parameters are OPTIONAL Either you can send or you may not but what evr the values that you pass those values are considered and its default INFOTYPE ACTION is INSERT all you have to write MOD and coming to the tables part it is mandartory to pass the PROPOSED_VALUES it is of type structure PROP so all you need to pass is the field name(FNAME) and fieldvalue(FVAL)

I've tried it this way and it works 😄

Thanks.

0 Kudos

pass infotype number to the P0002 structure.

P0002-INFTY = '0002'. "mention this also..

0 Kudos

Hi Illse,

Were u able to create the PERID value as well???

bpawanchand
Active Contributor
0 Kudos

Hi

Check how are you passing the PERNR to the fucntion module , PERNR size is 8 Numerics you need to pass the PERNR in the same format like this '00012348'.

Regards

Pavan

0 Kudos

Check how are you passing the PERNR to the fucntion module , PERNR size is 8 Numerics you need to pass the PERNR in the same format like this '00012348'.

I'm passing it as type P0002-pernr and this is 8 numeric...

I have no clue what I'm doing wrong...

0 Kudos

Hi

Try to use the Function module HR_MAINTAIN_MASTERDATA

Regards

Pavan

Former Member
0 Kudos

Hi,

*****************************************

DATA: P0002 like p0002 occurs 0 with header line.

DATA: RC1 TYPE BAPIRETURN1.

DATA: RC3 TYPE BAPIRETURN1.

data: pernr type pa0002-pernr.

P0002-NACHN = 'NACHN'.

P0002-VORNA = 'VORNA'.

P0002-GESCH = 'GESCH'.

P0002-GBDAT = 'GBDAT'.

P0002-PERID = '00000001'.

pernr = '00000001'.

*Lock Employee

*----


CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = PERNR

IMPORTING

return = RC3.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

INFTY = '0002'

NUMBER = PERNR

  • SUBTYPE =

  • OBJECTID =

  • LOCKINDICATOR =

VALIDITYEND = '99991231'

VALIDITYBEGIN = '19780625'

  • RECORDNUMBER =

RECORD = P0002

OPERATION = 'MOD'

  • TCLAS = 'A'

  • DIALOG_MODE = '0'

  • NOCOMMIT =

  • VIEW_IDENTIFIER =

  • SECONDARY_RECORD =

IMPORTING

RETURN = RC1

  • KEY =

.

*Unlock Employee

*----


CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = PERNR.

****************************************

This code is working fine.

Regards,

Syed

0 Kudos

I still get the "Fill in the required entry fields" with this code

DATA: P0002 like p0002 occurs 0 with header line.
DATA: RC1 TYPE BAPIRETURN1.
DATA: RC3 TYPE BAPIRETURN1.
data: pernr type pa0002-pernr.
P0002-NACHN = 'NACHN'.
P0002-VORNA = 'VORNA'.
P0002-GESCH = 'GESCH'.
P0002-GBDAT = 'GBDAT'.
P0002-PERID = '00000001'.
pernr = '00000001'.

*Lock Employee
*-------------
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = PERNR
IMPORTING
return = RC3.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0002'
NUMBER = PERNR

VALIDITYEND = '99991231'
VALIDITYBEGIN = '19780625'

RECORD = P0002
OPERATION = 'MOD'

IMPORTING
RETURN = RC1


*Unlock Employee
*---------------
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = PERNR.