cancel
Showing results for 
Search instead for 
Did you mean: 

Issue while using HR_INFOTYPE_OPERATION for MOD for IT2001 and 2006

farooq_basha
Active Participant
0 Kudos

Hi Experts,

I am building the custom Leave request for that Positing of Leave request to Infotype 2001 I am using HR_INFOTYPE_OPERATION.

1) On create of new Leave Request

When I am using the HR_INFOTYPE_OPERATION with INS(Insert) it is properly getting update in IT2001.

Same thing is getting reflected to 2006(Quota Type) and in ESS tiem account over also showing quota .

2) Modify of Leave Request

When I am using the HR_INFOTYPE_OPERATION with MOD(Insert) it is properly getting update in IT2001.

with modification date (BEGDA and ENDDA). But the Quoata dedution in IT2006 is not reflecting

*              CALL FUNCTION 'HR_INFOTYPE_OPERATION'

*                EXPORTING

*                  infty         = '2001'

*                  number        = wa_pa2001-pernr

*                  subtype       = wa_pa2001-subty

*                  objectid      = wa_pa2001-objps

*                  lockindicator = wa_pa2001-sprps

*                  validityend   = wa_p2001-endda

*                  validitybegin = wa_p2001-begda

*                  recordnumber  = wa_pa2001-seqnr

*                  record        = wa_pa2001

*                  operation     = 'MOD'

*                  tclas         = 'A'

*                  dialog_mode   = '0'

*                  nocommit      = 'X'

*                IMPORTING

*                  return        = wa_return.

*

Same thing is getting not reflected updated 2006(Quota Type) and in ESS time account over also showing quota .

Please guide me any thing going wrong with 'MOD' operation

Regards,

Shaik farooq

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member201275
Active Contributor
0 Kudos

Do you have a deduction rule set up for this absence type? This should be done automatically if the deduction rule is in place i.e. the absence type should be linked to the quota.

Check view V_556R_B.

farooq_basha
Active Participant
0 Kudos

Hi Glen,

This is running system from last 2 year. Every thing is configure. But process for update of infotype (2001 and 2002) i.e., Insert, Modify and Delete. I am follow above way which getting conflict in 2006 and Time Account(ESS) of Employee.

Regards,

Shaik Farooq

former_member201275
Active Contributor
0 Kudos

Hi Shaik,

I know that there is a report that Basis can setup to run every day, or more often, which aligns 2001 and 2006. I cannot remember the name though but you can google it quite easily.

Are you able to do what you want in foreground i.e. using PA30? If so then I would write a bdc program

former_member201275
Active Contributor
0 Kudos

Hi Shaik,

had some other ideas.

Something must be wrong in your config or features. Here are the following checks I would make: check Feature QUOMO,

run report RPTQUOTA_CHECK to check the specific Quota,

check following tables: T556U, V_554S_Q,

check that ESG and PSG are correctly grouped to the Quota and that this matches to the employee you are running this for.

farooq_basha
Active Participant
0 Kudos

Hi Glen,

I have tried with BDC also, same inconsistency I am facing for 2006 and ESS portal.

Tried config all are fine.

As suggestedd I google and found one report  RPTKOK00 which has adjusted all the leave which are in consistent(which are not adjusting in 2006) when I run for employee wise. Now it look fine in 2006 after adjusting from the report .

But how the standard report : RPTARQPOST will be getting updated with quota(2006) and ESS Time account.

Any suggestions plz

Regards,

Shaik Farooq

Former Member
0 Kudos

Use report HNZUPTC0 or RPTKOK00 and RPTBPC10 to find inconsistancy between 2001 and 2006.

Read below: http://solveissue.com/note?id=1674847

Regards

Aj

Former Member
0 Kudos

Hi Farooq,

FM HR_INFOTYPE_OPERATION is not released for customers. You should use FM BAPI_PTMGRATTABS_MNGCHANGE for changing infotype 2001.

Cheers

Joerg

farooq_basha
Active Participant
0 Kudos

Hi Joerg,

Thanks for quick response.

It means, We can insert and Delete record by using HR_INFOTYPE_OPERATION, But for changing (i.e.,) modification not allowed?

If I used this FM BAPI_PTMGRATTABS_MNGCHANGE, How to capture all the info(Importing parameters) with Pernr, Begda, endda, and subty.

Or else should go with BDC recording for create, Modify and Delete of IT2001 so that it will effect quota(2006) also.

Regards,

Shaik Farooq

Former Member
0 Kudos

Hi Farooq,

before calling FM BAPI_PTMGRATTABS_MNGCHANGE, you have to use FM BAPI_EMPATTABS_GETLIST to get the listkey for transferring the relevant parameters. Please read the documentation of the two named FMs.

BDC will not helping you because it uses FM HR_MAINTAIN_MASTERDATA and this calls HR_INFOTYPE_OPERATION.

Cheers

Joerg

farooq_basha
Active Participant
0 Kudos


