Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8372

Re: need alternate FM for HR_INFOTYPE_OPERATION

$
0
0

What about an OOP approach with IF_HRPA_PLAIN_INFOTYPE_ACCESS:

 

Example

 

    constants GC_OBJPS_ALL type OBJPS value '*'.

    constants GC_INFTY_NO  type INFTY value '9001'. "#EC NOTEXT

    constants GC_SUBTY_NO  type SUBTY value '0001'. "#EC NOTEXT

 

 

    " * Get infotype access

    DATA li_iread TYPE REF TO if_hrpa_plain_infotype_access.

    cl_hrpa_masterdata_factory=>get_plain_infotype_access(

      IMPORTING plain_infotype_access = li_iread

    ).

 

 

    " * Message handler

    DATA lo_mhand TYPE REF TO if_hrpa_message_handler.

    DATA lo_mlist TYPE REF TO cl_hrpa_message_list.

    " *

    FREE lo_mlist.

    CREATE OBJECT lo_mlist.

    lo_mhand = lo_mlist.

 

 

    " * Read record

    DATA ls_p9001 TYPE p9001.

    " *

    li_iread->read_single(

      EXPORTING tclas           = cl_hrpa_tclas=>tclas_employee

                pernr           = lv_pernr

                infty           = gc_infty_no

                subty           = gc_subty_no

                objps           = lc_objps_all

                sprps           = if_hrpa_read_infotype=>unlocked

                begda           = lv_begda

                endda           = lv_endda

                mode            = if_hrpa_read_infotype=>last_intersecting_record

                no_auth_check   = if_hrpa_boole_d=>true

                message_handler = lo_mhand

      IMPORTING pnnnn           = ls_p9001

    ).

 

 

    " * Insert record

    li_iread->insert(

      EXPORTING tclas           = cl_hrpa_tclas=>tclas_employee

                no_auth_check   = if_hrpa_boole_d=>true

                message_handler = lo_mhand

      CHANGING  pnnnn           = ls_p9001

    ).

 

 

    " * Modify record

    DATA ls_pskey TYPE pskey.

    MOVE-CORRESPONDING ls_p9013 TO ls_pskey.

    li_iread->modify(

      EXPORTING tclas           = cl_hrpa_tclas=>tclas_employee

                old_pskey       = ls_pskey

                no_auth_check   = if_hrpa_boole_d=>true

                message_handler = lo_mhand

      CHANGING  pnnnn           = ls_p9001

    ).

 

 

    " * Commit changes

    li_iread->if_hrpa_buffer_control~flush( no_commit = abap_false ).

 

 

    " * Message table

    DATA lt_mlist TYPE hrpad_message_tab.

    lo_mlist->get_message_list(

      IMPORTING messages = lt_mlist

    ).

 

Or try other OOP way in /thread/3832149 see Enric Castella Gonzalez Answer (Not tested by me)

 

Let me know if work for your case

 

--

Regards

Edwin Guedez


Viewing all articles
Browse latest Browse all 8372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>