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: 

HR_INFOTYPE_OPERATION ISSUE!

Former Member
0 Kudos

HI!

I meet one case!

the function


CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING
    infty         = '2003'
    subtype       = '01'
    number        = PP_2003-pernr
    validityend   = PP_2003-ENDDA
    validitybegin = PP_2003-begda
    record        = PP_2003
*      operation     = 'INS'
    operation     = P_ACTION
    nocommit      = 'X'
  IMPORTING
    return        = RETURN
    key           = bapipakey
  EXCEPTIONS
    OTHERS        = 0.

the return is initial.

and i set commit work!

but can't insert data to database!

on the way! in the difference client the same code can work ok!

how to reslove it ! some one can give advise!

thank you very much!

Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 3:17 PM

9 REPLIES 9

Former Member
0 Kudos

demo code:


parameters:pernr type pernr-pernr.
parameters:pdate type d.
parameters:ppernr type pernr-pernr.
parameters:ppdate type d.
tables:pa0001.
tables:pa2003.
data:p_flag.
select single * from pa0001 where pernr = pernr.

if sy-subrc ne 0.
  stop.
endif.
DATA:return TYPE bapireturn1.
DATA: bapipakey type bapipakey,
      PP_2006 TYPE TABLE OF  P2006 WITH HEADER LINE,
      PP_2003 TYPE TABLE OF  P2003 WITH HEADER LINE.
data:p_action type PSPAR-ACTIO.
DATA:W2003 TYPE P2003.
select single * from pa2003 where pernr = ppernr  and begda = ppdate.
if sy-subrc ne 0.
  stop.
endif.
CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.
PERFORM lock_employee USING pernr CHANGING P_FLAG.

move-corresponding pa2003 to pp_2003.
pp_2003-pernr = pernr.
pp_2003-begda = pp_2003-endda = pdate.
P_ACTION = 'INS'.
IF P_ACTION = 'INS'.
  PP_2003-AEDTM = SY-DATUM.
  PP_2003-UNAME = SY-UNAME.
ENDIF.

pp_2003-infty = '2003'.
APPEND PP_2003.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING
    infty         = '2003'
    subtype       = '01'
    number        = PP_2003-pernr
    validityend   = PP_2003-ENDDA
    validitybegin = PP_2003-begda
    record        = PP_2003
*      operation     = 'INS'
    operation     = P_ACTION
    nocommit      = 'X'
  IMPORTING
    return        = RETURN
    key           = bapipakey
  EXCEPTIONS
    OTHERS        = 0.

if return is initial.
  commit work.
else.
  rollback work.
endif.

PERFORM unlock_employee USING pernr .


*&---------------------------------------------------------------------*
*&      Form  LOCK_EMPLOYEE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PP_PERNR   text
*      -->PP_FLAG    text
*----------------------------------------------------------------------*
FORM LOCK_EMPLOYEE  USING    PP_PERNR
                   CHANGING PP_FLAG.
  CHECK PP_FLAG IS INITIAL.
  CLEAR RETURN.
  DATA:P_PERNR TYPE BAPIP0001-PERNR.
  P_PERNR = PP_PERNR.
  CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
    EXPORTING
      number = P_PERNR
    IMPORTING
      return = RETURN
    EXCEPTIONS
      OTHERS = 01.

  CALL FUNCTION 'HR_INITIALIZE_BUFFER'
    EXPORTING
      pernr = P_PERNR.

  IF RETURN IS NOT INITIAL.
    PP_FLAG = 'Y'.
    stop.
  ENDIF.
ENDFORM.                    "LOCK_EMPLOYEE

*&---------------------------------------------------------------------*
*&      Form  UNLOCK_EMPLOYEE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PP_PERNR   text
*----------------------------------------------------------------------*
FORM UNLOCK_EMPLOYEE  USING    PP_PERNR.
  DATA:P_PERNR TYPE BAPIP0001-PERNR.
  P_PERNR = PP_PERNR.
  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
    EXPORTING
      number = p_pernr
    IMPORTING
      return = RETURN
    EXCEPTIONS
      OTHERS = 01.
ENDFORM.                    " UNLOCK_EMPLOYEE

thank you very much!

Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 3:17 PM

0 Kudos

Make sure below line should not be commented.

operation = 'INS'

Former Member
0 Kudos

Are you calling this FM in user exit or is it in executable program? try with BAPI_COMMIT before dequeue.

Former Member
0 Kudos

hi

i use this function in report!

some is oddness when i using debug mode to run this report!

one seqence : dialog_mode in this function is default = 0 (run in backgroud)

i will get error return (PG 428 complix application error)

next: i set dialog_mode to 2 (display screen when run this function)

the screen display i do any thing ( no save data). leave program!

last: i run the this report again with dialog_mode = 0 (default like first one).

the report run ok !

i don't what happend!

Former Member
0 Kudos

Please read the function module documentation and see that all the required parameters are passed to the function module.

Check for the parameter number to pass the pERNR of the record

Former Member
0 Kudos

thank you !

all needed parameters i have passed!

0 Kudos

Means Problem solved?

Former Member
0 Kudos

no!

this issue can't occurs just another infotype(it2006) deal with ok!

but i don't know what happened!

thank you very much!

Former Member
0 Kudos

close!

may be it2003 and it2006 will be collesion in the same opearate!