cancel
Showing results for 
Search instead for 
Did you mean: 

about to use HR_INFOTYPE_OPERATION to create customer infotype issue:

Former Member
0 Kudos

hi

i want to create infotype use function(HR_INFOTYPE_OPERATION).

this infotype is customer infotype.

the first scenario is:

i'm be sure no data about one employee in this infotype(9004).

to call with data upload function and put data into internal table IT_PA9004.

and the table data as follow:

one line: it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080201' , it_pa9004-endda = '20080930'

it_pa9004-zzvalue = 50 (customer field).

two line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080201' , it_pa9004-endda = '20080930'

it_pa9004-zzvalue = 60 (customer field).

three line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'

it_pa9004-zzvalue = 70 (customer field).

four line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'

it_pa9004-zzvalue = 80 (customer field).

i run the programme and get information is:

11022887 insert ok.

11022887 insert ok.

11022887 insert ok.

11022887 insert ok.

but i use the transation PA30 to view all data:

in database just exist one row:

four line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'

it_pa9004-zzvalue = 80 (customer field).

the second scenario is:

in database the infotype have exist one row:

pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',

pa9004-begda = '20080318' , pa9004-endda = '20080318'

pa9004-zzvalue = X (customer field).

and i create another row:

line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',

it_pa9004-begda = '20080318' , it_pa9004-endda = '99991231'

it_pa9004-zzvalue = 80 (customer field)

i run the programme and get information is:

11022887 insert ok.

the three scenario is:

set HR_INFOTYPE_OPERATION of import parameter operation = 'MOD'

in any scenario will get error :not exist subtype .

what heppend about HR_INFOTYPE_OPERATION working,i had to use this function to

create other infotype of SAP owner.

and will create successfully.

so i thank it may be config Constraints about customer infotype.

is time Constraints effect?

so i want to how to check it?

and if i want to create one infotype for customer using PM01 what some thing

must be taken into account.

think you advance.

partial source code as follow:

FORM ACTION_INSERT .

DATA: P_FLAG TYPE C.

DATA: WA_LOG LIKE LINE OF DATA_LOG.

DATA: PP_ACTION TYPE PSPAR-ACTIO.

LOOP AT IT_PA9004.

CLEAR P_FLAG.

CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.

PERFORM lock_employee USING IT_PA9004-pernr CHANGING P_FLAG.

PP_ACTION = IT_PA9004-ACTION.

PERFORM HR_INFOTYPE_OPERATION USING IT_PA9004 PP_ACTION CHANGING P_FLAG.

IF P_FLAG IS INITIAL.

if test_run = space.

COMMIT WORK.

else.

ROLLBACK WORK.

endif.

write:/ it_pa9004-pernr,'insert ok'.

ELSE.

ROLLBACK WORK.

write:/ it_pa9004-pernr,'error'.

ENDIF.

PERFORM unlock_employee USING IT_PA9004-pernr .

ENDLOOP.

ENDFORM. " ACTION_INSERT

FORM LOCK_EMPLOYEE USING P_PERNR

CHANGING PP_FLAG.

CHECK PP_FLAG IS INITIAL.

CLEAR P_RETURN.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = P_PERNR

IMPORTING

return = P_RETURN

EXCEPTIONS

OTHERS = 01.

CALL FUNCTION 'HR_INITIALIZE_BUFFER'

EXPORTING

pernr = P_PERNR.

IF P_RETURN IS NOT INITIAL.

PP_FLAG = '1'.

ENDIF.

ENDFORM. " LOCK_EMPLOYEE

FORM HR_INFOTYPE_OPERATION USING P_PA9004 LIKE IT_PA9004

P_ACTION type PSPAR-ACTIO

CHANGING PP_FLAG.

CHECK PP_FLAG IS INITIAL.

DATA: bapipakey type bapipakey,

P_SUBTY TYPE P9004-SUBTY,

PP_9004 TYPE TABLE OF P9004 WITH HEADER LINE.

CLEAR P_RETURN.

REFRESH PP_9004.

MOVE-CORRESPONDING P_PA9004 TO PP_9004.

IF P_ACTION = 'INS'.

PP_9004-AEDTM = SY-DATUM.

PP_9004-UNAME = SY-UNAME.

ENDIF.

IF P_ACTION = 'MOD'.

PP_9004-AEDTM = SY-DATUM.

PP_9004-UNAME = SY-UNAME.

ENDIF.

APPEND PP_9004.

P_SUBTY = P_LGART.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '9004'

  • subtype = 'FQ03'

subtype = P_SUBTY

number = PP_9004-pernr

validityend = PP_9004-ENDDA

validitybegin = PP_9004-begda

  • RECORDNUMBER = pp_9004-seqnr

record = PP_9004

operation = 'INS'

  • operation = P_ACTION

nocommit = 'X'

IMPORTING

return = P_RETURN

key = bapipakey

EXCEPTIONS

OTHERS = 0.

IF P_RETURN IS NOT INITIAL.

PP_FLAG = '9'.

ENDIF.

ENDFORM. " HR_INFOTYPE_OPERATION

FORM UNLOCK_EMPLOYEE USING P_PERNR.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = p_pernr

IMPORTING

return = P_RETURN

EXCEPTIONS

OTHERS = 01.

ENDFORM. " UNLOCK_EMPLOYEE

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

i get it!

Former Member
0 Kudos

hi

another information about this infotype.

if i use transaction PA30 to create 9004 infomation.

in database exist SUBTY = 'FQ03'

and begin = '2008/01/01' and endda = '2008/10/31'.

