Application Development 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: 

How to convert data for secondary infotype

Former Member
0 Kudos

Hi all,

Please let me know if it is possible to convert data from PRELP structure to secondary infotype.

My issue is when I create data in Infotype 0006, there is a secondary infotype 3366 to which the data should be stored. The screen fields for Infotype 3366 are present along with 0006, but the data is not getting stored in 3366. I have existing validation in user exit due to which the problem is happening. When screen data is converted to infotype data using  Method cl_hr_pnnnn_type_cast=>prelp_to_pnnnn, only the data of primary infotype (i.e 0006) is getting converted. When I use the same method to convert data to infotype 3366, the data is not getting converted. So is it possible to read data using Method cl_hr_pnnnn_type_cast=>prelp_to_pnnnn.

Thanks

Jayanth.

3 REPLIES 3

former_member201275
Active Contributor
0 Kudos

Normally you would use this, for example, in the User Exit ZXPADU01. Here you would first test which infotype you are dealing with and then update as necessary. For example, below I test that we are working with infotype 0002, then make some amendments to it and update again i.e:

if ipsyst-iinit = yes    and
   i001p
-molga  = 'HU'   and
   innnn
-infty  = '0002' and
  ipsyst
-ioper = insert.

 
call method cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
   
exporting
      prelp
= innnn
   
importing
      pnnnn
= ls_p0002.

  ls_p0002
-natio = 'HU'.
  ls_p0002
-gblnd = 'HU'.
  ls_p0002
-knznm = '00'.
  ls_p0002
-sprsl = 'W'.

 
call method cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
   
exporting
      pnnnn
= ls_p0002
   
importing
      prelp
= innnn.
endif.

If you are working with infotype 0006, then the only way to read infotype 3366 would be to use a function e.g. HR_READ_INFOTYPE.

0 Kudos

Hi Glen,

Thanks for your response.

The data will not be available at this point in infotype 3366, so reading it will not help. Also the issue is the data is not getting stored in 3366.

Thanks

Jayanth

0 Kudos

Hello,

I had the same problem and I found solution. Try to define another type for ls_p0002. Somethink like this:

DATA: BEGIN OF ls_p0002.
INCLUDE STRUCTURE p0002.
INCLUDE STRUCTURE ps3366.
DATA: END OF ls_p0002.

Best regards

Piotrek