2008 Dec 24 6:30 AM
Hi all,
I am using HR_INFOTYPE_OPERATION function module to change the content of NAME2 field in IT0006.But I am getting the error as 'No record stored for IT0006 in the selected period'.But infotype 0006 has the record with end date 31.12.9999 and all the mandatory infotypes are also filled. I am not able to update a field in IT0006 for the pernr 36000002.Please find the below coding and tell me what went wrong.
tables: pa0001,p0006,pa0006.
data: itab type p0006 OCCURS 0 WITH HEADER LINE,
wa_itab type p0006,
i_bapireturn1 type bapireturn1 OCCURS 0 WITH HEADER LINE ,
i_key type bapipakey,
i_prop type pprop occurs 0 with HEADER LINE.
select * FROM PA0006 INTO CORRESPONDING FIELDS OF TABLE itab
where pernr = '36000002' and
SUBTY = '1'
and endda = '99991231'.
loop at itab INTO wa_itab.
wa_itab-name2 = 'street name new'.
*pa0006-name2 = 'street name'.
*pa0006-pernr = itab-pernr.
*pa0006-endda = itab-endda.
*pa0006-begda = itab-begda.
*
*i_prop-infty = '0006'.
*i_prop-fname = 'NAME2'.
*i_prop-fval = itab-name2.
*i_prop-seqnr = '000'.
*append i_prop.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = '36000002'
* IMPORTING
* RETURN = i_bapireturn1
.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0006'
NUMBER = wa_ITAB-PERNR
SUBTYPE = '1'
OBJECTID = wa_itab-objps
LOCKINDICATOR = wa_itab-sprps
VALIDITYEND = wa_itab-endda
VALIDITYBEGIN = wa_itab-begda
RECORDNUMBER = wa_itab-seqnr
RECORD = wa_itab
OPERATION = 'MOD'
TCLAS = 'A'
* DIALOG_MODE = '0'
* NOCOMMIT = ''
* VIEW_IDENTIFIER = 'X'
* SECONDARY_RECORD =
IMPORTING
RETURN = i_bapireturn1
KEY = i_key
.
* modify pa0006 from itab.
*commit work.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = '36000002'
* IMPORTING
* RETURN =
.
clear: itab, i_bapireturn1.
endloop.
loop at i_bapireturn1.
write: i_bapireturn1-message.
clear: i_bapireturn1.
endloop.
Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 10:22 AM
Hi all,
I am using HR_INFOTYPE_OPERATION function module to change the content of NAME2 field in IT0006.But I am getting the error as 'No record stored for IT0006 in the selected period'.But infotype 0006 has the record with end date 31.12.9999 and all the mandatory infotypes are also filled. I am not able to update a field in IT0006 for the pernr 36000002.Please find the below coding and tell me what went wrong.
tables: pa0001,p0006,pa0006.
data: itab type p0006 OCCURS 0 WITH HEADER LINE,
wa_itab type p0006,
i_bapireturn1 type bapireturn1 OCCURS 0 WITH HEADER LINE ,
i_key type bapipakey,
i_prop type pprop occurs 0 with HEADER LINE.
select * FROM PA0006 INTO CORRESPONDING FIELDS OF TABLE itab
where pernr = '36000002' and
SUBTY = '1'
and endda = '99991231'.
loop at itab INTO wa_itab.
wa_itab-name2 = 'street name new'.
*pa0006-name2 = 'street name'.
*pa0006-pernr = itab-pernr.
*pa0006-endda = itab-endda.
*pa0006-begda = itab-begda.
*
*i_prop-infty = '0006'.
*i_prop-fname = 'NAME2'.
*i_prop-fval = itab-name2.
*i_prop-seqnr = '000'.
*append i_prop.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = '36000002'
* IMPORTING
* RETURN = i_bapireturn1
.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0006'
NUMBER = wa_ITAB-PERNR
SUBTYPE = '1'
OBJECTID = wa_itab-objps
LOCKINDICATOR = wa_itab-sprps
VALIDITYEND = wa_itab-endda
VALIDITYBEGIN = wa_itab-begda
RECORDNUMBER = wa_itab-seqnr
RECORD = wa_itab
OPERATION = 'MOD'
TCLAS = 'A'
* DIALOG_MODE = '0'
* NOCOMMIT = ''
* VIEW_IDENTIFIER = 'X'
* SECONDARY_RECORD =
IMPORTING
RETURN = i_bapireturn1
KEY = i_key
.
* modify pa0006 from itab.
*commit work.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = '36000002'
* IMPORTING
* RETURN =
.
clear: itab, i_bapireturn1.
endloop.
loop at i_bapireturn1.
write: i_bapireturn1-message.
clear: i_bapireturn1.
endloop.
Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 10:22 AM
2008 Dec 24 7:53 AM
Hi Srinivas,
I tried with below code (changed from actual code) and it works fine. Please try.
TABLES: pa0001,p0006,pa0006.
DATA: itab TYPE p0006 OCCURS 0 WITH HEADER LINE,
wa_itab TYPE p0006,
i_bapireturn1 TYPE bapireturn1 OCCURS 0 WITH HEADER LINE ,
i_key TYPE bapipakey,
i_prop TYPE pprop OCCURS 0 WITH HEADER LINE.
SELECT * FROM pa0006 INTO CORRESPONDING FIELDS OF TABLE itab
WHERE pernr = '10008106' AND
subty = '1'
AND endda = '99991231'.
LOOP AT itab INTO wa_itab.
wa_itab-name2 = 'street name new'.
wa_itab-infty = '0006'.
*pa0006-name2 = 'street name'.
*pa0006-pernr = itab-pernr.
*pa0006-endda = itab-endda.
*pa0006-begda = itab-begda.
*
*i_prop-infty = '0006'.
*i_prop-fname = 'NAME2'.
*i_prop-fval = itab-name2.
*i_prop-seqnr = '000'.
*append i_prop.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = '10008106'
IMPORTING
return = i_bapireturn1.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0006'
number = wa_itab-pernr
subtype = '1'
objectid = wa_itab-objps
lockindicator = wa_itab-sprps
validityend = wa_itab-endda
validitybegin = wa_itab-begda
recordnumber = wa_itab-seqnr
record = wa_itab
operation = 'MOD'
tclas = 'A'
* dialog_mode = '0'
* nocommit = ''
* view_identifier = 'X'
* secondary_record =
importing
return = i_bapireturn1
key = i_key.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = '10008106'.
CLEAR: itab, i_bapireturn1.
ENDLOOP.
LOOP AT i_bapireturn1.
WRITE: i_bapireturn1-message.
CLEAR: i_bapireturn1.
ENDLOOP.Regards
Eswar
Edited by: Eswar Kanakanti on Dec 24, 2008 8:53 AM
2008 Dec 26 11:53 AM
Hi Srinivasan,
For MOD operation what we require is the the key fields of the record to be modified should exactly matched with the parameters we are exporting.
Please check that record exist with these parameters you are passing:
EXPORTING
INFTY = '0006'
NUMBER = wa_ITAB-PERNR
SUBTYPE = '1'
OBJECTID = wa_itab-objps
LOCKINDICATOR = wa_itab-sprps
VALIDITYEND = wa_itab-endda
VALIDITYBEGIN = wa_itab-begda
RECORDNUMBER = wa_itab-seqnr
If such record found in database table PA0006 then it will get modified with the data in waork area wa_itab
2008 Dec 26 6:10 PM
Hello Srinivas,
Tis will work, wa_itab-infty = '0006'.
loop at itab INTO wa_itab.
wa_itab-infty = '0006'.
wa_itab-name2 = 'street name new'.
.....
.....
.....
endloop.
Regards,
Rajesh P Nair.
2010 Dec 22 12:39 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |