Difference between revisions of "SAP HCM ABAP CLUSTER TIME"

From SapWiki
(Created page with "==ejemplo 1 == FORM get_saldo_vaca USING p_pernr TYPE p0000-pernr CHANGING p_saldo TYPE pc2bf-anzhl p_begda type p2001-begda....")
 
 
Line 1: Line 1:
 
==ejemplo 1 ==
 
==ejemplo 1 ==
  FORM get_saldo_vaca USING p_pernr TYPE p0000-pernr
+
  <nowiki>FORM get_saldo_vaca USING p_pernr TYPE p0000-pernr
                  CHANGING p_saldo TYPE pc2bf-anzhl
+
                CHANGING p_saldo TYPE pc2bf-anzhl
                          p_begda type p2001-begda.
+
                          p_begda type p2001-begda.
+
 
  DATA: lt_zes TYPE STANDARD TABLE OF pc2b6 WITH HEADER LINE,
+
  DATA: lt_zes TYPE STANDARD TABLE OF pc2b6 WITH HEADER LINE,
        lt_ab  TYPE STANDARD TABLE OF pc20i WITH HEADER LINE,
+
        lt_ab  TYPE STANDARD TABLE OF pc20i WITH HEADER LINE,
        lt_zl  TYPE STANDARD TABLE OF  pc2bf WITH HEADER LINE.
+
        lt_zl  TYPE STANDARD TABLE OF  pc2bf WITH HEADER LINE.
+
 
  DATA: ls_b2_key  TYPE pc2b0,
+
  DATA: ls_b2_key  TYPE pc2b0,
        ls_keytable TYPE ptm_clst_perview.
+
        ls_keytable TYPE ptm_clst_perview.
+
 
  DATA lt_pcl2 TYPE TABLE OF pcl2.
+
  DATA lt_pcl2 TYPE TABLE OF pcl2.
  DATA ls_pcl2 LIKE LINE OF lt_pcl2.
+
  DATA ls_pcl2 LIKE LINE OF lt_pcl2.
  DATA l_srtfdlow TYPE pcl2-srtfd.
+
  DATA l_srtfdlow TYPE pcl2-srtfd.
  DATA l_srtfdhigh TYPE pcl2-srtfd.
+
  DATA l_srtfdhigh TYPE pcl2-srtfd.
+
 
  CONCATENATE p_pernr '18000101' INTO l_srtfdlow.
+
  CONCATENATE p_pernr '18000101' INTO l_srtfdlow.
  CONCATENATE p_pernr '99991231' INTO l_srtfdhigh.
+
  CONCATENATE p_pernr '99991231' INTO l_srtfdhigh.
+
 
  SELECT * FROM pcl2 INTO TABLE lt_pcl2 WHERE relid EQ 'B2'
+
  SELECT * FROM pcl2 INTO TABLE lt_pcl2 WHERE relid EQ 'B2'
                    AND srtfd BETWEEN l_srtfdlow AND l_srtfdhigh
+
                    AND srtfd BETWEEN l_srtfdlow AND l_srtfdhigh
                    AND srtf2 EQ '00'
+
                    AND srtf2 EQ '00'
                    ORDER BY PRIMARY KEY.                "#EC PORTABLE
+
                    ORDER BY PRIMARY KEY.                "#EC PORTABLE
  IF sy-subrc = 0.
+
  IF sy-subrc = 0.
* leer ultimo
+
* leer ultimo
    LOOP AT lt_pcl2 INTO ls_pcl2.
+
    LOOP AT lt_pcl2 INTO ls_pcl2.
    ENDLOOP.
+
    ENDLOOP.
    ls_b2_key = ls_pcl2-srtfd.
+
    ls_b2_key = ls_pcl2-srtfd.
    MOVE-CORRESPONDING ls_pcl2 TO ls_keytable.
+
    MOVE-CORRESPONDING ls_pcl2 TO ls_keytable.
    MOVE-CORRESPONDING ls_b2_key TO ls_keytable.
