cancel
Showing results for 
Search instead for 
Did you mean: 

How to update infotype record from web dynpro abap?

Former Member
0 Kudos

Hi experts,

In web dynpro leave application screen, i m entering staring date and lev end date. based on that it will calculate next resuming date..

so my problem is i m updating the resuming date in PA9005 table with function module ' HR_INFOTYPE_OPERATION '.

I need to update only the act_resum field. can u guide me what are the values i need to pass to the above FM?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Ramana,

I hope you are trying to modify existing infotype record. May be below code is usefule for you.

first you need read the existing infotype record which you want to modify (old image). and same record modfiy with with the values you want modify and pass same structure to FM HR_INFOTYPE _OPERATION as showed below.

   call function 'HR_READ_INFOTYPE'
            exporting
*             TCLAS           = 'A'
              pernr           = iv_pernr
              infty           = '0002'
            tables
              infty_tab       = lt_p0002
            exceptions
              infty_not_found = 1
              others          = 2.
          if sy-subrc <> 0.
*--->Implement suitable error handling here
          endif.

          read table lt_p0002 assigning <fs_p0002> with key endda hr_high_date.
          if sy-subrc = 0.
            ls_record = <fs_p0002>.
            if <fs_p0002>-vorna ne iv_vorna or <fs_p0002>-nachn ne iv_nachn .

              validitybegin   = <fs_p0002>-begda.
              validityend     = <fs_p0002>-endda.
              ls_record-seqnr = <fs_p0002>-seqnr.
              ls_record-vorna = iv_vorna.
              ls_record-nachn = iv_nachn.
              ls_record-begda = <fs_p0002>-begda.
              ls_record-endda = <fs_p0002>-endda.
              ls_record-subty = <fs_p0002>-subty.
              ls_record-pernr = <fs_p0002>-pernr.
              ls_record-objps = <fs_p0002>-objps.
              ls_record-sprps = <fs_p0002>-sprps.
c_change = 'MOD'
*---> Change infotype 0002
              call function 'HR_INFOTYPE_OPERATION'
                exporting
                  infty         = '0002'
                  subtype       = ls_record-subty
                  objectid      = ls_record-objps
                  number        = ls_record-pernr     "employeenumber
                  validityend   = validityend
                  validitybegin = validitybegin
                  record        = ls_record
                  recordnumber  = ls_record-seqnr
                  operation     = c_change
                  nocommit      = abap_true
                  dialog_mode   = '0'
                importing
                  return        = ls_ret_0002
                  key           = personaldatakey
                exceptions
                  others        = 0.

regards

Srini

Former Member
0 Kudos

Thanku Srinivas,

I did the same.. finally got it...

Thank u

Ramana

Answers (1)

Answers (1)

former_member199126
Participant
0 Kudos

You need to pass INFTY,NUMBER,RECORD and OPERATION. Rest is optional .

Let me say you an easy way, Go SE37 , Give the FM name you want to use, press (CTRL+SHIFT+F3), which will give you a where used list. You can see how that FM is implimented.

You can tr the same in your code..

Former Member
0 Kudos

Hi karthik,

i m passing infty, number, record, operation but it is not getting updated... for record i created a structure with type p9005..in this i m passing some act_resum value. but i m not getting the other values to be passed..

Can u guide me with sample code

Thanks

Ramana

former_member199126
Participant
0 Kudos

For Record import parameter of the FM , I guess you should create it as a INFOTYPE.

chengalarayulu
Active Contributor
0 Kudos

Hi Ramana,

which operation you are performing?

Former Member
0 Kudos

Hi karthik,

For begda and endda which values should i pass? either employee begda, endda or leave begining date and enddate..

I m getting confused here

Thanks

Ramana

former_member199126
Participant
0 Kudos

Try passing the leave start and end date. Please go through the FM fully and read the documentation(Ctrl+F4).

former_member199125
Active Contributor
0 Kudos

Ramana,

updating infotype using HR_INFOTYPE_OPERATION will need many values , main sequence number,begda, endda, and you have to pass the infotype structure values.... and in operation  you have to use UPD. I can not write every parameter here.

check below link. it will help you.

http://www.se80.co.uk/sapfms/h/hr_i/hr_infotype_operation.htm

http://www.sapdev.co.uk/fmodules/fms_HR_INFOTYPE_OPERATION.htm

Regards

Srinivas