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: 

Problem with HR_INFOTYPE_OPERATION

Former Member
0 Kudos
784

I use the FM 'HR_INFOTYPE_OPERATION' to create an Infotype 179 record.

However, when I execute my code, it said 'Make an entry in all required fields.'.

Then I set the FM display_mode to '2' and execute, it shows that the Tax number field (an required field) is empty. However, I'm sure that I pass in all the required field into the FM's parameter(record).

Anyone know why this happen? Is it cuased by the system itself?

Message was edited by:

Irene Sam

1 ACCEPTED SOLUTION

Former Member
0 Kudos
283

Hi,

Look at the sample program

REPORT ZZKNB_BAPI_INFOTYPE_CALL .

* Use 'BAPI_EMPLOYEE_ENQUEUE' to lock the employee before updating
DATA: l_bapireturn LIKE bapireturn1.

DATA: bapipakey_tab LIKE bapipakey OCCURS 0 WITH HEADER LINE.

data: l_p0169 like p0169.

parameters: p_pernr like p0169-pernr default '07000003'.

start-of-selection.

  CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
       EXPORTING
            number = p_pernr
       IMPORTING
            return = l_bapireturn.

  IF l_bapireturn-id NE space.
    WRITE: / l_p0169-pernr, 'Enqueue failed'.
    exit.
  ENDIF.

*-- Suported operations:
*-- change          (operation = 'MOD')
*-- Create          (operation = 'INS')
*-- DELETE          (operation = 'DEL')
*-- CREATESUCCESSOR (operation = 'COP')
  .
  l_p0169-barea = '7A'.
  l_p0169-pltyp = 'RRSP'.
  l_p0169-bplan = 'RRSP'.
  l_p0169-elidt = '20000101'.
  l_p0169-enrty = 'M'.
  l_p0169-perio = '4'.

  CALL FUNCTION 'HR_INFOTYPE_OPERATION'
       EXPORTING
            infty         = '0169'
            subty         = 'RRSP'
            number        = p_pernr
            record        = l_p0169
            validitybegin = '20021001'
            validityend   = '99991231'
            operation     = 'INS'
*           dialog_mode   = '0'  "Use default
*           nocommit      = '1'  "Use default
       IMPORTING
            return        = l_bapireturn
            key           = bapipakey_tab.

  IF l_bapireturn-id NE space.
    WRITE: /   p_pernr,
            20 'Create was unsuccessful',
                l_bapireturn-id,
                l_bapireturn-message+0(40).
  ELSE.
    WRITE: /   p_pernr,
            20 'Create was successful',
                l_bapireturn-id,
                l_bapireturn-message+0(40).
  ENDIF.


* Use 'BAPI_EMPLOYEE_DEQUEUE' to un-lock the employee before updating
  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
       EXPORTING
            number = l_p0169-pernr
       IMPORTING
            return = l_bapireturn.

http://searchsap.techtarget.com/tip/0,289483,sid21_gci930145,00.html

Regards

Sudheer

3 REPLIES 3

Former Member
0 Kudos
284

Hi,

Look at the sample program

REPORT ZZKNB_BAPI_INFOTYPE_CALL .

* Use 'BAPI_EMPLOYEE_ENQUEUE' to lock the employee before updating
DATA: l_bapireturn LIKE bapireturn1.

DATA: bapipakey_tab LIKE bapipakey OCCURS 0 WITH HEADER LINE.

data: l_p0169 like p0169.

parameters: p_pernr like p0169-pernr default '07000003'.

start-of-selection.

  CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
       EXPORTING
            number = p_pernr
       IMPORTING
            return = l_bapireturn.

  IF l_bapireturn-id NE space.
    WRITE: / l_p0169-pernr, 'Enqueue failed'.
    exit.
  ENDIF.

*-- Suported operations:
*-- change          (operation = 'MOD')
*-- Create          (operation = 'INS')
*-- DELETE          (operation = 'DEL')
*-- CREATESUCCESSOR (operation = 'COP')
  .
  l_p0169-barea = '7A'.
  l_p0169-pltyp = 'RRSP'.
  l_p0169-bplan = 'RRSP'.
  l_p0169-elidt = '20000101'.
  l_p0169-enrty = 'M'.
  l_p0169-perio = '4'.

  CALL FUNCTION 'HR_INFOTYPE_OPERATION'
       EXPORTING
            infty         = '0169'
            subty         = 'RRSP'
            number        = p_pernr
            record        = l_p0169
            validitybegin = '20021001'
            validityend   = '99991231'
            operation     = 'INS'
