Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Fetch Infotype records through class concept!

$
0
0

TABLES pernr.
NODES  : peras.

DATA: o_infty        TYPE REF TO if_hrsen_read_infotype.
DATA: x_0001         TYPE p0001.
DATA: t_prelp_tab    TYPE STANDARD TABLE OF prelp.
DATA: t_0001         TYPE STANDARD TABLE OF p0001.
DATA: t_0002         TYPE STANDARD TABLE OF p0002.
DATA: t_temp         TYPE STANDARD TABLE OF p0002.
DATA: t_table        TYPE REF TO cl_salv_table.

CONSTANTS : c_0001   TYPE infty VALUE '0001',
             c_0002   TYPE infty VALUE '0002'.

START-OF-SELECTION.

GET peras.

   o_infty = cl_hrsen_read_infotype_fmri=>get_instance( ).

   CLEAR : x_0001, t_temp[].

   CALL METHOD o_infty->read_single
     EXPORTING
       tclas         = 'A'
       pernr         = pernr-pernr
       infty         = c_0001
       subty         = space
       objps         = space
       begda         = pn-begda
       endda         = pn-endda
       no_auth_check = space
     IMPORTING
       pnnnn         = x_0001
     EXCEPTIONS
       e_assertion   = 1
       OTHERS        = 2.
   IF sy-subrc EQ 0.
     APPEND x_0001 TO t_0001[].
   ENDIF.
*&---------------------------------------------------------------------*
*& TO READ THE INFOTYPE TABLE (MULTIPLE RECORDS FROM INFOTYPE)
*&---------------------------------------------------------------------*
   CALL METHOD o_infty->read
     EXPORTING
       tclas         = 'A'
       pernr         = pernr-pernr
       infty         = c_0002
       subty         = '*' "To get display the all subty data
       objps         = space
       begda         = pn-begda
       endda         = pn-endda
       no_auth_check = space
     IMPORTING
       infotype_tab  = t_prelp_tab
     EXCEPTIONS
       e_assertion   = 1
       OTHERS        = 2.

* conversion of Prelp to pnnnn structure.

   CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn_tab
     EXPORTING
       prelp_tab = t_prelp_tab
     IMPORTING
       pnnnn_tab = t_temp.

   APPEND LINES OF t_temp[] TO t_0002[].

END-OF-SELECTION.


Viewing all articles
Browse latest Browse all 935

Trending Articles



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