Thursday, January 26, 2012

Time Constraints in HR Master Data

Time constraints guarantee that exactly the data the system needs to be able to correctly process the employee data, handle personnel administration processes and run payroll for an employee is available in the system. Time constraints keep you from storing mutually incompatible data and prevent gaps from occurring in the data history.

Time Constraint 1
Time constraint 1 must be used for all of the infotypes containing information that must be available at all times. This is particularly true of personal and organizational assignment data.

Time Constraint 2
No more than one valid record can exist at any one time. Records with constraint 2 must not overlap.

Time Constraint 3
Any number of valid records can exist at any one time. The individual records do not conflict with each other.

  Time Constraint A
Infotypes with time constraint A must have no more than one record. The system automatically assigns the record a validity period from January 01, 1800 through December 31, 9999. This validity period cannot be subdivided.
Infotype records with time constraint A cannot be deleted.

Time Constraint B
Infotypes with time constraint B must have no more than one record. The system automatically assigns the record a validity period from January 01, 1800 through December 31, 9999. This validity period cannot be subdivided.
Infotype records with time constraint B can be deleted.

Time Constraint T
Infotype records with time constraint T depend on the subtype.

Time Constraint Z
The infotypes you use for entering working and absence time have a special time constraint behavior.

hiding back cancel exit buttons in selection screen GUI status

*&---------------------------------------------------------------------*
*& Report  YSAP_HIDE_MENUS_SELSCREEN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ysap_hide_menus_selscreen.

DATA: it_ucomm TYPE TABLE OF sy-ucomm.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: pernr TYPE pa0002-pernr.
SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.
  APPEND :
  'E'    TO it_ucomm,  "for back
  'ENDE' TO it_ucomm,  "for exit
  'ECAN' TO it_ucomm.  "for cancel
 
  CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
    EXPORTING
      p_status        = sy-pfkey
*     P_PROGRAM       = ' '
    tables
      p_exclude       = it_ucomm.


 

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:

 

Application tool bar in Selection screen

*&---------------------------------------------------------------------*
*& Report  YSAP_APP_TOOLBAR_SELSCREEN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ysap_app_toolbar_selscreen.

TABLES: sscrfields.

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME.

PARAMETERS: p1(10),
            p2(10).

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK block1.

SELECTION-SCREEN FUNCTION KEY 1.

INITIALIZATION.

  MOVE 'OUTPUT' TO sscrfields-functxt_01.

START-OF-SELECTION.

  WRITE: p1, p2.

AT SELECTION-SCREEN.

  IF sscrfields-ucomm = 'FC01'.
    BREAK-POINT.
  ENDIF.

 In Runtime

 

If  You select Output :


 

If You execute normally: