Saturday, January 21, 2012

Using funtion modules - HR_READ_INFOTYPE & RP_GET_HIRE_DATE

*&---------------------------------------------------------------------*
*& Report  YSAP_LDB_FMS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  YSAP_LDB_FMS.

infotypes: 0002.


DATA: return LIKE sy-subrc,
      hire_date LIKE p0016-eindt.

PARAMETERS: person LIKE pernr-pernr,
            begdat LIKE p0002-begda DEFAULT sy-datum,
            enddat LIKE p0002-endda DEFAULT sy-datum.

CALL FUNCTION 'HR_READ_INFOTYPE'
  EXPORTING
*   TCLAS                 = 'A'
    pernr                 = person
    infty                 = '0002'
   BEGDA                 = begdat
  ENDDA                 = enddat
*   BYPASS_BUFFER         = ' '
*   LEGACY_MODE           = ' '
 IMPORTING
   SUBRC                 = return
  tables
    infty_tab             = p0002
 EXCEPTIONS
   INFTY_NOT_FOUND       = 1
   OTHERS                2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

if return 0.
CALL FUNCTION 'RP_GET_HIRE_DATE'
  EXPORTING
    persnr                = person
    check_infotypes       = '0000'
*   DATUMSART             = '01'
*   STATUS2               = '3'
*   P0016_OPTIONEN        = ' '
 IMPORTING
   HIREDATE              = hire_date
          .

  LOOP AT p0002.
    WRITE: /  p0002-pernr,
           /  p0002-nachn,
           /  p0002-vorna,
           /  hire_date.
  ENDLOOP.
  endif.


 INPUT IN RUNTIME

 

In attributes we need not use LDBs



OUTPUT:

 

No comments:

Post a Comment

Post a Comment