+
    MOVE-CORRESPONDING ls_b2_key TO ls_keytable.
+
 
    CALL FUNCTION 'HR_TIME_RESULTS_GET'
+
    CALL FUNCTION 'HR_TIME_RESULTS_GET'
      EXPORTING
+
      EXPORTING
        get_pernr = p_pernr
+
        get_pernr = p_pernr
        get_pabrj = ls_keytable-pabrj
+
        get_pabrj = ls_keytable-pabrj
        get_pabrp = ls_keytable-pabrp
+
        get_pabrp = ls_keytable-pabrp
      TABLES
+
      TABLES
        get_zes  = lt_zes
+
        get_zes  = lt_zes
        get_ab    = lt_ab
+
        get_ab    = lt_ab
        get_zl    = lt_zl.
+
        get_zl    = lt_zl.
+
 
    LOOP AT lt_zl WHERE lgart = '5T12'.
+
    LOOP AT lt_zl WHERE lgart = '5T12'.
      ADD lt_zl-anzhl TO p_saldo.
+
      ADD lt_zl-anzhl TO p_saldo.
    ENDLOOP.
+
    ENDLOOP.
+
 
    p_begda = ls_pcl2-aedtm.
+
    p_begda = ls_pcl2-aedtm.
+
 
  ENDIF.
+
  ENDIF.
+
 
ENDFORM.                    "get_saldo_vaca
+
ENDFORM.                    "get_saldo_vaca</nowiki>

Latest revision as of 21:26, 4 April 2020

ejemplo 1

FORM get_saldo_vaca USING p_pernr TYPE p0000-pernr
                 CHANGING p_saldo TYPE pc2bf-anzhl
                          p_begda type p2001-begda.

  DATA: lt_zes TYPE STANDARD TABLE OF pc2b6 WITH HEADER LINE,
        lt_ab  TYPE STANDARD TABLE OF pc20i WITH HEADER LINE,
        lt_zl  TYPE STANDARD TABLE OF  pc2bf WITH HEADER LINE.

  DATA: ls_b2_key   TYPE pc2b0,
        ls_keytable TYPE ptm_clst_perview.

  DATA lt_pcl2 TYPE TABLE OF pcl2.
  DATA ls_pcl2 LIKE LINE OF lt_pcl2.
  DATA l_srtfdlow TYPE pcl2-srtfd.
  DATA l_srtfdhigh TYPE pcl2-srtfd.

  CONCATENATE p_pernr '18000101' INTO l_srtfdlow.
  CONCATENATE p_pernr '99991231' INTO l_srtfdhigh.

  SELECT * FROM pcl2 INTO TABLE lt_pcl2 WHERE relid EQ 'B2'
                    AND srtfd BETWEEN l_srtfdlow AND l_srtfdhigh
                    AND srtf2 EQ '00'
                    ORDER BY PRIMARY KEY.                 "#EC PORTABLE
  IF sy-subrc = 0.
* leer ultimo
    LOOP AT lt_pcl2 INTO ls_pcl2.
    ENDLOOP.
    ls_b2_key = ls_pcl2-srtfd.
    MOVE-CORRESPONDING ls_pcl2 TO ls_keytable.
    MOVE-CORRESPONDING ls_b2_key TO ls_keytable.

    CALL FUNCTION 'HR_TIME_RESULTS_GET'
      EXPORTING
        get_pernr = p_pernr
        get_pabrj = ls_keytable-pabrj
        get_pabrp = ls_keytable-pabrp
      TABLES
        get_zes   = lt_zes
        get_ab    = lt_ab
        get_zl    = lt_zl.

    LOOP AT lt_zl WHERE lgart = '5T12'.
      ADD lt_zl-anzhl TO p_saldo.
    ENDLOOP.

    p_begda = ls_pcl2-aedtm.

  ENDIF.

ENDFORM.                    "get_saldo_vaca