cancel
Showing results for 
Search instead for 
Did you mean: 

HR Table Update

Former Member
0 Kudos

Hi SAP Gurus,

Should we update PA00.. tables directly using 'Update table...' directly..or we need to use Logical database for it.

Is there any harm in updating dirctly....?

Thanks in advance,

Gaurav

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Serdar Simsekler & Malgorzata Jaworek ,

Your Replies have been quite helpfull.Full points to U both.

I feel this forum is like a heaven to ABAPers like me..

Thnaks for all the inputs.

Happy New Year .

Gaurav

ssimsekler
Active Contributor
0 Kudos

Hi Gaurav

As Malgorzata stated, you should use the FM 'HR_INFOTYPE_OPERATION' to do personnel (PA) infotype operations. For organization part (PD), you can use 'RH_INSERT_INFTY' and other relevant FMs for deleting and updating.

Here is an example and some information that I wrote before about the subject:


DATA ls_data LIKE p0015 .
DATA ls_return LIKE bapireturn1 .

*--Fill "ls_data" as required here
*- Be careful about the checks that will be done during 
* execution of the function module. The checks it will 
*do, will be more or less like when you insert the
*record using the tcode "PA30". e.g. you must fill
*obligatory fields
CALL FUNCTION 'ENQUEUE_EPPRELE'
  EXPORTING mode_prel = 'E'
            mandt = sy-mandt
            pernr = ls_data-pernr
            infty = '0015'
            subty = '1650'
            endda = ls_data-endda
            begda = ls_data-begda
            _scope = '1'
  EXCEPTIONS
            foreign_lock = 1
            system_failure = 2
            OTHERS = 3.
IF sy-subrc NE 0 .
*...
EXIT.
ENDIF.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING infty = '0015'
            number = ls_data-pernr
            subtype = ls_data-subty
            validityend = ls_data-endda
            validitybegin = ls_data-begda
            record = ls_data
            operation = 'INS'
            tclas = 'A'
            nocommit = space
  IMPORTING
            return = ls_return .

CALL FUNCTION 'DEQUEUE_EPPRELE'
  EXPORTING mode_prel = 'E'
            mandt = sy-mandt
            pernr = ls_data-pernr
            infty = '0015'
            subty = '1650'
            endda = ls_data-endda
            begda = ls_data-begda.

<u><b>Some Basics:</b></u>

i. You may wonder why I locked the personel but as far as I remember, there is a problem in the FM "HR_INFOTYPE_OPERATION" about this. Locking the personel overcomes the problem. But it may have been solved. So, if you want first try without locking explicitly.

ii. The FM calls the dialog module for the program MPXXXX00 (XXXX: Infotype number, here MP001500) of the infotype.

iii. "ls_data" which is passed to the parameter "record" should be type "PXXXX" (here P0015).

iv. If the infotype has subtypes, pass the subtype you want ( in our case 1650) to the parameter "subtype" .

v. You must give the validity period to the parameters "validityend" and "validitybegin".

vi. The operation type you need is "INS" if you want to insert an infotype record. You can see other values from the fixed values of the domain of the parameter "operation".

vii. Since some infotypes are common for both employee an applicants data, you should pass 'A' to the parameter "tclas". This way the record is inserted to the table PAXXXX. In case of 'B', it behaves your record as to be an applicant data.

viii. You have the option to force the FM not to commit at the end.

ix. The exporting parameter "return" of the FM is of type "BAPIRETURN1". That is, it can be used like other BAPI returns. You can analyze the result of the execution from this table.

Best Regards...

*--Serdar

MalaGo
Explorer
0 Kudos

Hi,

you can use function module HR_INFOTYPE_OPERATION to update HR tables.Using direct UPADTE ... is not recommended because no checks are caried.

Best regards,

Malgorzata