2015 Dec 23 6:15 AM
Hello,
I want to insert set data into custom infotype 9000 from another pernr.
before that i have try using FM HR_INFOTYPE_OPERATION for insert data into infotype but data not inserted in PA30.
I get message error "The employee is assigned to a different view indicator".
How i fix it ?
this is my code
SELECT * FROM pa9000 INTO CORRESPONDING FIELDS OF TABLE lt_9000
WHERE pernr = lv_pernr.
IF lt_9000[] IS NOT INITIAL and sy-tcode = 'PA40'.
CONSTANTS: insert TYPE pspar-actio VALUE 'INS'.
DATA: lv_return LIKE bapireturn1,
lv_key LIKE bapipakey.
LOOP AT lt_9000.
"This code is requred and locks the record ready for modification
CLEAR lv_return.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = innnn-pernr
IMPORTING
return = lv_return.
MOVE-CORRESPONDING lt_9000 TO lw_9000.
lw_9000-pernr = innnn-pernr.
CLEAR lv_return.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '9000'
* subtype = p_record-subty
number = innnn-pernr "employeenumber
validityend = innnn-begda
validitybegin = innnn-endda
record = lw_9000
operation = insert
* nocommit = ''
dialog_mode = '2'
view_identifier = '07'
IMPORTING
return = lv_return
key = lv_key
EXCEPTIONS
OTHERS = 0.
if lv_return is not INITIAL.
MESSAGE lv_return-message type 'E'.
ENDIF.
"unlock record after modification
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = innnn-pernr.
ENDLOOP.
ENDIF.
Thanks
Noor K Sejati
2015 Dec 23 6:43 AM
Hi,
Check the Value you are passing in the parameter view_identifier.
Check the value of the field VIEKN in infotype 0003 for the employee and then pass the same here.
Hope this help.
Hello,
I want to insert set data into custom infotype 9000 from another pernr.
before that i have try using FM HR_INFOTYPE_OPERATION for insert data into infotype but data not inserted in PA30.
I get message error "The employee is assigned to a different view indicator".
How i fix it ?
this is my code
SELECT * FROM pa9000 INTO CORRESPONDING FIELDS OF TABLE lt_9000
WHERE pernr = lv_pernr.
IF lt_9000[] IS NOT INITIAL and sy-tcode = 'PA40'.
CONSTANTS: insert TYPE pspar-actio VALUE 'INS'.
DATA: lv_return LIKE bapireturn1,
lv_key LIKE bapipakey.
LOOP AT lt_9000.
"This code is requred and locks the record ready for modification
CLEAR lv_return.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = innnn-pernr
IMPORTING
return = lv_return.
MOVE-CORRESPONDING lt_9000 TO lw_9000.
lw_9000-pernr = innnn-pernr.
CLEAR lv_return.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '9000'
* subtype = p_record-subty
number = innnn-pernr "employeenumber
validityend = innnn-begda
validitybegin = innnn-endda
record = lw_9000
operation = insert
* nocommit = ''
dialog_mode = '2'
view_identifier = '07'
IMPORTING
return = lv_return
key = lv_key
EXCEPTIONS
OTHERS = 0.
if lv_return is not INITIAL.
MESSAGE lv_return-message type 'E'.
ENDIF.
"unlock record after modification
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = innnn-pernr.
ENDLOOP.
ENDIF.
Thanks
Noor K Sejati
2015 Dec 23 6:43 AM
Hi,
Check the Value you are passing in the parameter view_identifier.
Check the value of the field VIEKN in infotype 0003 for the employee and then pass the same here.
Hope this help.
2015 Dec 28 4:09 AM
i have checked value viekn in infotype 0003 and function was succes.
but when i checked tcode pa30 value infotype custom 9000 not inserted. how i fix it?
what i am missing?
2015 Dec 28 12:03 PM
Hi Noor,
If no error is throwing and still updation is not happened? Have you used COMMIT statement after HR_INFOTYPE_OPERATION to update the values in backend table.
CALL FUNCTION BAPI_TRANSACTION_COMMIT
Regards
Rajkumar Narsimman
2015 Dec 29 9:05 AM
Hi Rajkumar,
I try using CALL FUNCTION BAPI_TRANSACTION_COMMIT, after HR_INFOTYPE_OPERATION but get error Invalid COMMIT WORK in a COMMIT WORK or ROLLBACK WORK.
my code is in the user exit ZXPADU01, maybe using BAPI_TRANSACTION_COMMIT cant work in this exit?
2015 Dec 31 9:29 AM
If you have written your code in the User Exit, may be use 'STARTING AT NEW TASK' with the FM HR_INFOTYPE_OPERATION.
Hope this helps.
2015 Dec 23 11:04 AM
Hi Noor,
Agree with Gaurav,
check the view indicator value for the pernr from PA0003 and then check whether error is still coming or not.
Code fragment looks fine.
---BR----
Tapomay