so i create new :

subty = 'FQ03' and begin = '2008/02/01'

and endda = '2008/09/30'

so system will diplay:

record 2008/01/01 ~ 2008/10/31 exist and is split.

Former Member
0 Kudos

hi

i want to create infotype use function(HR_INFOTYPE_OPERATION).

this infotype is customer infotype.

the first scenario is:

i'm be sure no data about one employee in this infotype(9004).

to call with data upload function and put data into internal table IT_PA9004.

and the table data as follow:

one line: it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080201' , it_pa9004-endda = '20080930'

it_pa9004-zzvalue = 50 (customer field).

two line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080201' , it_pa9004-endda = '20080930'

it_pa9004-zzvalue = 60 (customer field).

three line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'

it_pa9004-zzvalue = 70 (customer field).

four line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'

it_pa9004-zzvalue = 80 (customer field).

i run the programme and get information is:

11022887 insert ok.

11022887 insert ok.

11022887 insert ok.

11022887 insert ok.

but i use the transation PA30 to view all data:

in database just exist one row:

four line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',

it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'

it_pa9004-zzvalue = 80 (customer field).

the second scenario is:

in database the infotype have exist one row:

pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',

pa9004-begda = '20080318' , pa9004-endda = '20080318'

pa9004-zzvalue = X (customer field).

and i create another row:

line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',

it_pa9004-begda = '20080318' , it_pa9004-endda = '99991231'

it_pa9004-zzvalue = 80 (customer field)

i run the programme and get information is:

11022887 insert ok.

but in database just exist the first data

pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',

pa9004-begda = '20080318' , pa9004-endda = '20080318'

pa9004-zzvalue = X (customer field).

the three scenario is:

set HR_INFOTYPE_OPERATION of import parameter operation = 'MOD'

in any scenario will get error :not exist subtype .

what heppend about HR_INFOTYPE_OPERATION working,i had to use this function to

create other infotype of SAP owner.

and will create successfully.

so i thank it may be config Constraints about customer infotype.

is time Constraints effect?

so i want to how to check it?

and if i want to create one infotype for customer using PM01 what some thing

must be taken into account.

think you advance.

partial source code as follow:

FORM ACTION_INSERT .

DATA: P_FLAG TYPE C.

DATA: WA_LOG LIKE LINE OF DATA_LOG.

DATA: PP_ACTION TYPE PSPAR-ACTIO.

LOOP AT IT_PA9004.

CLEAR P_FLAG.

CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.

PERFORM lock_employee USING IT_PA9004-pernr CHANGING P_FLAG.

PP_ACTION = IT_PA9004-ACTION.

PERFORM HR_INFOTYPE_OPERATION USING IT_PA9004 PP_ACTION CHANGING P_FLAG.

IF P_FLAG IS INITIAL.

if test_run = space.

COMMIT WORK.

else.

ROLLBACK WORK.

endif.

write:/ it_pa9004-pernr,'insert ok'.

ELSE.

ROLLBACK WORK.

write:/ it_pa9004-pernr,'error'.

ENDIF.

PERFORM unlock_employee USING IT_PA9004-pernr .

ENDLOOP.

ENDFORM. " ACTION_INSERT

FORM LOCK_EMPLOYEE USING P_PERNR

CHANGING PP_FLAG.

CHECK PP_FLAG IS INITIAL.

CLEAR P_RETURN.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = P_PERNR

IMPORTING

return = P_RETURN

EXCEPTIONS

OTHERS = 01.

CALL FUNCTION 'HR_INITIALIZE_BUFFER'

EXPORTING

pernr = P_PERNR.

IF P_RETURN IS NOT INITIAL.

PP_FLAG = '1'.

ENDIF.

ENDFORM. " LOCK_EMPLOYEE

FORM HR_INFOTYPE_OPERATION USING P_PA9004 LIKE IT_PA9004

P_ACTION type PSPAR-ACTIO

CHANGING PP_FLAG.

CHECK PP_FLAG IS INITIAL.

DATA: bapipakey type bapipakey,

P_SUBTY TYPE P9004-SUBTY,

PP_9004 TYPE TABLE OF P9004 WITH HEADER LINE.

CLEAR P_RETURN.

REFRESH PP_9004.

MOVE-CORRESPONDING P_PA9004 TO PP_9004.

IF P_ACTION = 'INS'.

PP_9004-AEDTM = SY-DATUM.

PP_9004-UNAME = SY-UNAME.

ENDIF.

IF P_ACTION = 'MOD'.

PP_9004-AEDTM = SY-DATUM.

PP_9004-UNAME = SY-UNAME.

ENDIF.

APPEND PP_9004.

P_SUBTY = P_LGART.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '9004'

  • subtype = 'FQ03'

subtype = P_SUBTY

number = PP_9004-pernr

validityend = PP_9004-ENDDA

validitybegin = PP_9004-begda

  • RECORDNUMBER = pp_9004-seqnr

record = PP_9004

operation = 'INS'

  • operation = P_ACTION

nocommit = 'X'

IMPORTING

return = P_RETURN

key = bapipakey

EXCEPTIONS

OTHERS = 0.

IF P_RETURN IS NOT INITIAL.

PP_FLAG = '9'.

ENDIF.

ENDFORM. " HR_INFOTYPE_OPERATION

FORM UNLOCK_EMPLOYEE USING P_PERNR.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = p_pernr

IMPORTING

return = P_RETURN

EXCEPTIONS

OTHERS = 01.

ENDFORM. " UNLOCK_EMPLOYEE