cancel
Showing results for 
Search instead for 
Did you mean: 

function module HR_ECM_DELETE_INFOTYPE

Former Member
0 Kudos

Hello,

Is there anybody ever used function module HR_ECM_DELETE_INFOTYPE?

How can I give the data for MESSAGE_HANDLER? Thanks.

Meiying

Accepted Solutions (1)

Accepted Solutions (1)

amit_khare
Active Contributor
0 Kudos

Just declare a variable of type IF_HRPA_MESSAGE_HANDLER and pass it to FM for message_handler.

Dont worry about data, it wont through error.

I cant say about its exact usage but cheked several standard reports with this field and all are doing the same.

Regards,

Amit

Former Member
0 Kudos

Hi, Amit,

Thanks for the reply.

I tried it. But I got an error saying "Access via 'NULL' object reference not possible". My code is like below. Would you please look at it and see where is wrong? Thank you!


TABLES: pa9001.

DATA:
        ls_return              TYPE TABLE OF bapireturn1,
        msg                    TYPE REF TO  IF_HRPA_MESSAGE_HANDLER ,
        is_ok                  TYPE BOOLE_D,
        ls_9001                TYPE pskey.

DATA:   BEGIN of lt_pa9001 Occurs 0.
          INCLUDE structure pa9001.
DATA:   END OF lt_pa9001.


START-OF-SELECTION.
    SELECT * FROM pa9001 INTO lt_pa9001
       WHERE ztitlety = 'CONTRACT'
         AND begda = '20060701'
         AND endda = '20060630'
         AND aedtm = '20070313'
         AND uname = 'MYANG1'.
     IF sy-subrc = 0.
*      MOVE-CORRESPONDING pa9001 to ls_9001.
    MOVE lt_pa9001-pernr to ls_9001-pernr.
    ls_9001-infty = '9001'.
    MOVE lt_pa9001-begda to ls_9001-begda.
    move lt_pa9001-endda to ls_9001-endda.
    move lt_pa9001-seqnr to ls_9001-seqnr.
     ENDIF.
ENDSELECT.


*     MOVE lt_pa9001-pernr to ls_9001-pernr.
*     MOVE lt_pa9001-begda to ls_9001-begda.
*     move lt_pa9001-endda to ls_9001-endda.
*     move lt_pa9001-aedtm to ls_9001-aedtm.
*     move lt_pa9001-uname to ls_9001-uname.
*     move lt_pa9001-subty to ls_9001-subty.
*     move lt_pa9001-seqnr to ls_9001-seqnr.
*       ls_9001-pernr = lt_pa9001-pernr.
*       ls_9001-begda = lt_pa9001-begda.

      CALL FUNCTION 'HR_ECM_DELETE_INFOTYPE'
        EXPORTING
          pskey                 = ls_9001
          MESSAGE_HANDLER       = msg
        IMPORTING
          IS_OK                 = is_ok.

Former Member
0 Kudos

Hi Meiying. Shouldn't the call to HR_ECM_DELETE_INFOTYPE go in between your SELECT and ENDSELECT statements (right after the ENDIF)? Otherwise you won't call the function module until after you've looped through all of your 9001 records.

- April King

Message was edited by:

April King

amit_khare
Active Contributor
0 Kudos

Try with this -

data msg type symsg.

is_ok = false.

msg-msgid = 'PBAS_SERVICE'.

msg-msgty = 'E'.

msg-msgno = '001'.

call method message_handler->add_message

exporting

message = msg

cause = if_hrpa_message_handler=>infotype_specific.

endmethod.

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

Hi, Amit,

Where do I put these code? I put them before CALL FUNCTION 'HR_ECM_DELETE_INFOTYPE' . It give me an error saying ' Attribute(var->attr> is not defined for "%_#E2"' when I tried to activate.

Thank you!

Meiying

amit_khare
Active Contributor
0 Kudos

Yeah you have to put that code before the Function call.

you can even try out this code too instead of that one.

<b>

data message_handler type ref to if_hrpa_message_handler.

data dummy_handler type ref to cl_hrpa_dummy_message_handler.

create object dummy_handler.

message_handler = dummy_handler.

</b>

Regards,

Amit

Former Member
0 Kudos

Hi, Amit,

Please help!

Thank you very much!

Meiying

Former Member
0 Kudos

Hi, Amit,

I tried this one and commented out the formal one. The program ran through, but did not delete the records. Do you think that might be because the end date is bigger than beginning date? I could not delete those records using ZBGD_INFTY9001_REMOVE either, because it think the date range is invalid. Do you have any idea? Thank you very much!

meiying

Former Member
0 Kudos

I changed ending data to be larger than beginning data. It still did not delete the records.

amit_khare
Active Contributor
0 Kudos

Sorry for Delay.

If its allowing you to change end date of all the records, then I will suggest you to write a program to change all the dates first and then simply call HR_INFOTYPE_OPERATION only.

Since these are new FMs and not even much available from SAP to get help on them.

Regards,

Amit

Former Member
0 Kudos

Yes. It allows me to change all the end date records. But I have to use function module to do it instead of using directly update table. When I use HR_INFOTYPE_OPERATION to change records, it still check the date range. I am new to SAP. Do you think it is safe to change end date directly using update ... set ... in the program? Thank you!

Meiying

amit_khare
Active Contributor
0 Kudos

It is not suggested but any ways you have to delete all the data from the PA9001 table, if I am write.

You can do that.

FM will not alllow you to do that as they will check date.

Regards,

Amit

Former Member
0 Kudos

Amit,

OK. I will do that.

Thank you very much for all your help.

Answers (0)