Creating an Infotype Record 0019 using HR_INFOTYPE_OPERATION

All,
I have written a little test application for this, my code is below, and there is something funny happening. For some reason when I run the program for the first time it creates the 0019 infotype but it doesn't add on the additional text. However if I run the program again, without doing anything else, the text does get updated.
It appears that I am missing a commit statement or something along those lines but I am not sure.
I would appreciate any help on getting this working
Many Thanks,
Colm
DATA t0019 TYPE TABLE OF p0019.
DATA w0019 TYPE p0019.
DATA in_pernr TYPE prelp-pernr.
in_pernr = '02000305'.
BREAK-POINT.
CALL FUNCTION 'HR_READ_INFOTYPE'
  EXPORTING
*   TCLAS                 = 'A'
    pernr                 = in_pernr
    infty                 = '0019'
   begda                 = '18000101'
   endda                 = '99991231'
*   BYPASS_BUFFER         = ' '
*   LEGACY_MODE           = ' '
* IMPORTING
*   SUBRC                 =
  TABLES
    infty_tab             = t0019
EXCEPTIONS
   infty_not_found       = 1
   OTHERS                = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
BREAK-POINT.
DATA in_infty TYPE prelp-infty VALUE 0019.
DATA in_subty TYPE p0001-subty VALUE 02.
DATA wa_return1 TYPE bapireturn1.
DATA wa_pakey TYPE bapipakey.
DATA wa_pskey TYPE pskey.
DATA l_pgmid TYPE old_prog.
DATA it_text TYPE hrpad_text_tab.
DATA wa_text TYPE hrpad_text.
wa_text = 'Line 1'.
APPEND wa_text TO it_text.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
  EXPORTING
    number = in_pernr
  IMPORTING
    return = wa_return1.
IF NOT wa_return1 IS INITIAL.
*ERROR MESSAGE
ENDIF.
w0019-pernr = in_pernr.
w0019-subty = '02'.
w0019-infty = '0019'.
w0019-endda = '20081204'.
w0019-begda = '20081204'.
w0019-seqnr = '000'.
w0019-aedtm = sy-datum."CREATED DATE
w0019-uname = sy-uname.
w0019-itxex = 'X'.
w0019-tmart = '02'. "TASK TYPE
w0019-termn = '20081204'. "DATE OF TASK
w0019-mndat = '20081203'. "REMINDER DATE
w0019-tmjhr = '2008'. "DATE OF TASK YEAR
w0019-tmmon = '12'. "DATE OF TASK MONTH
w0019-tmtag = '04'. "DATE OF TASK DAY
w0019-mnjhr = '2008'. "REMINDER DATE YEAR
w0019-mnmon = '12'. "REMINDER DATE MONTH
w0019-mntag = '03'. "REMINDER DATE DAY
BREAK-POINT.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING
    infty         = '0019'
    number        = in_pernr
    subtype       = '02'
    validityend   = sy-datum
    validitybegin = sy-datum
    record        = w0019
    operation     = 'INS'
  IMPORTING
    return        = wa_return1
    key           = wa_pakey
  EXCEPTIONS
    OTHERS        = 0.
IF NOT wa_return1 IS INITIAL.
*ERROR HANDLING
ELSE.
*SUCCESS
  wa_pskey-pernr = wa_pakey-employeeno.
  wa_pskey-infty = '0019'.
  wa_pskey-subty = wa_pakey-subtype.
  wa_pskey-objps = wa_pakey-objectid.
  wa_pskey-sprps = wa_pakey-lockindic.
  wa_pskey-endda = wa_pakey-validend.
  wa_pskey-begda = wa_pakey-validbegin.
  wa_pskey-seqnr = wa_pakey-recordnr.
  l_pgmid = 'SAPFP50P'.
  BREAK-POINT.
  TRY.
    CALL METHOD cl_hrpa_text_cluster=>update
      EXPORTING
        tclas         = 'A'
        pskey         = wa_pskey
        histo         = 'X'
        uname         = sy-uname
        aedtm         = sy-datum
        pgmid         = l_pgmid
        text_tab      = it_text
        no_auth_check = 'X'.
  ENDTRY.
  IF sy-subrc EQ 0.
*SUCCESS
  ENDIF.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
  EXPORTING
    number = in_pernr
  IMPORTING
    return = wa_return1.
BREAK-POINT.

[url]HR_INFOTYPE_OPERATION is not working in user exit ZXPADU02[url]
If you do this and then update the text using the update task it should work perfectly.