Hi Joerg,


Thanks again.


Let me try this possibility.


Regards,

Shaik farooq

farooq_basha
Active Participant
0 Kudos

Hi Joerg,

I have tried with FM, below is the code. I am facing same quota conflict issue can u please check below whether I am missing some thing. Simulation I am passing ''

For Create:

CLEAR: wa_bapireturn1, wa_hrabsatt_in.

* Passing Modification dates

         wa_hrabsatt_in-from_date = wa_leareq_upd-begda.

         wa_hrabsatt_in-to_date   = wa_leareq_upd-endda.

         CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

           EXPORTING

             number = lv_pernr

           IMPORTING

             return = wa_bapireturn1.

         IF wa_bapireturn1 IS INITIAL.

           CLEAR wa_bapireturn2.

           REFRESH lt_bapireturn2.

           CALL FUNCTION 'BAPI_PTMGRATTABS_MNGCREATION'

             EXPORTING

               employeenumber = wa_leareq_upd-pernr

               abs_att_type   = wa_leareq_upd-awart

               hrabsatt_in    = wa_hrabsatt_in

             TABLES

               return         = lt_bapireturn2.

           CLEAR lv_flag_err.

           LOOP AT lt_bapireturn2 INTO wa_bapireturn2.

             CLEAR wa_output.

             wa_output-pernr = wa_leareq_upd-pernr.

             wa_output-awart = wa_leareq_upd-awart.

             CLEAR wa_t554t.

             READ TABLE it_t554t INTO wa_t554t WITH KEY awart = wa_leareq_upd-awart.

             wa_output-atext = wa_t554t-atext.

             wa_output-begda = wa_leareq_upd-begda.

             wa_output-endda = wa_leareq_upd-endda.

             wa_output-mtype = wa_bapireturn2-type.

             wa_output-id    = wa_bapireturn2-id.

             wa_output-number = wa_bapireturn2-number.

             wa_output-message = wa_bapireturn2-message.

             IF wa_bapireturn2-type = 'E'.

               lv_flag_err = 'X'.

             ENDIF.

             CLEAR wa_bapireturn2.

             APPEND wa_output TO lt_output.

           ENDLOOP.

           IF lv_flag_err NE'X'.

             IF p_tr NE 'X'.

               CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

               wa_leareq_upd-final_sta = 'X'.

               MODIFY zhr_leareq_upd FROM wa_leareq_upd.

             ENDIF.

           ENDIF.


For Modify


REFRESH lt_bapireturn2.

           CALL FUNCTION 'BAPI_EMPATTABS_GETLIST'

             EXPORTING

               from_date       = wa_zhr_leareq-vac_strdt

               to_date         = wa_zhr_leareq-vac_enddt

             TABLES

               hrtimesrec_list = lt_hrtimesrec_list

               return          = lt_bapireturn2.

           IF lt_hrtimesrec_list IS NOT INITIAL.

             lv_pernr = wa_zhr_leareq-reqby.

             READ TABLE lt_hrtimesrec_list INTO wa_hrtimesrec_list

                                           WITH KEY employeenumber = lv_pernr

                                                    rectype = wa_zhr_leareq-reqtype

                                                    from_date = wa_zhr_leareq-vac_strdt

                                                    to_date = wa_zhr_leareq-vac_enddt.

           ENDIF.

           IF wa_hrtimesrec_list IS NOT INITIAL.

* Passing the Logiscal System and Document Number(Key)

             wa_hrtimeskey-logicalsystem = wa_hrtimesrec_list-logicalsystem.

             wa_hrtimeskey-documentnumber = wa_hrtimesrec_list-documentnumber.

* Passing Modification dates

             wa_hrabsatt_in-from_date = wa_leareq_upd-begda.

             wa_hrabsatt_in-to_date   = wa_leareq_upd-endda.

             CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

               EXPORTING

                 number = lv_pernr

               IMPORTING

                 return = wa_bapireturn1.

             IF wa_bapireturn1 IS INITIAL.

               CLEARwa_bapireturn1.

               REFRESH lt_bapireturn2.

               CALL FUNCTION 'BAPI_PTMGRATTABS_MNGCHANGE'

                 EXPORTING

                   hrtimeskey  = wa_hrtimeskey

                   hrabsatt_in = wa_hrabsatt_in

                 TABLES

                   return      = lt_bapireturn2.

               CLEAR lv_flag_err.

               LOOP AT lt_bapireturn2 INTO wa_bapireturn2.

                 CLEAR wa_output.

                 wa_output-pernr = wa_leareq_upd-pernr.

                 wa_output-awart = wa_leareq_upd-awart.

                 CLEAR wa_t554t.

                 READ TABLE it_t554t INTO wa_t554t WITH KEY awart = wa_leareq_upd-awart.

                 wa_output-atext = wa_t554t-atext.

                 wa_output-begda = wa_leareq_upd-begda.

                 wa_output-endda = wa_leareq_upd-endda.

                 wa_output-mtype = wa_bapireturn2-type.

                 wa_output-id    = wa_bapireturn2-id.

                 wa_output-number = wa_bapireturn2-number.

                 wa_output-message = wa_bapireturn2-message.

                 IF wa_bapireturn2-type = 'E'.

                   lv_flag_err = 'X'.

                 ENDIF.

                 CLEAR wa_bapireturn2.

                 APPEND wa_output TO lt_output.

               ENDLOOP.

               IF lv_flag_err NE'X'.

                 IF p_tr NE 'X'.

                   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

                   wa_leareq_upd-final_sta = 'X'.

                   MODIFY zhr_leareq_upd FROM wa_leareq_upd.

                 ENDIF.

               ENDIF.


