Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issue while creating IT0081 using HR_INFOTYPE_OPERATION

meenakshi-btp
Explorer
0 Likes
1,124

Hello Experts,

While I try to create a record in IT0081 using FM HR_INFOTYPE_OPERATION, all data flows correctly to IT0081 screen except Unit (P0081-WDEIN) and rank (P0081-WDGRD).

Here is the sample code I created:

report zmtest.

data: ls_p0081 type p0081,

         ls_return type bapireturn1.

ls_p0081-pernr = '12345'.     " Hardcode PERNR vale here

ls_p0081-subty = '01'.

ls_p0081-objps = '01'.

ls_p0081-begda = '20140701'.

ls_p0081-endda = '99991231'.

ls_p0081-wdgrd = '003'.

ls_p0081-wdart = '01'.

ls_p0081-wderd = '20140515'.

ls_p0081-wdein = 'Test'.

ls_p0081-wdpfl = 'X'.

clear: ls_return.

call function 'BAPI_EMPLOYEET_ENQUEUE'

   exporting

     number        = '12345'

     validitybegin = '20140701'

   importing

     return        = ls_return.

call function 'HR_INFOTYPE_OPERATION'

   exporting

     infty            = '0081'

     number           = '12345'

     subtype          = '01'

*   OBJECTID         =

*   LOCKINDICATOR    =

     validityend      = '99991231'

     validitybegin    = '20140701'

*   RECORDNUMBER     =

     record           = ls_p0081

     operation        = 'INS'

     tclas            = 'A'

     dialog_mode      = '2'

*   NOCOMMIT         =

*   VIEW_IDENTIFIER  =

*   SECONDARY_RECORD =

   importing

     return           = ls_return

*   KEY              =

   .

write: ls_return.


Please suggest !!

1 ACCEPTED SOLUTION
Read only

meenakshi-btp
Explorer
0 Likes
1,031

Hi All,

I found the cause. This is how the infotype behaves. In the Infotype modulepool, the following piece of code is clearing Unit (P0081-WDEIN) and Rank (P0081-WDGRD) for all actions other than COPY.

if psyst-ioper ne copy and psyst-massn is initial.     "note 708768

  clear: p0081-wdein, p0081-wdgrd.

endif.

Hi All,

I found the cause. This is how the infotype behaves. In the Infotype modulepool, the following piece of code is clearing Unit (P0081-WDEIN) and Rank (P0081-WDGRD) for all actions other than COPY.

if psyst-ioper ne copy and psyst-massn is initial.     "note 708768

  clear: p0081-wdein, p0081-wdgrd.

endif.

3 REPLIES 3
Read only

krishna_k19
Contributor
0 Likes
1,031

Hi Meenakshi,

    The record type is mismatched.

Please go through the FM definition you get some information.

Actually the record type is like  PSHDR , in this structure there is no what you mentioned variables so ,please cross check once and verify.

Regards,

Krishna

Read only

0 Likes
1,031

Thanks for the reply Krishna but I don't think there is a type mismatch. I am using P structure and all P structures have PSHDR included. I have updated many other infotypes in the same program using the same approach and it works fine. For 0081 also I am not getting any error. Just that data for 2 mentioned fields is not flowing from program to Infotype.

Read only

meenakshi-btp
Explorer
0 Likes
1,032

Hi All,

I found the cause. This is how the infotype behaves. In the Infotype modulepool, the following piece of code is clearing Unit (P0081-WDEIN) and Rank (P0081-WDGRD) for all actions other than COPY.

if psyst-ioper ne copy and psyst-massn is initial.     "note 708768

  clear: p0081-wdein, p0081-wdgrd.

endif.