Skip to Content
author's profile photo Former Member
Former Member

Problem with HR_INFOTYPE_OPERATION via BADI

Hi.

I'm trying to update endda date of infotype 0041, via BADI.

I need to update this date when i change endda date on infotype 0016, so when i do this and i press 'save' button, my badi is fired and i call HR_INFOTYPE_OPERATION.

This method seems to work fine, because if go to infotype 0041 screen, this date is there, but when i refresh the transaction or go to pa0041 table the value is not changed.

Seems like the new value is in some kind of intermediate memory, but the values are not submitted to the database table.

Any ideas??

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 11:12 AM

    Hi,

    SUBMIT this report inside your BAdI, instead of a direct call to the function module.. this will initiate a separate work process for infotype 2001 & there will not be any more lock conflicts..

    <b>Reward points</b>

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 08:19 AM

    hi

    good

    go through this code and use the function module accordingly.

    REPORT ZZKNB_BAPI_INFOTYPE_CALL .

    • Use 'BAPI_EMPLOYEE_ENQUEUE' to lock the employee before updating

    DATA: l_bapireturn LIKE bapireturn1.

    DATA: bapipakey_tab LIKE bapipakey OCCURS 0 WITH HEADER LINE.

    data: l_p0169 like p0169.

    parameters: p_pernr like p0169-pernr default '07000003'.

    start-of-selection.

    CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

    EXPORTING

    number = p_pernr

    IMPORTING

    return = l_bapireturn.

    IF l_bapireturn-id NE space.

    WRITE: / l_p0169-pernr, 'Enqueue failed'.

    exit.

    ENDIF.

    *-- Suported operations:

    *-- change (operation = 'MOD')

    *-- Create (operation = 'INS')

    *-- DELETE (operation = 'DEL')

    *-- CREATESUCCESSOR (operation = 'COP')

    .

    l_p0169-barea = '7A'.

    l_p0169-pltyp = 'RRSP'.

    l_p0169-bplan = 'RRSP'.

    l_p0169-elidt = '20000101'.

    l_p0169-enrty = 'M'.

    l_p0169-perio = '4'.

    CALL FUNCTION 'HR_INFOTYPE_OPERATION'

    EXPORTING

    infty = '0169'

    subty = 'RRSP'

    number = p_pernr

    record = l_p0169

    validitybegin = '20021001'

    validityend = '99991231'

    operation = 'INS'

    • dialog_mode = '0' "Use default

    • nocommit = '1' "Use default

    IMPORTING

    return = l_bapireturn

    key = bapipakey_tab.

    IF l_bapireturn-id NE space.

    WRITE: / p_pernr,

    20 'Create was unsuccessful',

    l_bapireturn-id,

    l_bapireturn-message+0(40).

    ELSE.

    WRITE: / p_pernr,

    20 'Create was successful',

    l_bapireturn-id,

    l_bapireturn-message+0(40).

    ENDIF.

    • Use 'BAPI_EMPLOYEE_DEQUEUE' to un-lock the employee before updating

    CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

    EXPORTING

    number = l_p0169-pernr

    IMPORTING

    return = l_bapireturn.

    thanks

    mrutyun^

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 08:29 AM

    I already know how to use the function module, but this problem seems to be a little bit more complicated.

    The FM works fine, return value is initial, but the values are not submitted to the table.

    Any ideas?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 08:38 AM

    Hi

    Guess you can have a COMMIT WORK to commit the changes to the database.

    <FM Call>

    If sy-subrc EQ 0.

    Commit work.

    Endif.

    Regards

    Raj

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.