For Delete


CALL FUNCTION 'BAPI_EMPATTABS_GETLIST'

             EXPORTING

               from_date       = wa_leareq_upd-begda

               to_date         = wa_leareq_upd-endda

             TABLES

               hrtimesrec_list = lt_hrtimesrec_list

               return          = lt_bapireturn2.

           IF lt_hrtimesrec_list IS NOT INITIAL.

             lv_pernr = wa_leareq_upd-pernr.

             READ TABLE lt_hrtimesrec_list INTO wa_hrtimesrec_list

                                           WITH KEY employeenumber = lv_pernr

                                                    rectype = wa_leareq_upd-awart

                                                    from_date = wa_leareq_upd-begda

                                                    to_date = wa_leareq_upd-endda.

           ENDIF.

           IF wa_hrtimesrec_list IS NOT INITIAL.

* Passing the Logiscal System and Document Number(Key)

             wa_hrtimeskey-logicalsystem = wa_hrtimesrec_list-logicalsystem.

             wa_hrtimeskey-documentnumber = wa_hrtimesrec_list-documentnumber.

* Passing Modification dates

             wa_hrabsatt_in-from_date = wa_leareq_upd-begda.

             wa_hrabsatt_in-to_date   = wa_leareq_upd-endda.

             CLEAR lv_pernr.

             CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

               EXPORTING

                 number = lv_pernr

               IMPORTING

                 return = wa_bapireturn1.

             IF wa_bapireturn1 IS INITIAL.

               CLEAR wa_bapireturn1.

               REFRESH lt_bapireturn2.

               CALL FUNCTION 'BAPI_PTMGRATTABS_MNGDELETE'

                 EXPORTING

                   hrtimeskey  = wa_hrtimeskey

                   simulate    = ''

                   hrabsatt_in = wa_hrabsatt_in

                 TABLES

                   return      = lt_bapireturn2.

               CLEAR lv_flag_err.

               LOOP AT lt_bapireturn2 INTO wa_bapireturn2.

                 CLEAR wa_output.

                 wa_output-pernr = wa_leareq_upd-pernr.

                 wa_output-awart = wa_leareq_upd-awart.

                 CLEAR wa_t554t.

                 READ TABLE it_t554t INTO wa_t554t WITH KEY awart = wa_leareq_upd-awart.

                 wa_output-atext = wa_t554t-atext.

                 wa_output-begda = wa_leareq_upd-begda.

                 wa_output-endda = wa_leareq_upd-endda.

                 wa_output-mtype = wa_bapireturn2-type.

                 wa_output-id    = wa_bapireturn2-id.

                 wa_output-number = wa_bapireturn2-number.

                 wa_output-message = wa_bapireturn2-message.

                 IF wa_bapireturn2-type = 'E'.

                   lv_flag_err = 'X'.

                 ENDIF.

                 CLEAR wa_bapireturn2.

                 APPEND wa_output TO lt_output.

               ENDLOOP.

               IF lv_flag_err NE'X'.

                 IF p_tr NE 'X'.

                   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

                   wa_leareq_upd-final_sta = 'X'.

                   MODIFY zhr_leareq_upd FROM wa_leareq_upd.

                 ENDIF.

               ENDIF.



Regards,

Shaik Farooq

Former Member
0 Kudos

Hi Farooq,

I think your coding is fine but I was asleep.

There is a speciality with Infotype 2001 and 2002:

- If you will change a dataset and the change includes key fields (like BEGDA and/or ENDDA) the system expects not a change

- The system expects a delete and after the delete the insert of the "new" (changed) dataset

Please try this

Regards

Joerg

farooq_basha
Active Participant
0 Kudos

Hi Joerg,

Please correct me if my understanding is wrong with above explanation.

You mean to say I need to Delete record and go for New record creation for CHANGE(i.e., Modification) of existing leave.

Regards,

Farooq

Former Member
0 Kudos

Hi Farooq,

yes.

Instead of changing the dataset you have to delete it and insert a new one with new e. g. BEGDA and/or ENDDA.

The system has the same behavior when you maintain the data via SAP Gui. You can't change datasets key fields.

Regards

Joerg