*           dialog_mode   = '0'  "Use default
*           nocommit      = '1'  "Use default
       IMPORTING
            return        = l_bapireturn
            key           = bapipakey_tab.

  IF l_bapireturn-id NE space.
    WRITE: /   p_pernr,
            20 'Create was unsuccessful',
                l_bapireturn-id,
                l_bapireturn-message+0(40).
  ELSE.
    WRITE: /   p_pernr,
            20 'Create was successful',
                l_bapireturn-id,
                l_bapireturn-message+0(40).
  ENDIF.


* Use 'BAPI_EMPLOYEE_DEQUEUE' to un-lock the employee before updating
  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
       EXPORTING
            number = l_p0169-pernr
       IMPORTING
            return = l_bapireturn.

http://searchsap.techtarget.com/tip/0,289483,sid21_gci930145,00.html

Regards

Sudheer

Former Member
0 Kudos
283

hi

good

plz go through these functionality of the HR_INFOTYPE_OPERATION and use accordingly.

Functionality

This function module enables you to maintain master data for employees and applicants. You can transfer one data record. All validation checks take place that would take place in the individual maintenance screens in the dialog. If necessary, the module returns an error message. The error messages are the same as the error messages in the dialog, that is, the individual maintenance screen error messages are transferred rather than interpreted by this module.

Notes

The update takes place using a 'Call dialog' from the module pool infotypes. For this reason, some restrictions apply for the infotypes that are to be handled in this way.

The screens for individual infotypes can not overwrite the transferred data for PBO.

No essential checks that are programmed 'on request' will be included in the module, as these will not run.

No messages can be processed for PBO. This will lead to error message 428(PG).

No 'leave screens' may be programmed, unless 'set screen 0' has been set previously. This also leads to error message 428(PG).

If you receive error messages of type 'Required field not filled...', you can not specify the field any more precisely. In this case, you must try to transfer the data into the system using the dialog transaction.

Parameter

INFTY

NUMBER

SUBTYPE

OBJECTID

LOCKINDICATOR

VALIDITYEND

VALIDITYBEGIN

RECORDNUMBER

RECORD

OPERATION

TCLAS

DIALOG_MODE

NOCOMMIT

VIEW_IDENTIFIER

SECONDARY_RECORD

RETURN

KEY

-


go through this example

Example:

REPORT ZZKNB_BAPI_INFOTYPE_CALL .

  • Use 'BAPI_EMPLOYEE_ENQUEUE' to lock the employee before updating

DATA: l_bapireturn LIKE bapireturn1.

DATA: bapipakey_tab LIKE bapipakey OCCURS 0 WITH HEADER LINE.

data: l_p0169 like p0169.

parameters: p_pernr like p0169-pernr default '07000003'.

start-of-selection.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = p_pernr

IMPORTING

return = l_bapireturn.

IF l_bapireturn-id NE space.

WRITE: / l_p0169-pernr, 'Enqueue failed'.

exit.

ENDIF.

*-- Suported operations:

*-- change (operation = 'MOD')

*-- Create (operation = 'INS')

*-- DELETE (operation = 'DEL')

*-- CREATESUCCESSOR (operation = 'COP')

.

l_p0169-barea = '7A'.

l_p0169-pltyp = 'RRSP'.

l_p0169-bplan = 'RRSP'.

l_p0169-elidt = '20000101'.

l_p0169-enrty = 'M'.

l_p0169-perio = '4'.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0169'

subty = 'RRSP'

number = p_pernr

record = l_p0169

validitybegin = '20021001'

validityend = '99991231'

operation = 'INS'

  • dialog_mode = '0' "Use default

  • nocommit = '1' "Use default

IMPORTING

return = l_bapireturn

key = bapipakey_tab.

IF l_bapireturn-id NE space.

WRITE: / p_pernr,

20 'Create was unsuccessful',

l_bapireturn-id,

l_bapireturn-message+0(40).

ELSE.

WRITE: / p_pernr,

20 'Create was successful',

l_bapireturn-id,

l_bapireturn-message+0(40).

ENDIF.

  • Use 'BAPI_EMPLOYEE_DEQUEUE' to un-lock the employee before updating

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = l_p0169-pernr

IMPORTING

return = l_bapireturn.

thanks

mrutyun^

amit_khare
Active Contributor
0 Kudos
283

Goto PA30 and check all the mandatory fields for this infotype as given on the screen and pass them in your internal table alongwith the other values.

Regards,

Amit