Function for deleting and modifying Infotype 2011 : HR_TMW_DB_UPDATE_TEVENT

Hello experts,
we have and requirement where we have to insert/delete or modify specific clock in/out posts from infotype 2011. Looking trough this forum I was not able to find how to delete or modify specific events from SAP correctly.
We are able to insert new record via FM : HR_INFOTYPE_OPERATION with ease, but can not use the same function module to either delete or modify the same record.
I was able to find FM: HR_TMW_DB_UPDATE_TEVENT and tried it in combination with HR_TMW_DB_READ_TEVENT, with out any succes.
My question is: in what way must the tables be filled for deletion or modification, for FM HR_TMW_DB_UPDATE_TEVENT to work?
With testing deleting a record, function explicitly demands taht all four tables are set
         del_teven      = t_teven_del
         ins_teven      = t_teven_ind
         del_teven_more = t_teven_more_del
         ins_teven_more = t_teven_more_ins 
, but still the record is not deleted form table TEVEN.
Thank you in advance for any given anwsers,
Matevž

Hello Rajesh,
the code goes:
* get original data:
    CALL FUNCTION 'HR_TMW_DB_READ_TEVENT'
      EXPORTING
        pernr    = iv_pernr
        fromdate = iv_begda
        todate   = iv_endda
      IMPORTING
        result   = result_tmw.
* get next seq. nr.:
CALL FUNCTION 'NUMBER_GET_NEXT'
  EXPORTING
    nr_range_nr                   = lv_ragne
    object                        = lv_object
IMPORTING
   NUMBER                        = lv_number
EXCEPTIONS
   INTERVAL_NOT_FOUND            = 1
   NUMBER_RANGE_NOT_INTERN       = 2
   OBJECT_NOT_FOUND              = 3
   QUANTITY_IS_0                 = 4
   QUANTITY_IS_NOT_1             = 5
   INTERVAL_OVERFLOW             = 6
   BUFFER_OVERFLOW               = 7
   OTHERS                        = 8.
      LOOP AT result_tmw INTO s_result_tmw.
        s_teven = s_result_tmw-teven.
        IF s_teven-ldate = iv_ldate AND s_teven-ltime = iv_ltime AND s_teven-satza = iv_satza.
          "set TEVEN_DEL tables for reading
          APPEND s_teven TO t_teven_del.
          APPEND s_teven_more TO t_teven_more_del.
          "set status for change to TEVEN_INS tables
          s_teven-pdsnr = lv_number.
          s_teven-ldate = iv_ldate.
          s_teven-ltime = iv_ltime.    
          s_teven-satza = iv_satza.
          APPEND s_teven TO t_teven_ins.
          MOVE-CORRESPONDING s_teven TO s_teven_more.
          APPEND s_teven_more TO t_teven_more_ins.
          EXIT.
        ENDIF.
      ENDLOOP.
* execute deletion of current record:
      CALL FUNCTION 'HR_TMW_DB_UPDATE_TEVENT'
        TABLES
          del_teven      = t_teven_del
          ins_teven      = t_teven_ins
          del_teven_more = t_teven_more_del
          ins_teven_more = t_teven_more_ins
        EXCEPTIONS
          insert_failed  = 1
          update_failed  = 2
          OTHERS         = 3.
      COMMIT WORK.
Now I am using the following code, that is working:
* get original data:
    CALL FUNCTION 'HR_TMW_DB_READ_TEVENT'
      EXPORTING
        pernr    = iv_pernr
        fromdate = iv_begda
        todate   = iv_endda
      IMPORTING
        result   = result_tmw.
********************************************************************** modification
* CODE :                            MODIFY CLOCK IN/OUT
    IF iv_operation = 'MOD'.
      LOOP AT result_tmw INTO s_result_tmw.
        s_teven = s_result_tmw-teven.
        IF s_teven-ldate = iv_ldate AND s_teven-ltime = iv_ltime AND s_teven-satza = iv_satza.
          "set TEVEN_DEL tables for reading
          APPEND s_teven TO t_teven_del.
          APPEND s_teven_more TO t_teven_more_del.
          "set status for change to TEVEN_INS tables
          APPEND s_teven TO t_teven_ins.
          MOVE-CORRESPONDING s_teven TO s_teven_more.
          APPEND s_teven_more TO t_teven_more_ins.
          EXIT.
        ENDIF.
      ENDLOOP.
* execute deletion of current record:
      CALL FUNCTION 'HR_TMW_DB_UPDATE_TEVENT'
        TABLES
          del_teven      = t_teven_del
          ins_teven      = t_teven_ins
          del_teven_more = t_teven_more_del
          ins_teven_more = t_teven_more_ins
        EXCEPTIONS
          insert_failed  = 1
          update_failed  = 2
          OTHERS         = 3.
      COMMIT WORK.
