Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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ž

Former Member
replied

Hello Matev,

seems like i'm unable to drive my point home,

> Preparing tables:

>

>           MOVE-CORRESPONDING s_teven TO s_teven_more.
> 
>           APPEND s_teven TO t_teven_del.
>           APPEND s_teven_more TO t_teven_more_del.
{quote}

the deletion part(above) is fine, the program is not supposed to set the values of 'STOKZ' to 'X',  the FM will that for you as a mark of deleting the records( instead of deleting them physically from the database.

{quote:title=Matevz Babnik wrote:}
> 

> s_teven-stokz = 'X'.

> APPEND s_teven TO t_teven_ins.

>

> s_teven_more-stokz = 'X'.

> APPEND s_teven_more TO t_teven_more_ins.

>

{quote}

not sure at what you are trying to achieve in ther insertion part above,  if you want to insert a new record in TEVEN, you have to generate the value of the key field 'PDSNR' of the table 'TEVEN', this can be done by calling the FM 'NUMBER_GET_NEXT', then you can build the remaining fields of the TEVEN structure in your program as shown below:

  

DATA: w_pdsnr TYPE teven-pdsnr.

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

nr_range_nr = '01'

object = 'PD_SEQ_NR'

IMPORTING

number = w_pdsnr

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.

IF sy-subrc IS INITIAL.

s_teven-pdsnr = w_pdsnr.

  • build the rest of the fields in s_teven structure

APPEND s_teven TO t_teven_ins.

ENDIF.

As you are trying to insert duplicate records you are currently receiving an update error, remember, PDSNR is the only key field in TEVEN table, debugging the update FM should be straight forward and easy, just in case if you run into errors.

-Rajesh

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question