Similar Messages

  • Problem in creating 0027 infotype record in background

    Hi Experts,
    I am facing the problem in creating 27(Costs distribution) infotype record in back ground.
    Whenever there is a change in position of the employee or when we hire a new employee (Through PA40)
    i have to ctreate 0027 infotype record in background.For that i am using IN_UPDATE method of BADI
    HRPAD00INFTY.
    Here i am getting 2 problems.
    1. I am unable to get the latest positions that is assigned to the employee.
       Through NEW_IM AGE structure we can get the latest position but if a person is assigned to multiple   positions for the same period then i am getting only one position from NEW_IM AGE but not all.can any body help me?
    2. I am calling HR_INFOTYPE_OPERATION FM to create the IT0027 record in background in the above method (IN_UPDATE). but it is not updating the PA0027 table. any idea?
    Full points will be rewarded.
    Regards,
    Sai.

    I am sending a sample program , which is on infotype 0105 (communication). I hope that this program will help u out............
    REPORT ZSAPHR_SAMP.
    tables: pa0105.
    infotypes: 0105.
    DATA : I_RETURN TYPE BAPIRETURN1,
    I_KEY TYPE BAPIPAKEY,
    PERNR TYPE P0001-PERNR,
    I_P0105 TYPE TABLE OF P0105 WITH HEADER LINE,
    ENDDA TYPE P0105-ENDDA,
    BEGDA TYPE P0105-BEGDA.
    MOVE '00000010' TO PERNR.
    BEGDA = SY-DATUM + 1.
    ENDDA = SY-DATUM + 1.
    i_p0105-pernr = PERNR.
    i_p0105-infty = '0105'.
    i_p0105-subty = '0002'.
    i_p0105-endda = ENDDA.
    i_p0105-begda = BEGDA.
    I_P0105-USRTY = '0002'.
    I_P0105-USRID = '[email protected]'.
    APPEND i_p0105.
    CALL FUNCTION 'DEQUEUE_ALL' .
    CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
    EXPORTING
    NUMBER = PERNR.
    IF SY-SUBRC = 0.
    WRITE 'Employee Locked Successfully'.
    ENDIF.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
    INFTY = '0105'
    NUMBER = PERNR
    SUBTYPE = '0002'
    VALIDITYEND = BEGDA
    VALIDITYBEGIN = ENDDA
    RECORD = i_p0105
    OPERATION = 'INS'
    TCLAS = 'A'
    DIALOG_MODE = '0'
    NOCOMMIT = 'X'
    IMPORTING
    RETURN = I_RETURN
    KEY = I_KEY.
    IF SY-SUBRC = 0.
    WRITE : 'FM returns sy-subrc 0'.
    ENDIF.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
    EXPORTING

  • CREATE/UPDATE Infotype Records

    Hi,
    Am using the following code to insert records into InfoType PA0001 ,its not creating a new record and giving this Dump ....Any suggestion or Examples on this Please ...
    Dump :
    The source field is too short.                                                             
    In the running program "SAPLHRMM" a field should have been assigned to a field             
    symbol, which is shorter than the type of the field symbol.                                
    This is not possible.                                                                      
    It is a statement of the form ASSIGN f TO <fs> CASTING...                                  
    or ASSIGN f TO <fs> with a field symbol that was created with the                          
    STRUCTURE addition.                                                                        
    *******************my code *************************
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(EMPNO) TYPE  PERSNO
      DATA: RETURN LIKE BAPIRETURN1.
      DATA: P0001 TYPE P0001.
      CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
        EXPORTING
          NUMBER = EMPNO
        IMPORTING
          RETURN = RETURN.
      IF NOT RETURN IS INITIAL.
        WRITE: / EMPNO, 'Enqueue failed'.
        EXIT.
      ENDIF.
      DATA: WA_PA0001 TYPE PA0001.
      SELECT SINGLE * FROM PA0001 INTO WA_PA0001
            WHERE PERNR = EMPNO
            AND   ENDDA = '99991231'.
    WA_PA0001-ENDDA = '20090422'.
    *CHANGE THE EXISTING RECORD FROM PA0001.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
      EXPORTING
        INFTY                  = '0001'
        NUMBER                 = EMPNO
       SUBTYPE                = WA_PA0001-SUBTY
      OBJECTID               =
      LOCKINDICATOR          =
        VALIDITYEND            = WA_PA0001-ENDDA
        VALIDITYBEGIN          = WA_PA0001-BEGDA
        RECORDNUMBER           = '01'
        RECORD                 = WA_PA0001
        OPERATION              = 'INS'
      TCLAS                  = 'A'
        DIALOG_MODE            = '0'
        NOCOMMIT               = '1'
      VIEW_IDENTIFIER        =
      SECONDARY_RECORD       =
    IMPORTING
       RETURN                 = RETURN
      KEY                    =
    IF return-id NE space.
        WRITE: /   EMPNO,
                20 'Create was unsuccessful',
                    return-id,
                    return-message+0(40).
      ELSE.
        WRITE: /   EMPNO,
                20 'Create was successful',
                    return-id,
                    return-message+0(40).
      ENDIF.
    CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
      EXPORTING
        NUMBER        =  EMPNO
    IMPORTING
       RETURN         = RETURN
    Thanks,
    Kumar

    Hi,
    Correct this
    Operation should be 'MOD'
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
    INFTY = '0001'
    NUMBER = EMPNO
    SUBTYPE = WA_PA0001-SUBTY
    OBJECTID =
    LOCKINDICATOR =
    VALIDITYEND = WA_PA0001-ENDDA
    VALIDITYBEGIN = WA_PA0001-BEGDA
    RECORDNUMBER = '01'
    RECORD = WA_PA0001
    OPERATION = 'MOD'              "Correct this
    TCLAS = 'A'
    DIALOG_MODE = '0'
    NOCOMMIT = '1'
    VIEW_IDENTIFIER =
    SECONDARY_RECORD =
    IMPORTING
    RETURN = RETURN
    KEY =
    Regards
    Krishna
    Edited by: Krishna Gowrneni on Apr 22, 2009 6:21 PM
    Edited by: Krishna Gowrneni on Apr 22, 2009 6:22 PM

  • About to use HR_INFOTYPE_OPERATION to create customer infotype issue:

    hi
    i want to create infotype use function(HR_INFOTYPE_OPERATION).
    this infotype is customer infotype.
    the first scenario is:
      i'm be sure no data about one employee in this infotype(9004).
      to call with data upload function and put data into internal table IT_PA9004.
      and the table data as follow:
    one line: it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080201' , it_pa9004-endda = '20080930'
              it_pa9004-zzvalue = 50 (customer field).
    two line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080201' , it_pa9004-endda = '20080930'
              it_pa9004-zzvalue = 60 (customer field).
    three line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'
              it_pa9004-zzvalue = 70 (customer field).
    four line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'
              it_pa9004-zzvalue = 80 (customer field).
    i run the programme and get information is:
    11022887 insert ok.
    11022887 insert ok.
    11022887 insert ok.
    11022887 insert ok.
    but i use the transation PA30 to view all data:
    in database just exist one row:
    four line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'
              it_pa9004-zzvalue = 80 (customer field).
    the second scenario is:
    in database the infotype have exist one row:
               pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',
               pa9004-begda = '20080318' , pa9004-endda = '20080318'
               pa9004-zzvalue = X (customer field).
    and i create another row:
    line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',
              it_pa9004-begda = '20080318' , it_pa9004-endda = '99991231'
              it_pa9004-zzvalue = 80 (customer field)
    i run the programme and get information is:
    11022887 insert ok.
    the three scenario is:
        set  HR_INFOTYPE_OPERATION of import parameter operation = 'MOD'
        in any scenario will get error :not exist subtype .
    what heppend about HR_INFOTYPE_OPERATION working,i had to use this function to
       create other infotype of SAP owner.
       and will create successfully.
    so i thank it may be config Constraints about customer infotype.
    is time Constraints effect?
    so i want to how to check it?
    and if i want to create one infotype for customer using PM01 what some thing
    must be taken into account.
    think you advance.
    partial source code as follow:
    FORM ACTION_INSERT .
      DATA: P_FLAG TYPE C.
      DATA: WA_LOG LIKE LINE OF DATA_LOG.
      DATA: PP_ACTION TYPE PSPAR-ACTIO.
      LOOP AT IT_PA9004.
        CLEAR P_FLAG.
        CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.
        PERFORM lock_employee USING IT_PA9004-pernr CHANGING P_FLAG.
        PP_ACTION = IT_PA9004-ACTION.
        PERFORM HR_INFOTYPE_OPERATION USING IT_PA9004 PP_ACTION CHANGING P_FLAG.
        IF P_FLAG IS INITIAL.
          if test_run = space.
            COMMIT WORK.
          else.
            ROLLBACK WORK.
          endif.
          write:/ it_pa9004-pernr,'insert ok'.
        ELSE.
          ROLLBACK WORK.
          write:/ it_pa9004-pernr,'error'.
        ENDIF.
        PERFORM unlock_employee USING IT_PA9004-pernr .
      ENDLOOP.
    ENDFORM.                    " ACTION_INSERT
    FORM LOCK_EMPLOYEE  USING    P_PERNR
                        CHANGING PP_FLAG.
      CHECK PP_FLAG IS INITIAL.
      CLEAR P_RETURN.
      CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
        EXPORTING
          number = P_PERNR
        IMPORTING
          return = P_RETURN
        EXCEPTIONS
          OTHERS = 01.
      CALL FUNCTION 'HR_INITIALIZE_BUFFER'
        EXPORTING
          pernr = P_PERNR.
      IF P_RETURN IS NOT INITIAL.
        PP_FLAG = '1'.
      ENDIF.
    ENDFORM.                    " LOCK_EMPLOYEE
    FORM HR_INFOTYPE_OPERATION  USING    P_PA9004 LIKE IT_PA9004
                                         P_ACTION type PSPAR-ACTIO
                                CHANGING PP_FLAG.
      CHECK PP_FLAG  IS INITIAL.
      DATA: bapipakey type bapipakey,
            P_SUBTY TYPE P9004-SUBTY,
            PP_9004 TYPE TABLE OF  P9004 WITH HEADER LINE.
      CLEAR P_RETURN.
      REFRESH PP_9004.
      MOVE-CORRESPONDING P_PA9004 TO PP_9004.
      IF P_ACTION = 'INS'.
        PP_9004-AEDTM = SY-DATUM.
        PP_9004-UNAME = SY-UNAME.
      ENDIF.
      IF P_ACTION = 'MOD'.
        PP_9004-AEDTM = SY-DATUM.
        PP_9004-UNAME = SY-UNAME.
      ENDIF.
      APPEND PP_9004.
      P_SUBTY = P_LGART.
      CALL FUNCTION 'HR_INFOTYPE_OPERATION'
        EXPORTING
          infty         = '9004'
         subtype       = 'FQ03'
          subtype       = P_SUBTY
          number        = PP_9004-pernr
          validityend   = PP_9004-ENDDA
          validitybegin = PP_9004-begda
         RECORDNUMBER  = pp_9004-seqnr
          record        = PP_9004
           operation     = 'INS'
         operation     = P_ACTION
          nocommit      = 'X'
        IMPORTING
          return        = P_RETURN
          key           = bapipakey
        EXCEPTIONS
          OTHERS        = 0.
      IF P_RETURN IS NOT INITIAL.
        PP_FLAG = '9'.
      ENDIF.
    ENDFORM.                    " HR_INFOTYPE_OPERATION
    FORM UNLOCK_EMPLOYEE  USING    P_PERNR.
      CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
        EXPORTING
          number = p_pernr
        IMPORTING
          return = P_RETURN
        EXCEPTIONS
          OTHERS = 01.
    ENDFORM.                    " UNLOCK_EMPLOYEE

    hi
    i want to create infotype use function(HR_INFOTYPE_OPERATION).
    this infotype is customer infotype.
    the first scenario is:
      i'm be sure no data about one employee in this infotype(9004).
      to call with data upload function and put data into internal table IT_PA9004.
      and the table data as follow:
    one line: it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080201' , it_pa9004-endda = '20080930'
              it_pa9004-zzvalue = 50 (customer field).
    two line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080201' , it_pa9004-endda = '20080930'
              it_pa9004-zzvalue = 60 (customer field).
    three line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'
              it_pa9004-zzvalue = 70 (customer field).
    four line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'
              it_pa9004-zzvalue = 80 (customer field).
    i run the programme and get information is:
    11022887 insert ok.
    11022887 insert ok.
    11022887 insert ok.
    11022887 insert ok.
    but i use the transation PA30 to view all data:
    in database just exist one row:
    four line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ03',
              it_pa9004-begda = '20080101' , it_pa9004-endda = '20081031'
              it_pa9004-zzvalue = 80 (customer field).
    the second scenario is:
    in database the infotype have exist one row:
               pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',
               pa9004-begda = '20080318' , pa9004-endda = '20080318'
               pa9004-zzvalue = X (customer field).
    and i create another row:
    line:it_pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',
              it_pa9004-begda = '20080318' , it_pa9004-endda = '99991231'
              it_pa9004-zzvalue = 80 (customer field)
    i run the programme and get information is:
    11022887 insert ok.
    but in database just exist the first data
               pa9004-pernr = '11022887' ,it_pa9004-subty = 'FQ02',
               pa9004-begda = '20080318' , pa9004-endda = '20080318'
               pa9004-zzvalue = X (customer field).
    the three scenario is:
        set  HR_INFOTYPE_OPERATION of import parameter operation = 'MOD'
        in any scenario will get error :not exist subtype .
    what heppend about HR_INFOTYPE_OPERATION working,i had to use this function to
       create other infotype of SAP owner.
       and will create successfully.
    so i thank it may be config Constraints about customer infotype.
    is time Constraints effect?
    so i want to how to check it?
    and if i want to create one infotype for customer using PM01 what some thing
    must be taken into account.
    think you advance.
    partial source code as follow:
    FORM ACTION_INSERT .
      DATA: P_FLAG TYPE C.
      DATA: WA_LOG LIKE LINE OF DATA_LOG.
      DATA: PP_ACTION TYPE PSPAR-ACTIO.
      LOOP AT IT_PA9004.
        CLEAR P_FLAG.
        CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.
        PERFORM lock_employee USING IT_PA9004-pernr CHANGING P_FLAG.
        PP_ACTION = IT_PA9004-ACTION.
        PERFORM HR_INFOTYPE_OPERATION USING IT_PA9004 PP_ACTION CHANGING P_FLAG.
        IF P_FLAG IS INITIAL.
          if test_run = space.
            COMMIT WORK.
          else.
            ROLLBACK WORK.
          endif.
          write:/ it_pa9004-pernr,'insert ok'.
        ELSE.
          ROLLBACK WORK.
          write:/ it_pa9004-pernr,'error'.
        ENDIF.
        PERFORM unlock_employee USING IT_PA9004-pernr .
      ENDLOOP.
    ENDFORM.                    " ACTION_INSERT
    FORM LOCK_EMPLOYEE  USING    P_PERNR
                        CHANGING PP_FLAG.
      CHECK PP_FLAG IS INITIAL.
      CLEAR P_RETURN.
      CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
        EXPORTING
          number = P_PERNR
        IMPORTING
          return = P_RETURN
        EXCEPTIONS
          OTHERS = 01.
      CALL FUNCTION 'HR_INITIALIZE_BUFFER'
        EXPORTING
          pernr = P_PERNR.
      IF P_RETURN IS NOT INITIAL.
        PP_FLAG = '1'.
      ENDIF.
    ENDFORM.                    " LOCK_EMPLOYEE
    FORM HR_INFOTYPE_OPERATION  USING    P_PA9004 LIKE IT_PA9004
                                         P_ACTION type PSPAR-ACTIO
                                CHANGING PP_FLAG.
      CHECK PP_FLAG  IS INITIAL.
      DATA: bapipakey type bapipakey,
            P_SUBTY TYPE P9004-SUBTY,
            PP_9004 TYPE TABLE OF  P9004 WITH HEADER LINE.
      CLEAR P_RETURN.
      REFRESH PP_9004.
      MOVE-CORRESPONDING P_PA9004 TO PP_9004.
      IF P_ACTION = 'INS'.
        PP_9004-AEDTM = SY-DATUM.
        PP_9004-UNAME = SY-UNAME.
      ENDIF.
      IF P_ACTION = 'MOD'.
        PP_9004-AEDTM = SY-DATUM.
        PP_9004-UNAME = SY-UNAME.
      ENDIF.
      APPEND PP_9004.
      P_SUBTY = P_LGART.
      CALL FUNCTION 'HR_INFOTYPE_OPERATION'
        EXPORTING
          infty         = '9004'
         subtype       = 'FQ03'
          subtype       = P_SUBTY
          number        = PP_9004-pernr
          validityend   = PP_9004-ENDDA
          validitybegin = PP_9004-begda
         RECORDNUMBER  = pp_9004-seqnr
          record        = PP_9004
           operation     = 'INS'
         operation     = P_ACTION
          nocommit      = 'X'
        IMPORTING
          return        = P_RETURN
          key           = bapipakey
        EXCEPTIONS
          OTHERS        = 0.
      IF P_RETURN IS NOT INITIAL.
        PP_FLAG = '9'.
      ENDIF.
    ENDFORM.                    " HR_INFOTYPE_OPERATION
    FORM UNLOCK_EMPLOYEE  USING    P_PERNR.
      CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
        EXPORTING
          number = p_pernr
        IMPORTING
          return = P_RETURN
        EXCEPTIONS
          OTHERS = 01.
    ENDFORM.                    " UNLOCK_EMPLOYEE

  • Infotype record create, edit

    Hi All,
    Can anybody tell me the steps involved in creating, editing employee;'s own infotype records through WD ABAP view.
    I have infotype (IT0057) record which need to be displayed, create, edit. We are also supposed to attach a custom workflow template with this application so that whenever employee updates, creates his own record - a workflow item will be triggered and sent to concern person for approval.
    We have designed the customer workflow template for the same. Please tell me the steps to display, create, update infotype record through WD View.
    Regards,
    Anil Kumar

    Hi,
    If you want to perform some additional logic on these buttons then the standard buttons on the ALV cannot be used.
    You need to have your own buttons and provide coding or you can also use the Normal TABLE UI element.
    At first i'm explaining the process for TABLE UI element.
    First,
    Design the context node in the component controller for that table of contents with the apt columns.
    Map this node to the view1.
    Now, In the view1,
    Create the TABLE UI element and using CREATE BINDING option bind it to this node, while doing this
    select the apt type of UI element for each column( I mean if there are any columns for Inputfield/drodpdown etc).
    and also you can design the buttons ADD, EDIT,DELETE and implement the actions.
    After designing this, try to display the data by reading that infottype and fill the context node by using
    the BIND_TABLE of if_wd_context_node.
    By default for the table, one row is selected(lead selection). If you want mutltiple ones then use the option
    Leadselection(Multi).
    The BAPI you specified is for the save/update the infotype.
    Now you can start of with this information...Once this is done I can help you out..for further process.
    Regards,
    Lekha.

  • Adding read infotype records to payroll

    Dear ,
    i 've used the code mentioned in this link to read the infotype records .
    Use SAP defined methods instead of Logical Database(LDB)
    now i want to add this record to the tree in the payroll . could u plz tell me how to add it to a node in the additional payment tree node.
    Edited by: Kathy_Adam on May 22, 2010 3:40 PM

    Hi,
    1. Create new payroll function code in payroll driver exist. Starts with FU<custom name>.
    2. Create new function via PE04 with custome name.
    3. Add custom function to payroll schema.
    Custom name should start with special character, e.g. %, &, :, etc.
    User exit is special for every country driver, check payroll driver program and figure out its name.
    Cheers

  • Create PD Infotype link to Object USER

    Dear Experts,
    I have created a custom PD Infotype P9032, under Object "User'. But when i go to Expert Mode to create the infotype record, it screen brings me to "Su01" screen ie. create SAP user instead.
    If i change the Object to "Organizational Unit" and create the infotype record, it shows me the correct custom infotype screen.
    How do i link my custom PD infotype to Object User? ... i have done the necessary updating of table T777I.
    Thanks so much,
    Zul

    Hi Dusan,
    perhaps the following steps will help you.
    1. calls se11
    2. mark radiobutton in front of Data type
    3. fill data type with HRI9003
    4. goto menu [Utilities] and select [Environment Analysis]
    This will display all objects i hope also the 3 missed. From there
    you could mark it and delete it.
    Hope this helps.
    Regards
    Bernd

  • Maintaining / Displaying Text for Infotype record

    Hi,
    How do we maintain infotype text for the record. Or how to display the text maintained for infotype record (I used PA20/PA30 for IT0001 record but could not locate infotype text).
    Regards,
    Avinash Josalkar.

    Hi,
    If you want to know the text of a infotype then goto the table
    V_T582A.
    eg:0000  actions
    0001 organisation assignment.
    But if you want to change the standard text of a infotype then you need to have access key to change.
    But if you are asking the text table for the fields in 0001.
    then goto se11
    enter Pa0001--dislay
    click the tab entry help/check then you can see the table names in the column check table for each field.

  • How to create IT0128 subtype-02 record using HR_INFOTYPE_OPERATION

    Hi All,
    Can anyone suggest how to use HR_INFOTYPE_OPERATION to create/insert a record in IT0128 for an employee from an ABAP program.
    Some background:::
    Note that the field - "Short Title" which is mandatory in this Infotype. And it uses a Q-structure for its processing. Also it stores this field using a combination of text object, text id, language and text name.
             Text object = HRMESS
             Text id  =  HR_P
    Goto SE16 of an employee and check PA0128, you will notice above fields. The actual value is stored somewhere in system memory using a combination of above 4 fields.
    When i try using my program, it gives me an error "Make an entry in all required fields" (so not able to find how/what should i pass for field "Short Title").  Can anyone suggest how should i use HR_INFOTYPE_OPERATION to create an IT0128 record for subtype 02.
    Appreciate any help asap!!
    Best Regards,
    Abbasi Sadikot
    PS: Please dont post your reply if you dont have any idea of what this is.

    Hi
    HR_INFOTYPE_OPERATION -> calls -> HR_MAINTAIN_MASTERDATA -> this Func. Mod. then creates a batch and calls ->
    -> IF DIALOG_MODE EQ '0'.
    ->    CALL DIALOG 'HR_MAINTAIN_MASTER_DATA' USING BDCDATA MODE 'N'
    ->         EXPORTING
    the SY-SUBRC value after this should be zero. But it isn't. Can anybody suggest something. Or have any idea as what could be going wrong ??
    Here is my program by which i am trying to create IT0128 subtype-02:
    REPORT  ZABTWTEST                                 .
    data: it0128 like p0128 occurs 0 with header line.
    data: return like BAPIRETURN1.
    it0128-pernr = '20123001'.
    it0128-subty = '2'.
    it0128-begda = '20090101'.
    it0128-endda = '20090131'.
    it0128-SPRSL = 'EN'.
    it0128-OBJCT = 'HRMESS'.
    it0128-TXTID = 'HR_P'.
    it0128-OBNAM = '<internally assigned name>'.
    append it0128.
    CALL FUNCTION 'BAPI_EMPLOYEET_ENQUEUE'
      EXPORTING
        number              = '20123001'
        validitybegin       = '19000101'   .
    loop at it0128.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
      EXPORTING
        infty                  = '0128'
        number                 = '20123001'
        VALIDITYEND            = it0128-endda
        VALIDITYBEGIN          = it0128-begda
        record                 = it0128
        operation              = 'COP'
        TCLAS                  = 'A'
        NOCOMMIT               = 'X'
      IMPORTING
        RETURN                 = return   .
    endloop.
    CALL FUNCTION 'BAPI_EMPLOYEET_DEQUEUE'
      EXPORTING
        number              = '20123001'
        validitybegin       = '19000101'   .
    write return.   .
    Kindly correct me if i am wrong anywhere.
    Regards,
    Abbasi

  • Create a new record in pa0001 infotype using hr_infotype_opeation.......

    Hi All,
    i am inserting a new record in infotype pa0001 using hr_infotype_operation....
    at the time system give the shortdumps
    "The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X)."
    please any one to give the solution....
    thank
    mahi

    You need to use two BAPIs one before and one after 'HR_INFOTYPE_OPERATION',like this :
    'BAPI_EMPLOYEE_ENQUEUE'
    'HR_INFOTYPE_OPERATION'
    'BAPI_EMPLOYEE_DEQUEUE'
    Reward IF Found Helpful.

  • Creating / Updating Custom Infotype Records

    Hello everbody,
    We implement alot of custom HR infotypes in our system, both PA &  HRP.
    For the past several we have been using BDC (Batch-Input) recorded functions in order to update / create the records in our infotypes.
    We're currently facing an upcoming ECC upgrade , and I would like to lead a change that will eventually lead to us using generic SAP supplied functions.
    I've researched a few functions that might do the trick:
    RH_INSERT_INFTY:
    This one is giving me an SY-SUBRC 2 error code - Insert error, I tried to select a current record and insert it as different objid but this doesnt work.
    HR_INFOTYPE_OPERATION:
    I've read of several people that recommended using this function, but it is not released by SAP and I couldnt get it to work as well.
    BAPI_HRMASTER_SAVE_REPL_MULT:
    This one seems to work for sap infotypes but I dont think it suits custom infotypes.
    What is the "official" way of doing such operations?
    thanks in advance,
    Eli.

    Hello Dilak,
    Im currently trying to insert a new infotype record of infotype HRP9226.
    First I call function RH_GET_NEXT_NUMBER to get an objid.
    then I fill an HRP9226 line.
    after this i call the function:
    call function 'RH_INSERT_INFTY'
    exporting
    FCODE = 'INSE'
    vtask = 'S'
    ORDER_FLG = 'X'
    COMMIT_FLG = 'X'
    AUTHY = ' '
    PPPAR_IMP =
    OLD_TABNR = ' '
    REPID = ' '
    FORM = ' '
    KEEP_LUPD =
    WORKF_ACTV = 'X'
    tables
    innnn = hrp9226_line
    ILFCODE =
    EXCEPTIONS
    NO_AUTHORIZATION = 1
    ERROR_DURING_INSERT = 2
    REPID_FORM_INITIAL = 3
    CORR_EXIT = 4
    BEGDA_GREATER_ENDDA = 5
    OTHERS = 6
    I'm getting an "Error_During_Insert" and Im out of options regarding what I can possibly do.

  • HR_INFOTYPE_OPERATION - Need help w/Deleting infotype records

    Hello all,
    We have an issue where infotype records got created where the ENDDA is less than the BEGDA (ENDDA = 06/30/2006 and BEGDA = 07/01/2006).  We are trying to delete these using HR_INFOTYPE_OPERATION but we are getting message PG-009 (No data stored for 9001 in the selected period) returned in our tests. 
    BTW, 9001 is one of our customer infotypes. 
    I know I can remove these records using a direct SQL statement, but I would prefer to remove them more gracefully if possible.  Is there a way around this error?  I actually think function module HR_READ_INFOTYPE is raising the error.
    Any suggestions would be greatly appreciated.
    Thanks,
    Al

    You can check report RHRHDC00, I think it can help you with custom infotype too.
    Otherwise you might need to delete the records forcefully using DELETE statement, which is not suggested since all the  standard FM consider BEGDA and ENDDA and in your case they will always return blank.
    You can also check FM -
    HR_ECM_DELETE_INFOTYPE
    Regards,
    Amit
    Reward all helpful replies.

  • How to UPDATE MASTER DATA RECORD PA0377 using FM HR_INFOTYPE_OPERATION

    How to UPDATE MASTER DATA RECORD IN INFOTYPE 0377 DIRECTLY using function module HR_INFOTYPE_OPERATION ? When i use operation = 'MOD'  im getting an ERROR as NO DATA STORED FOR 0377 IN SELECTION PERIOD.
           Can anyone please help me how to use HR_INFOTYPE_OPERATION to UPDATE MASTER DATA RECORD.
    Thanks,
    Karthi.

    Hi,
    please check this code
    it is very useful
    infotypes: 0105.
    parameters: p_pernr type p0105-pernr,
                p_subty type p0105-subty,
                p_begda type p0105-begda,
                p_endda type p0105-endda,
                p_opera type pspar-actio,
                p_usrid type p0105-usrid,
                p_commt as checkbox.    "Useful only when NO_COMMIT is 'X'
    data: w_return type bapireturn1,    "Error handling data
          w_key type bapipakey,         "If record has been created or changed the created/ changed
                                        "record's key (PSKEY) will be populated
          v_message type string.        "For printing returned messages
    call function 'BAPI_EMPLOYEE_ENQUEUE'
      exporting
        number = p_pernr
      importing
        return = w_return.
    if w_return is initial. "Employee is not locked
      p0105-pernr = p_pernr.
      p0105-subty =
      p0105-usrty = p_subty.
      p0105-begda = p_begda.
      p0105-endda = p_endda.
      p0105-usrid = p_usrid.
    *Calls Internally HR_MAINTAIN_MASTERDATA
      call function 'HR_INFOTYPE_OPERATION'
        exporting
          infty         = '0105'
          number        = p_pernr
          subtype       = p_subty
          validityend   = p_endda
          validitybegin = p_begda
          record        = p0105
          operation     = p_opera
          dialog_mode   = '0'
          nocommit      = 'X'
        importing
          return        = w_return
          key           = w_key.
    endif.
    if w_return is not initial.
      message id w_return-id type w_return-type number w_return-number
              with w_return-message_v1 w_return-message_v2 w_return-message_v3
              w_return-message_v4 into v_message.
      case w_return-type.
        when 'A' or 'E'.
          format color col_negative. write:/ v_message.
        when others.
          format color col_heading. write:/ v_message.
      endcase.
      call function 'BAPI_EMPLOYEE_DEQUEUE'
        exporting
          number = p_pernr.
    else.
      format color col_positive. write:/ 'Record Updated Successfully.'.
      if w_key is not initial.
        write:/ 'Key contains',
              / 'Personnel Number:', w_key-employeeno,
              / 'Subtype (absence type):', w_key-subtype,
              / 'Start date of Absence:', w_key-validbegin,
              / 'End date of Absence:', w_key-validend.
      endif.
      commit work.
    endif.
    Thanks and regards
    durga.K

  • Updating infotype 0041 using HR_INFOTYPE_OPERATION?

    Hi All:
    How do we update the dates in infotype 0041 using HR_INFOTYPE_OPERATION? lets say we have 6 dates populated in 41  and we another employee has 9 dates populated. We are reading these records and need to update the dates for all the employee records.
    Thanks
    Venkata

    Hi Venkata,
    What you can do is use the HR_INFOTYPE_OPERATION in Change or MOD(Modify) mode i.e.
    pass 'MOD' in operation parameter.
    Your recordnumber parameter should have the sequence number from infotype record you are updating (field SEQNR). All other parameters should be as it is had been for INS or insert operation.
    Regards.

  • Problem in changing end date of PA-Infotype using HR_INFOTYPE_OPERATIONS .

    Hi All,
    I am trying to change the end date of an active record in an infotype using HR_INFOTYPE_OPERATIONS FM. But am getting an error, 'Infotype does not exist'.
    I am using operation as 'MOD' and passing appropriate parameters as required.
    it would be great if someone can help me out to understand, why could that error be coming?

    Hi Santosh,
    With this FM you cannot change the enddate as enddate is a key field and used to determine the exact record in the database.
    Why don't you use PA30 to change end date of an infotype record?
    Or else delete the row first w. HR_INFOTYPE_OPERATION DEL and insert it again with INS operation and new end date.
    Regards,
    Dilek
    Edited by: Dilek Ersoz Adak on Jan 8, 2010 7:54 AM

Maybe you are looking for