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.
Showing results for 
Search instead for 
Did you mean: 

HRPAD00INFTY - delimit subtypes

Former Member
0 Kudos

Hello Fellow Users,

We are using infotype 0057 to store some Union Codes. The requirement is to delimit the records by subtypes.

i.e, when a new record for a new subtype is created in IT0057, the previous record should be delimited.

Since this cannot be done by configuration for Infotype 0057, I have implemented the method IF_EX_HRPAD00INFTY~AFTER_INPUT of BADI HRPAD00INFTY.

So in the BADI, I am checking if there is any record which is active as of the new record start date, if yes, then delimit that record - i.e change ENDDA = NEW_BEGDA-1. Update existing record in IT0057 and create new record with new dates.

Here is the code that I have written. When I use this code in a report program, the previous infotype record is correctly picked up and delimited.

But in the BADI, the current record does not get updated.

In debugging I have noticed that the BADI is called twice, once with new PA0057 values that I am trying to create and then with the existing PA0057 values saved in the infotype.

So that means my changes are not being written to the database. Do I need to do this operation IN_UPDATE?

When I tried to create a session breakpoint IN_UPDATE, it doesnt get triggered.

What is the issue?

   *-- Adding time constraints to subtypes --*
  DATA: wa_0071  TYPE pa0071,
        wa_0057  TYPE pa0057,
        wa_p0057 TYPE p0057,
        wa_p0071 TYPE p0071,
        lv_begda TYPE pa0071-begda,
        lv_endda TYPE pa0071-endda.

  DATA : return  TYPE  bapireturn1,
         key     TYPE  bapipakey.

  CLEAR : lv_begda, lv_endda.
  IF new_innnn-infty = '0057' AND ipsyst-ioper NE 'DEL'.

    SELECT SINGLE * FROM pa0057 INTO wa_0057
      WHERE pernr = new_innnn-pernr  AND
            begda LE new_innnn-begda AND
            endda GE new_innnn-begda AND
            subty NE new_innnn-subty.

    IF sy-subrc = 0.
      MESSAGE ID 'PG' TYPE 'W' NUMBER 204 WITH wa_0057-begda wa_0057-endda.

      IF ipsyst-ioper EQ 'COP' OR ipsyst-ioper EQ 'INS'.
        MOVE-CORRESPONDING wa_0057 TO wa_p0057.
        wa_p0057-infty = '0057'.
        lv_endda = new_innnn-begda - 1.

            number = wa_0057-pernr.

            infty         = '0057'
            number        = wa_0057-pernr
            subtype       = wa_0057-subty
            validityend   = wa_0057-endda
            validitybegin = wa_0057-begda
            recordnumber  = wa_0057-seqnr
            record        = wa_p0057
            operation     = 'MOD'
            nocommit      = ' '
            tclas         = 'A'
            dialog_mode   = '0'
            return        = return
            key           = key.

            number = wa_0057-pernr.


Former Member
0 Kudos

Just in case someone is looking as to how this was resolved - the above functionality could not be met as the info-type characteristics do not allow to make the above type of change.

instead in the info-type user exit, I added a check which displayed an error to there were multiple records with same subtype in the same time period.