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: 

Infotype 0008 & User Exit

amit_khare
Active Contributor
0 Kudos

Hi,

I am trying to default value for wagetype & TRFAR and TRFGB in user exit Include ZXPADU01 (before output).

But INNNN does not contain any information except PERNR and Dates inside the user exit.

But on PA30/PA40 screen I can see default values for TRFAR, TRFGB & LGA01, LGA02, etc.

I have already done the code for user exit so that is not the issue but values itself are not available.

Am I missing some place to check?

Please advise.

Regards,

Amit

1 ACCEPTED SOLUTION

former_member184569
Active Contributor
0 Kudos

Hi

INNN is a generic structure and hence will not contain infotype specific information like trfgb, trfar, bet01, lga01 etc. To access these fields, you need to cast them the innn structure to specific infotype structure as mentioned above.

To default values, pass values to the infotype structure and  cast it back to the generic structure using the reverse of the above method.


CASE innnn-infty.

when '0008'.

*--Cast generic structure to specific structure

CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
       EXPORTING
         prelp = innnn
       IMPORTING
         pnnnn = v_0008.

      v_0008-trfar =

      v_0008-trfgb =

     v_0008-lga01 =

    v_0008-bet01 =

etc ( I guess you must have already done this)

*--Cast specific structure to generic structure
     CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
       EXPORTING
         pnnnn = v_0008
       IMPORTING
         prelp = innnn.

You will get your values defaulted.

If you want to get the already existing values of these fields, when you will obviously be in edit mode, then you need to implement the BADI HRPAD00INFTY which will be triggered on editing any infotype.

13 REPLIES 13

Former Member
0 Kudos

Declare a structure of type P0008.

Call the below method.

      CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
      EXPORTING
        prelp = innnn
      IMPORTING
        pnnnn = ls_0008.

You will get all the required field values in ls_0008.

0 Kudos

Hitesh,

Thats what I mentioend, it only returning PERNR, BEGDA & ENDDA.

0 Kudos

Hi Amit,

    As suggested by Hitesh structure LS_0008 going to have fields TRFAR and TRFGB. As you have mentioned you want to default it. You need to pass the values to these fields to populate as default.

CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
      EXPORTING
        prelp = innnn
      IMPORTING
        pnnnn = LS_0008.

LS_0008-TRFAR = 'X'.

LS_0008-TRFGB = 'Y'.

cl_hr_pnnnn_type_cast=>pnnnn_to_prelp(
                EXPORTING
                  pnnnn  = LS_0008
                IMPORTING
                  prelp  = innnn

                     ).

Cheers

0 Kudos

Hi Amit,

    Pls go thru the below suggestion given by Susmitha in details or try to explore INNNN-DATA1.

Cheers

former_member184569
Active Contributor
0 Kudos

Hi

INNN is a generic structure and hence will not contain infotype specific information like trfgb, trfar, bet01, lga01 etc. To access these fields, you need to cast them the innn structure to specific infotype structure as mentioned above.

To default values, pass values to the infotype structure and  cast it back to the generic structure using the reverse of the above method.


CASE innnn-infty.

when '0008'.

*--Cast generic structure to specific structure

CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
       EXPORTING
         prelp = innnn
       IMPORTING
         pnnnn = v_0008.

      v_0008-trfar =

      v_0008-trfgb =

     v_0008-lga01 =

    v_0008-bet01 =

etc ( I guess you must have already done this)

*--Cast specific structure to generic structure
     CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
       EXPORTING
         pnnnn = v_0008
       IMPORTING
         prelp = innnn.

You will get your values defaulted.

If you want to get the already existing values of these fields, when you will obviously be in edit mode, then you need to implement the BADI HRPAD00INFTY which will be triggered on editing any infotype.

0 Kudos

Susmitha,

As mentioned when I am doing

CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnn , I am only getting PERNR and none of the other fields.

I am aware about the conditions to handle the user exit.

0 Kudos

Hi Amit,

You must have triggered this when creating the info type. So what other information other than pernr do you have to be retrieved ? There is no other information available for the screen before creating hence, you will not get any thing else. What other information are you expecting to get when you are calling the method while creating the infotype?

But you can pass data to the screen using this method and the reverse of this method.

Once again, as I had written above, if you are talking about editing an infotype, when information is already there, then there is a question of getting other information besides pernr. In such a case, as I had mentioned above, ZXPADU01 may not be triggered in edit mode and you may have to use the BADI HRPAD00INFTY to access the data.

0 Kudos

Hi ,

I am facing the  problem.

calculated all values but in display mode it is not reflecting the calculated value ..

i m trying to use your code :

>     if sy-ucomm ne 'UPD' and sy-ucomm ne 'UPDL'.

>       show_data_again = 'X'.

>     endif.

but still not getting.



AFTER CALCULATING IT IS SHOWING VALUE IN CHANGE MODE..

BUT AGAIN WHEN WE DISPLAY IT IS NOT REFLECTING..

.

need to display

1spl wage type(bet06) and total amount (sumbb)

please guide....

Sougata
Active Contributor
0 Kudos

Amit,

I think you need to implement the Classic BAdI HRPAD00INFTY then use this to convert it into a Kernel BAdI / Enhancement Spot BAdI.

The PBO FM of the enhancement PBAS0001 will only be called by system on INS (Create) mode and COP (Copy) mode. The INNNN is not populated in your case because it is simply not called by the system when you are in MOD (Change) mode.

Cheers,

Sougata.

amit_khare
Active Contributor
0 Kudos

Sougata,

I am calling the code while creating the infotype.

Regards,

Amit

Sougata
Active Contributor
0 Kudos

Of course you will be if you are in the Create mode.

So you have PERNR, BEGDA and ENDDA in the INNNN structure....

Say you want to default TRFGR to "Salary".

Why don't you do it like below in ZXPADU01

CASE innnn-infty.
   WHEN `0008`.
   DATA: ls_p0008 TYPE p0008.

   cl_hr_pnnnn_type_cast=>prelp_to_pnnnn(
         EXPORTING
           prelp = innnn
         IMPORTING
           pnnnn = ls_p0008 ).

   ls_p0008-trfgr = |SALARY|.

   cl_hr_pnnnn_type_cast=>pnnnn_to_prelp(
        EXPORTING
           pnnnn  = ls_p0008
        IMPORTING
           prelp  = innnn ).

   WHEN OTHERS.
ENDCASE.

Cheers,

Sougata.

Sougata
Active Contributor
0 Kudos

Actually don't use the BAdI HRPAD00INFTY as you are trying to default values to the screen. You won't be able to do this with that BAdI because all parameters of the method BEFORE_OUTPUT are IMPORTING.

Cheers,

Sougata.

amit_khare
Active Contributor
0 Kudos

my issue is  not TRFAR, TRFGB  but LGA01, LGA02 as they are not showing any wage types.

I am able to figure out that wage tye are populating via fetaure LGMST so they are not part here.