* insert new (updated) record of clock registration:
      s_p2011-pernr = iv_pernr.
      s_p2011-infty = '2011'.
      s_p2011-ldate = iv_ldate_new.
      s_p2011-ltime = iv_ltime_new.
      s_p2011-erdat = sy-datum.
      s_p2011-ertim = sy-uzeit.
      s_p2011-satza = iv_satza_new.
      s_p2011-origf = 'E'.
      s_p2011-begda = iv_ldate.
      s_p2011-endda = iv_ldate.
      CALL FUNCTION 'HR_INFOTYPE_OPERATION'
        EXPORTING
          infty            = '2011'
          number           = iv_pernr
*         SUBTYPE          =
*         OBJECTID         =
*         LOCKINDICATOR    =
          validityend      = iv_begda
          validitybegin    = iv_endda
          recordnumber     = f_recordnumber
          record           = s_p2011
          operation        = 'INS'                       
          tclas            = 'A'
          dialog_mode      = '0'
*         NOCOMMIT         =
*         VIEW_IDENTIFIER  =
*         SECONDARY_RECORD =
        IMPORTING
          return           = fm_return
          key              = personaldatakey.
      COMMIT WORK.
ENDIF.
Kind regards,
Matevž

Similar Messages

  • ABAP Routine for Deleting and creating index for ODS in Process chains

    Any pointers for the ABAP Routine code for deleting and creating index for ODS in Process chains.

    Hi Sachin,
    find the following ABAP code to delete ODS ondex.
    data : v_ods type RSDODSOBJECT.
    move 'ODSname' to v_ods .
    CALL FUNCTION 'RSSM_PROCESS_ODS_DROP_INDEXES'
      EXPORTING
        I_ODS = v_ods.
    To create index:
    data : v_ods type RSDODSOBJECT.
    move 'ODSname' to v_ods .
    CALL FUNCTION 'RSSM_PROCESS_ODS_CREA_INDEXES'
      EXPORTING
        I_ODS = v_ods.
    hope it helps....
    regards,
    Raju

  • How to Use the language function for assignment and validation

    Hi All,
    If anyone can explain me in details with example ,how to use the language function for assignments and validations?
    Thanks
    Arnab

    Hi Arnab,
    The expression is checked only for the current MDM session.
    If u login with the ABC language it will always show the ABC language no matter how many times u execute it.
    Try connecting to the DM with the XYZ language.
    It should go to the if part rather than else.
    Hope it helps.
    Thanks,
    Minaz

  • BAPI functions for FB60 and F-02

    Hi,
        Can any one please tell me the BAPI functions for FB60 and F-02 tcodes.
        I had searched in forum,but din't solved my purpose.
    Thanks.
    Sri
    Moderator message - Search harder. Maybe Google will help - post locked
    Edited by: Rob Burbank on May 8, 2010 6:25 PM

    This has been solved for FB50. The original variant for FB50 had never beer created in our QAS system! So I was able to get the screen variant menu selections to reappear by running SHD0, editing, and then saving the transaction variant 'STANDARD 1' (not sure if that is SAP's name for the default variant).
    Hope others find this information useful.
    J. Haynes
    Denver, CO

  • How to connect, add delete and modify sqllite data base.

    dear friends,
    i am developing a stand alone project, in that i want to
    store the datas in the local machine using sql lite. Iam new to
    Flex. i know air and flash very well.. any body can help me, how to
    connect, add, delete and modify the data in sql lite. i want to
    store users option in local machine.. i got struct up. i have to
    finish my project...pls..
    thanks and Regards,
    Syed Abdul Rahim

    Hi,
    Please find details on how to access SQL Lite database from
    AIR applications at the URL below.
    http://livedocs.adobe.com/flex/3/html/SQL_01.html
    Hope this helps.

  • Mark for deletion and Discontinuation difference?

    Hello,
    What is the difference between using MM17 and WSE4 for an article. I understand that using MM17 i can mark the article for deletion and by using WSE4 i would make the article to be discontinued. But when we run the archiving program will the article be removed from the system in both the cases?
    Thanks,
    Anju.

    Hi Anju,
         Marked for Deletion :
    When you mark an article for deletion,the following consequences occur
    1)The listing conditions ared deleted
    2)The Article master record remains valid
    3)Stock may be available
    4)You can sell the article
    5)You can't place any orders on this article
    Discontinuation of Article :
    When you discontinue any article,the following consequences occur
    1)Article master data is deleted from the database itself
    2)Purchasing info records are deleted
    4)Listing conditions are also deleted
    Hope it helps.
    Rgds,
    Aram.

  • Can not delete and modify events

    Sun Java System Calendar Server 6 2005Q4 (built Jul 21 2005)
    I have created a new event in my calendar but I can not delete and modify event.
    Everyone on this system have same problem.
    How do I do ?
    Regards,
    JO.

    I did not see any errors in log directory.
    # showrev -p | grep ics5
    Patch: 116577-24 Obsoletes: 117706-08 Requires: Incompatibles: Packages: SUNWics5, SUNWica5
    Patch: 117860-16 Obsoletes: Requires: Incompatibles: Packages: SUNWics5, SUNWica5
    Patch: 118186-16 Obsoletes: Requires: Incompatibles: Packages: SUNWics5, SUNWica5
    # ./csdb check
    Checking the database health condition.
    Please be patient, this may take a while...
    Start by scanning components db...
    Scanning events database...
    102 events scanned
    102 events copied
    Scanning todos database...
    10 todos scanned
    10 todos copied
    Scanning deletelog database...
    14 deletelog entries scanned
    Scanning gse database...
    0 gse entries scanned
    Scanning recurring database...
    0 recurring entries scanned
    Successful components db scan
    Now starting calprops db scan...
    Scanning calprops database to uncover events...
    326 calendars scanned
    Scanning calprops database to uncover todos...
    finished...
    Calendar database consistency check completed successfully
    Regards,
    JO.

  • Authorization OBject for Delete and Lock indicator in PO function.

    Hiii
    I'm using sap 5.0. I'm notice that we can set the authorization object to control the user from make a action for delete/Lock indicator in purchase order so that we can prevent the 'unpredictable user' from do the deletion on item PO item.
    it also help me to authorize the selected user to perform delete or lock action.

    Hi,
    To prevent deletion or locking in specifically may not be controlled thro authorisation but changing the PO can be controlled.For this the authorisation objects M_BEST_BSA, M_BEST_EKG,M_BEST_EKO,M_BEST_WRK  may be looked into .Here against Activity there is option like create,change ,delete,print etc which if suitably assigned can restrict the users for certain activity.Try with your basis team in this objects.
    Dhruba

  • Delete and modify orgs from Load from File

    Hi,
    I created my organizations with the Configure > Import File option, but how can i delete or modify organizations in a same way.
    Thanks,

    In that case Do i need to write the entire contents of my file to a hash table(sumthng like this) and modify the Second row in my case with the new values..
    is it possible??I would have done like this (though there maybe better methods)
    1- create a class representing the record.
    class Record{
          String field1;
          String field2;
          String field3;
          // and so on....
          //setters
          public void setFeild1(String str){
              field1=str;
          // and so on....
          //getters
          public String getFeild1(){
              field1=str;
          // and so on....
          public String toString(){
               return(field1+"||"+field2+"||"+field3);
    }//end class2- then create an ArrayList meant to have objects of this class (Generics).
    3- read from the file , create a new Record Object and add that to the ArrayList
    4- perform operations on the ArrayList (you can add new records, and delete record, update......)
    5- write the record back to file using 'toString()' method.
    is there ne sample code available for thisdon't know, but you rarely get full code on forums.....outline given can be followed
    Thanks!
    Edit: It appears that 'r035198x' and me have the same point. This shows that this methodology is almost a standard way( if we ignore the Random access files.....)
    Edited by: T.B.M on Jan 13, 2009 2:39 PM

  • Functionality for Select and Save layout in a report output

    Hi,
    I had developed a report program containing several fields in the output and requires the Functionality for Select layout and Save layout in a report output.
    Please suggest.
    Thanks,
    Shariq.

    While calling the FM for List Display ( "REUSE_ALV_LIST_DISPLAY" or "REUSE_ALV_GRID_DISPLAY" ) set the Parameter I_SAVE for Setting the Layout and Selecting a different Layouts.
    The possible values for I_SAVE are "A", "U", "X" or others. Depending on the requiement you can set different values for the Parameter I_SAVE.
    ' ' = display variants cannot be saved
    Defined display variants (e.g. delivered display variants) can be selected for presentation independently of this flag.
    Changes can not be saved.
    'X' = standard save
    Display variants can be saved as standard display variants.
    User-specific saving is not possible.
    'U' = only user-specific saving
    The user can only save display variants user-specifically
    'A' = standard and user-specific saving
    The user can save a display variant user-specifically and
    as standard display variant. The user chooses in the display variant
    save popup.
    Reward points if helpful.

  • Add functionality for enter and close in a dialogue window

    Hi
    I have a dialogue screen.
    On pressing enter or the enter icon I need some functionality.
    And on clicking the close icon or close(on the dialogue window) i need to exit.
    How to add functionality to close and enter?
    (The icons are functioning properly but Enter and close are not functioning)
    Here is the code i have used
    gv_save = gv_code.
    CLEAR gv_code.
    CASE gv_save.
    WHEN 'OK' OR 'ENTER'.
    PERFORM char_convert.
    LOOP AT object_tab WHERE selected = 'X'.
    UPDATE imptt SET pyear = gv_exponent
    WHERE point = object_tab-point.
    ENDLOOP.
    LEAVE TO SCREEN 0.
    CLEAR gv_annual.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_1001 INPUT
    MODULE cancel INPUT.
    gv_save = gv_code.
    CLEAR gv_code.
    CASE gv_save.
    WHEN 'CANCEL'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    Please help me .
    Best regards,
    Kranthi

    You need to take ABAP help and build logic, so that If so & so condition pick LOGO1
    and for so & so Condition LOGO2 & for rest LOGO3.
    You need to incoroporate the Logic in your program for Script / Smartform.

  • Custom functionality for home and end keys?

    I don't know anything about automate, but I was wondering if it's possible to do this:
    I'm a former PC user and on PCs you could use the 'home' and 'end' keys to go to the beginning and end of one line (subsequently, you could hold shift + home/end to highlight from your current cursor position to the beginning or end of a line). This functionality is extremely helpful for text editing and programming. Luckily the versions of Word and Dreamweaver I have on mac do use this, but TextEdit, Flash, and others do not. Is there anyway to program this kind of functionality? And if so how? And why is basic functionality like this different program to program on macs? PC's were at least consistent. Thanks!

    The Command and Option shortcuts will take some getting used to, but that will work. Thanks! an external text editor would be okay for some things, but not Flash ActionScripting within a flash file.
    I just wish some of the more basic functions between mac and pc were the same. I think both platforms would have an easier time getting users to switch if they were a little more consistent and took some of the good features of each into consideration.

  • Business Functions For Empty and DSD

    Hi
    We have installed ECC 6 at one of our client and the client's business is related to Beverage Industry and in order to use the functionalities of Empties and DSD we want to be sure about ECC Business Functions available for the Beverage Industry. Kindly reply with the related Business Functions available and need to be activated for Empties and DSD.
    Regards,

    Hello Charle,
    Following are the business functions available :
    HCM_ECM_CI_1     For ECM EHp4
    HCM_ECM_CI_2     For ECM EHp5
    HCM_ERC_CI_2      For EREC  EHp4
    HCM_ERC_CI_3     FOR EREC EHP4
    HCM_ERC_CI_4       For EREC EHP5
    HCM_ERC_SES_1   For Search in EREC
    HCM_OSA_CI_1     For Performance Managemt EHP4
    HCM_OSA_CI_2     For Performance Managemt EHP5
    HCM_LSO_CI_2   For LSO EHP4
    HCM_LSO_CI_3  For LSO EHP5
    These are BF, which you are looking for, you can get more information on help.sap.com
    Best Regards,
    Deepak.

  • NFS Commnication channel errors for deleting and placing

    Hi All,
    I was trying File to file scenario.
    I am picking the file from App server(AL11) using NFS Adapter and the processing Mode is Delete
    In comm channel monitor it showing an error as
    Sender channel error:
    Error: File '/staging/INTERFACE/SAP/ca/kar370.txt' - deleting after processing failed
    Same way while placing the file
    Receiver channel error:
    Error: Message processing failed: FileNotFoundException: /staging/INTERFACE/SAP/ca/test120110906-122051-980.txt (Permission denied)
    Whether i dont have the permission to delete and place the file from and to the App server(AL11)?
    What is the procedure in order to make it possible.
    Thanks
    Sai

    Hi All,
    Thanks to every one.
    The problem is solved ,
    Basis Guy has given the permissions, and i am able to place and delete the files .
    Thanks
    Sai

  • Partner Function for STO and relevant inbound delivery

    Dear Expert,
    i did the partner configuration for Vendor and STO with partner VN-vendor DP-delivery plant.
    When i create the STO vendor UP07, both of VN and DP are UP07, but when i create the STO for UP07, no partner data come out for the PO, the partner data didn't copy out from vendor master.For standard PO not STO, the partner data are copied from vendor master automatically. Any advice any further more setting need to do?
    I manually input the partner data for the STO, then i try to create inbound delivery, following incompleteness came out"Vendor : Account Number of Vendor or Creditor Missing",user need to manually input the partner number for LF-vendor.But when i check the partner setting for inbound delivery, LF is copied out from VN.Any more setting need to do to make sure the partner number of LF is auto copied from PO data.
    Look forward to your reply,
    Thank you and regards

    Hello,
    PLease check the vendor data created as a plant. Go to Vendor master and in purchasing view select extras -> additional Purchasing data-> in the plant assignment enter the Plant number. This will pull in the vendor details into the inbound delivery.
    Thanks!!

Maybe you are looking for