Sample code for sap hr program--pls treat this as urgent

Hi ,
This is the program on attendence incentive program, i have written
REPORT  zhrpa0019    LINE-SIZE 270
                     LINE-COUNT  55(3)
                     NO STANDARD PAGE HEADING
                     MESSAGE-ID zm.
     T A B L E S                                                     *
TABLES: pernr, pa2001, pa9002.
*Type-pools
TYPE-POOLS slis.
     I N F O T Y P E S                                               *
INFOTYPES: 0008, 0001, 0002,2001,9002,0041.
     T Y P E S
DATA:BEGIN OF t_data1 OCCURS 0,
       pernr LIKE pa0001-pernr,
       ename LIKE pa0001-ename,
       bukrs LIKE pa0001-bukrs,
       werks LIKE pa0001-werks,
       btrtl LIKE pa0001-btrtl,
       persg LIKE pa0001-persg,
       persk LIKE pa0001-persk,
       begda LIKE pa0001-begda,
       endda LIKE pa0001-endda,
       amount LIKE pa0008-bet01,
       cdate  LIKE pa0041-dat01,
    END OF t_data1.
     D A T A * Internal table and working area
DATA: i_data1 LIKE   t_data1 OCCURS 0 WITH HEADER LINE.
    wa_data1 like line of t_data1 .
DATA : BEGIN OF i_date OCCURS 0,
         pernr    LIKE   pa0041-pernr,
         cdate    LIKE   pa0041-dat01,
     END OF i_date.
*Data : i_pa0041  like pa0041 occurs 0 with header line,
       wa_pa0041 like pa0041.
*Data : i_p0001  like p0001 occurs 0 with header line.
Constants
CONSTANTS:  c_102007(6) VALUE '102007',
            c_25 TYPE p DECIMALS 1 VALUE '25.0',
            c_x VALUE 'X',
            c_a  value 'A',
            c_mcnp(4) value 'MCNP'.
Variables
DATA :   v_mvc  like pa0008-bet01,
       lv_bmonth    TYPE   char2,
       lv_byear     TYPE   char4,
       lv_date      TYPE   sy-datum.
Parameters Selection
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(31) text-001.
*PARAMETERS:: p_bmonth LIKE pv000-pabrp OBLIGATORY,
            p_byear LIKE pv000-pabrj  OBLIGATORY.
SELECTION-SCREEN COMMENT 45(10) text-002.
SELECTION-SCREEN END OF LINE.
PARAMETERS: p_mvc(2) TYPE p DECIMALS 1 DEFAULT c_25,
            p_mctype  TYPE pa2001-awart DEFAULT c_mcnp,
            p_ditype  TYPE c  DEFAULT c_a,
            rb_test RADIOBUTTON GROUP grp1 DEFAULT 'X',
            rb_prod RADIOBUTTON GROUP grp1.
SELECTION-SCREEN END OF BLOCK b1.
Initialization                                     *
INITIALIZATION.
  pnpstat2-low = '3'.
  pnpstat2-sign = 'I'.
  pnpstat2-option = 'EQ'.
  APPEND pnpstat2.
  CLEAR pnpstat2.
  pnpbukrs-low = 'SATS'.
  pnpbukrs-sign = 'I'.
  pnpbukrs-option = 'EQ'.
  APPEND pnpbukrs.
  CLEAR pnpbukrs.
  pnppersg-low = 'N'.
  pnppersg-sign = 'I'.
  pnppersg-option = 'EQ'.
  APPEND pnppersg.
  CLEAR pnppersg.
  pnpbtrtl-low = '2010'.
  pnpbtrtl-high = '2050'.
  pnpbtrtl-sign = 'I'.
  pnpbtrtl-option = 'EQ'.
  APPEND pnpbtrtl.
  CLEAR pnpbtrtl.
**Clearing the variables
CLEAR : lv_byear, lv_bmonth,
         lv_date.
Get previous month from current date
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
   EXPORTING
     currdate   = sy-datum
     backmonths = 1
   IMPORTING
     newdate    = lv_date.
lv_byear = lv_date(4).
lv_bmonth = lv_date+4(2).
MOVE lv_bmonth TO p_bmonth.
MOVE lv_byear TO p_byear.
AT Selection-screen                          *
AT SELECTION-SCREEN.
  IF rb_prod = 'X' .
    IF sy-uname NP 'HRBTCH*'.
      MESSAGE e223(zhpa).
   else.
     UPDATE  pa0015
              SET  begda = sy-datum
                  lgart = '216D'
                   bertg = P_MVC
            WHERE pernr = p0001-pernr.
     IF SY-SUBRC EQ 0.
       message i224(zhpa).
     endif.
     COMMIT WORK.
    ENDIF.
  ENDIF.
T O P  O F  P A G E                                          *
TOP-OF-PAGE.
  PERFORM f_top_of_page.
E N D  O F   P A G E                                          *
END-OF-PAGE.
B E G I N   S E L E C T I O N                                *
START-OF-SELECTION.
GET  pernr.
  pnp-sw-ignorelockedrecords = 'N'.
  PERFORM f_get_hr_data.
E N D   S E L E C T I O N                                    *
END-OF-SELECTION.
sort i_data1 by werks ascending
                  btrtl ascending
                  persg ascending
                  persk ascending
                  pernr ascending.
check for test mode.
  if rb_test = 'X'.
    clear: i_data1.
    loop at i_data1 .
     perform f_fill_bdc.
     perform f_bdc_transaction using c_pa30.
    endloop.
  endif.
  perform f_display_report.
*&      Form  f_top_of_page
      text
-->  p1        text
<--  p2        text
FORM f_top_of_page.
  WRITE: text-t11, sy-repid ,
         65 text-t12,
         150 text-t13,
         158 sy-datum.
  IF rb_test = c_x.
    WRITE:/ text-t21, sy-mandt,
           75 text-t22,
           150 text-t23,
           158 sy-uzeit.
  ELSE.
    WRITE:/ text-t21, sy-mandt,
           117 text-t24,
           150 text-t23,
           158 sy-uzeit.
  ENDIF.
  WRITE:/ text-t31, sy-uname,
         150 text-t32,
         158 sy-pagno.
  ULINE.
ENDFORM.                    " f_top_of_page
*&      Form  f_get_hr_data
      text
-->  p1        text
<--  p2        text
FORM f_get_hr_data.
  rp-provide-from-last p0001 space pn-begda pn-endda.
  IF pnp-sw-found = 1.
    PERFORM f_get_data_pa0008.
  ENDIF.
ENDFORM.                    " f_get_hr_data
*&      Form  f_get_data_pa0008
      text
-->  p1        text
<--  p2        text
FORM f_get_data_pa0008.
  PERFORM f_get_confirm_date.
  rp-provide-from-last p0008 space pn-begda pn-endda..
  v_mvc = p_mvc.
  IF pnp-sw-found = 1.
   i_data1-cdate = i_date-cdate.
    MOVE p0001-pernr TO i_data1-pernr.
    MOVE p0001-ename TO i_data1-ename.
    MOVE p0001-werks TO i_data1-werks.
    MOVE p0001-btrtl TO i_data1-btrtl.
    MOVE p0001-persg TO i_data1-persg.
    MOVE p0001-bukrs TO i_data1-bukrs.
    MOVE p0001-persk TO i_data1-persk.
    MOVE i_date-cdate TO i_data1-cdate.
    MOVE v_mvc   TO i_data1-amount.
    APPEND i_data1.
    CLEAR i_data1.
  ENDIF.
ENDFORM.                    " f_get_data_pa0008
*&      Form  f_display_report
      text
-->  p1        text
<--  p2        text
FORM f_display_report.
perform alv_display.
*Output to a list
data : lv_stotal(5)  type n,
         lv_utotal(5)  type n,
         lv_format.
  constants : c_l value '|'.
  clear: i_data1.
  format color col_total intensified on.
  write: /, / 'Successfully Updated to Database:'.
  write: /.
  format reset.
  uline (200).
  format color col_heading intensified off.
  write : /1 c_l no-gap, (8) 'Pnumber' no-gap,
          c_l no-gap, (35) 'Name' no-gap,
          c_l no-gap, (5) 'PA' no-gap,
          c_l no-gap, (5) 'PSA' no-gap,
          c_l no-gap, (6) 'EE Grp' no-gap,
          c_l no-gap, (9) 'EE Subgrp' no-gap,
           c_l no-gap, (12) 'Amount' no-gap,
          200 c_l.
  uline (200).
format reset.
  loop at i_data1 .
   perform f_format_amount.
    if lv_format = 'X'.
      clear lv_format.
      format color col_normal intensified off.
    else.
      lv_format = 'X'.
      format color col_normal intensified on.
    endif.
    write :/1 c_l no-gap, (8) i_data1-pernr no-gap,
           c_l no-gap, (35) i_data1-ename no-gap,
           c_l no-gap, (5) i_data1-werks no-gap,
           c_l no-gap, (5) i_data1-btrtl no-gap,
           c_l no-gap, (6) i_data1-persg no-gap,
           c_l no-gap, (9) i_data1-persk no-gap,
           c_l no-gap , (12) i_data1-amount no-gap.
endloop.
ENDFORM .                    "f_display_report
*&      Form  get_confirm_date
      text
-->  p1        text
<--  p2        text
FORM f_get_confirm_date .
  rp-provide-from-last p0041  space pn-begda pn-endda.
  IF pnp-sw-found = 1.
    CLEAR i_date.
    i_date-pernr = p0041-pernr.
    APPEND i_date.
    PERFORM f_populate_date USING : p0041-pernr
                                      p0041-dar01 p0041-dat01,
                                      p0041-pernr
                                      p0041-dar02 p0041-dat02,
                                      p0041-pernr
                                      p0041-dar03 p0041-dat03,
                                      p0041-pernr
                                      p0041-dar04 p0041-dat04,
                                      p0041-pernr
                                      p0041-dar05 p0041-dat05,
                                      p0041-pernr
                                      p0041-dar06 p0041-dat06,
                                      p0041-pernr
                                      p0041-dar07 p0041-dat07,
                                      p0041-pernr
                                      p0041-dar08 p0041-dat08,
                                      p0041-pernr
                                      p0041-dar09 p0041-dat09,
                                      p0041-pernr
                                      p0041-dar10 p0041-dat10,
                                      p0041-pernr
                                      p0041-dar11 p0041-dat11,
                                      p0041-pernr
                                      p0041-dar12 p0041-dat12.
  ENDIF.
ENDFORM.                    " get_confirm_date
*&      Form  f_populate_date
      text
     -->P_PERNR    text
     -->P_DAR      text
     -->P_DAT      text
FORM f_populate_date USING   p_pernr p_dar p_dat.
  CLEAR i_date.
  READ TABLE i_date WITH KEY pernr = p_pernr.
  IF sy-subrc = 0.
    IF p_dar = 'A3'.
      i_date-cdate = p_dat.
      MODIFY i_date INDEX sy-tabix.
    ENDIF.
  ENDIF.
  endform.
i need to add the logic , could you pls help as this is very urgent.........
IF test run = ‘X’     
     Display the report
IF production run = ‘X’
     1. Batch user ID ‘HRBTCH*’ performed the execution.
     Create new record based on the following parameters:               
-     PA0015-BEGDA = System Date  (date of origin)
-     PA0015-LGART = 216D (wage type)
-     PA0015-BETRG = IAP amount (25)
          Display the report.
     2. Program was not executed by Batch user ID ‘HRBTCH*’
          Display information message ‘Only batch user ID can run actual mode.
          Display the report
No update will be done.
ENDIF.
how to addd in the above code.....

REPORT  ZHR_ATTENDANCE_RPT MESSAGE-ID ZHR.
                 T Y P E    P O O L S                                *
TYPE-POOLS : SLIS.
                      T A B L E                                     *
TABLES : TEVEN,
         PA0000,
         PA0001,
         T503K,
         T500P.
          I N T E R N A L   T A B L E   D E C L A R A T I O N        *
DATA : BEGIN OF IT_PA0001 OCCURS 0,
       PERNR TYPE PA0001-PERNR,
       ENDDA TYPE PA0001-ENDDA,
       WERKS TYPE PA0001-WERKS,
       BTRTL TYPE PA0001-BTRTL,
       ORGEH TYPE PA0001-ORGEH,
       PERSK TYPE T503T-PERSK,
       ENAME TYPE PA0001-ENAME,
       END OF IT_PA0001.
DATA : BEGIN OF IT_PA0000 OCCURS 0,
       PERNR TYPE PA0000-PERNR,
       END OF IT_PA0000.
DATA : BEGIN OF IT_TEVEN OCCURS 0,
       PERNR TYPE TEVEN-PERNR,
       LDATE TYPE TEVEN-LDATE,
       LTIME TYPE TEVEN-LTIME,
       SATZA TYPE TEVEN-SATZA,
       END OF IT_TEVEN.
DATA : IT_TEVEN1 LIKE IT_TEVEN OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF IT_T527X OCCURS 0,
       ORGEH LIKE T527X-ORGEH,
       ORGTX LIKE T527X-ORGTX,
       END OF IT_T527X.
DATA : BEGIN OF IT_T503T OCCURS 0,
       PERSK TYPE T503T-PERSK,
       PTEXT TYPE T503T-PTEXT,
       END OF IT_T503T.
DATA : BEGIN OF IT_FINAL OCCURS 0,
       PERNR LIKE PA0001-PERNR,
       ENAME LIKE PA0001-ENAME,
       LDATE LIKE TEVEN-LDATE,
       TPROG LIKE PTPSP-TPROG,
       LTIMEI LIKE TEVEN-LTIME,
       LTIMEO LIKE TEVEN-LTIME,
       ORGTX LIKE T527X-ORGTX,
       PTEXT TYPE T503T-PTEXT,
       ATEXT TYPE ABWTXT,
       END OF IT_FINAL.
DATA : IT_PTPSP LIKE PTPSP OCCURS 0 WITH HEADER LINE.
*Table to get Holiday
DATA : IT_ISCAL_DAY LIKE ISCAL_DAY OCCURS 0 WITH HEADER LINE.
DATA : IT_T554T TYPE T554T OCCURS 0 WITH HEADER LINE.
*ALV data declarations
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,
      X_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,
      GD_LAYOUT    TYPE SLIS_LAYOUT_ALV,
      GD_REPID     LIKE SY-REPID.
*For ALV Events
DATA : IT_EVENT1 TYPE SLIS_T_EVENT.
*For ALV Events
DATA : IT_EVENT TYPE SLIS_ALV_EVENT.
*For ALV top of page
DATA : IT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
*For top of page heading
DATA : IT_LINE TYPE SLIS_LISTHEADER.
Variables declaration                                         *
DATA : V_SHIFT LIKE PTPSP-TPROG,
       V_TEMP TYPE I,
       V_DATE TYPE DATUM,
       V_LDATE TYPE SY-DATUM,
       V_MODIF TYPE HIDENT,
       V_SUBTY TYPE PA2002-SUBTY,
       V_ENDDA TYPE CHAR10.
SELECTION SCREEN                                              *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_PERNR FOR TEVEN-PERNR,
                 S_DATE  FOR TEVEN-LDATE no-extension,
                 S_ORGEH FOR PA0001-ORGEH,
                 S_WERKS FOR PA0001-WERKS,
                 S_BTRTL FOR PA0001-BTRTL,
                 S_PERSK FOR PA0001-PERSK,
                 S_STAT2 FOR PA0000-STAT2.
SELECTION-SCREEN END OF BLOCK B1.
           A T   S E L E C T I O N   S C R E E N                     *
*validatating Selection Screen
AT SELECTION-SCREEN ON S_PERNR.
*Validate the User entered year
  PERFORM VALIDATE_PERNR.
AT SELECTION-SCREEN ON S_DATE.
*Validate the User entered date
  PERFORM VALIDATE_DATE_LOW.
AT SELECTION-SCREEN ON S_ORGEH.
*Validate the User entered year
  PERFORM VALIDATE_ORGEH.
AT SELECTION-SCREEN ON S_PERSK.
*Validate the User entered year
  PERFORM VALIDATE_PERSK.
AT SELECTION-SCREEN ON S_WERKS.
*Validate the User entered Personnel area
  PERFORM VALIDATE_WERKS.
START OF SELECTION                                             *
START-OF-SELECTION.
*Get data
  PERFORM GET_DATA.
*Process data
  PERFORM PROCESS_DATA.
              E N D    O F     S E L E C T I O N                    *
END-OF-SELECTION.
  PERFORM BUILD_FIELDCATALOG.
  PERFORM BUILD_LAYOUT.
*For ALV Events
  PERFORM ALV_EVENTS.
  PERFORM DISPLAY_ALV_REPORT.
*&      Form  VALIDATE_YEAR
      Validating the year
FORM VALIDATE_PERNR .
  IF NOT S_PERNR IS INITIAL.
    SELECT SINGLE * FROM PA0001 WHERE PERNR IN S_PERNR.     "#EC *
    IF SY-SUBRC <> 0.
      MESSAGE E000 WITH 'Enter valid Employee Number'(002).
    ENDIF.
  ENDIF.
ENDFORM.                    " VALIDATE_pernr
*&      Form  VALIDATE_YEAR
      Validating the year
FORM VALIDATE_ORGEH .
  DATA: V_ORGEH LIKE T527X-ORGEH.
  IF NOT S_ORGEH IS INITIAL.
    SELECT SINGLE ORGEH FROM T527X INTO V_ORGEH WHERE ORGEH IN S_ORGEH.
    IF SY-SUBRC <> 0.
      MESSAGE E000 WITH 'Enter Valid Organization Unit'(003).
    ENDIF.
  ENDIF.
ENDFORM.                    " VALIDATE_orgeh
*&      Form  GET_DATA
      Get data
FORM GET_DATA.
  SELECT PERNR
         FROM PA0000
         INTO TABLE IT_PA0000
         WHERE PERNR IN S_PERNR
         AND   ENDDA GE S_DATE-LOW
         AND   BEGDA LE S_DATE-HIGH
         AND   STAT2 IN S_STAT2.
  IF SY-SUBRC = 0.
    DELETE ADJACENT DUPLICATES FROM IT_PA0000 COMPARING PERNR.
    SORT IT_PA0000.
  ENDIF.
  IF NOT IT_PA0000[] IS INITIAL.
    SELECT PERNR
           ENDDA
           WERKS
           BTRTL
           ORGEH
           PERSK
           ENAME
           FROM PA0001
           INTO TABLE IT_PA0001
           FOR ALL ENTRIES IN IT_PA0000
           WHERE PERNR = IT_PA0000-PERNR
           AND   ENDDA GE S_DATE-LOW
           AND   BEGDA LE S_DATE-HIGH
           AND   ORGEH IN S_ORGEH
           AND   WERKS IN S_WERKS
           AND   PERSK IN S_PERSK
           AND   BTRTL IN S_BTRTL.
    IF SY-SUBRC = 0.
      SORT IT_PA0001 BY PERNR ENDDA DESCENDING.
      DELETE ADJACENT DUPLICATES FROM IT_PA0001 COMPARING PERNR.
      SORT IT_PA0001 BY PERNR.
    ENDIF.
  ENDIF.
  IF NOT IT_PA0001[] IS INITIAL.
    SELECT PERNR
           LDATE
           LTIME
           SATZA
           FROM TEVEN
           INTO TABLE IT_TEVEN
           FOR ALL ENTRIES IN IT_PA0001
           WHERE PERNR = IT_PA0001-PERNR
           AND   SATZA = 'P10'
           AND   LDATE IN S_DATE
           AND   STOKZ NE 'X'.
    IF SY-SUBRC = 0.
      SORT IT_TEVEN BY PERNR LDATE.
    ENDIF.
  ENDIF.
  IF NOT IT_PA0001[] IS INITIAL.
v_date = s_date-high + 1.
    SELECT PERNR
           LDATE
           LTIME
           SATZA
           FROM TEVEN
           INTO TABLE IT_TEVEN1
           FOR ALL ENTRIES IN IT_PA0001
           WHERE PERNR = IT_PA0001-PERNR
           AND   SATZA = 'P20'
           AND  ( LDATE IN S_DATE or ldate = v_date )
           AND   STOKZ NE 'X'.
    IF SY-SUBRC = 0.
      SORT IT_TEVEN1 BY PERNR LDATE.
    ENDIF.
  ENDIF.
  IF NOT IT_PA0001[] IS INITIAL.
    SELECT ORGEH
           ORGTX
           FROM T527X
           INTO TABLE IT_T527X
           FOR ALL ENTRIES IN IT_PA0001
           WHERE ORGEH = IT_PA0001-ORGEH.
    IF SY-SUBRC = 0.
      SORT IT_T527X BY ORGEH.
    ENDIF.
  ENDIF.
  IF NOT IT_PA0001[] IS INITIAL.
    SELECT PERSK
           PTEXT
           FROM T503T
           INTO TABLE IT_T503T
           FOR ALL ENTRIES IN IT_PA0001
           WHERE PERSK = IT_PA0001-PERSK
           AND   SPRSL = 'E'.
    IF SY-SUBRC = 0.
      SORT IT_T503T BY PERSK.
    ENDIF.
  ENDIF.
  SELECT *
         FROM T554T
         INTO TABLE IT_T554T
         WHERE SPRSL = 'EN'
         AND   MOABW = '40'.
ENDFORM.                    " GET_DATA
*&      Form  PROCESS_DATA
      Process data
FORM PROCESS_DATA .
  V_TEMP = S_DATE-HIGH - S_DATE-LOW.
  V_TEMP = V_TEMP + 1.
  LOOP AT IT_PA0001.
    V_DATE = S_DATE-LOW.
    DO V_TEMP TIMES.
*Get employee work schedule
      IF IT_PTPSP[] IS INITIAL.
        PERFORM GET_SCHEDULE.
      ENDIF.
*Get holiday calendar
      IF IT_ISCAL_DAY[] IS INITIAL.
        PERFORM GET_HOLIDAY.
      ENDIF.
      CLEAR : V_SUBTY.
      SELECT SINGLE SUBTY
                    FROM PA2001
                    INTO V_SUBTY
                    WHERE PERNR = IT_PA0001-PERNR
                    AND   ENDDA GE V_DATE
                    AND   BEGDA LE V_DATE.
      IF SY-SUBRC = 0.
        READ TABLE IT_T554T WITH KEY AWART = V_SUBTY.
        IT_FINAL-ATEXT = IT_T554T-ATEXT.
      ENDIF.
      IF V_SUBTY IS INITIAL.
        SELECT SINGLE SUBTY
                      FROM PA2002
                      INTO V_SUBTY
                      WHERE PERNR = IT_PA0001-PERNR
                      AND   ENDDA GE V_DATE
                      AND   BEGDA LE V_DATE.
        IF SY-SUBRC = 0.
          IF V_SUBTY = '1000' OR V_SUBTY = '2000'.
            IT_FINAL-ATEXT = 'Training'.
          ELSEIF V_SUBTY = '3000'.
            IT_FINAL-ATEXT = 'Tour'.
          ENDIF.
        ENDIF.
      ENDIF.
*Get the employee shift schedule for that date
      CLEAR : V_SHIFT.
      READ TABLE IT_PTPSP WITH KEY DATUM = V_DATE.
      IF SY-SUBRC = 0.
        V_SHIFT = IT_PTPSP-TPROG.
        IF IT_PTPSP-TAGTY = '1'.
          V_SHIFT = 'NOFF'.
        ENDIF.
      ENDIF.
      IF V_SHIFT = ''.
        CLEAR IT_FINAL.
        CONTINUE.
      ENDIF.
*Check for holiday
      IT_FINAL-TPROG = V_SHIFT.
      READ TABLE IT_ISCAL_DAY WITH KEY DATE = V_DATE.
      IF SY-SUBRC = 0.
        IT_FINAL-TPROG = 'H'.
      ENDIF.
      IT_FINAL-PERNR = IT_PA0001-PERNR.
      IT_FINAL-ENAME = IT_PA0001-ENAME.
      IT_FINAL-LDATE = V_DATE.
*To get the organization unit
      READ TABLE IT_T527X WITH KEY ORGEH = IT_PA0001-ORGEH
                                   BINARY SEARCH.
      IF SY-SUBRC = 0.
        IT_FINAL-ORGTX = IT_T527X-ORGTX.
      ENDIF.
      CLEAR IT_T503T.
      READ TABLE IT_T503T WITH KEY PERSK = IT_PA0001-PERSK
                                   BINARY SEARCH.
      IF SY-SUBRC = 0.
        IT_FINAL-PTEXT = IT_T503T-PTEXT.
      ENDIF.
V_LDATE = v_DATE + 1.
*To get Punch-in.
      READ TABLE IT_TEVEN WITH KEY PERNR = IT_PA0001-PERNR
                                   LDATE = V_DATE
                                   BINARY SEARCH.
      IF SY-SUBRC = 0.
        IT_FINAL-LTIMEI = IT_TEVEN-LTIME.endif.
*To get Punch-out
        READ TABLE IT_TEVEN1 WITH KEY PERNR = IT_PA0001-PERNR
                                      LDATE = v_DATE
                                      BINARY SEARCH.
        IF SY-SUBRC = 0.
          IF IT_TEVEN1-LTIME > IT_FINAL-LTIMEI.
            IT_FINAL-LTIMEO = IT_TEVEN1-LTIME.
          ELSE.
            SELECT SINGLE LTIME
                          FROM TEVEN
                          INTO IT_FINAL-LTIMEO
                          WHERE PERNR = IT_PA0001-PERNR
                          AND   LDATE = v_DATE
                          AND   LTIME > IT_TEVEN1-LTIME
                          AND   SATZA = 'P20'
                          AND   STOKZ NE 'X'.
          ENDIF.
        ENDIF.
        IF IT_FINAL-LTIMEO IS INITIAL.
          IF V_SHIFT = 'NNIG' OR V_SHIFT = 'NAFT'..
            READ TABLE IT_TEVEN1 WITH KEY PERNR = IT_PA0001-PERNR
                                          LDATE =  V_LDATE
                                          BINARY SEARCH.
            IF SY-SUBRC = 0.
              IT_FINAL-LTIMEO = IT_TEVEN1-LTIME.
            ENDIF.
          ENDIF.
        ENDIF.
        if ( V_SHIFT = 'NOFF' OR IT_FINAL-TPROG = 'H' )
        and it_final-ltimei is initial and it_final-ltimeo is not initial.
        clear: it_final-ltimeo.endif.
       APPEND IT_FINAL.
     ELSE.
*If holiday or OFF or Tour or Absent
        IF V_SHIFT = 'NOFF' OR IT_FINAL-TPROG = 'H'
        or it_final-atext is not initial or
        ( it_final-ltimei is not initial and it_final-ltimeo is not initial ).
         APPEND IT_FINAL.
       ELSEIF IT_FINAL-ATEXT IS NOT INITIAL.
         APPEND IT_FINAL.
        ELSE.
          IT_FINAL-ATEXT = 'Absent'.
         APPEND IT_FINAL.
        ENDIF.
    ENDIF.
          APPEND IT_FINAL.
      CLEAR : IT_FINAL.
      V_DATE = V_DATE + 1.
    ENDDO.
    CLEAR : IT_PTPSP[],
            IT_ISCAL_DAY[].
  ENDLOOP.
  SORT IT_FINAL BY PERNR LDATE.
  LOOP AT IT_FINAL.
    TRANSLATE IT_FINAL-ATEXT TO UPPER CASE.
    MODIFY IT_FINAL INDEX SY-TABIX.
  ENDLOOP.
ENDFORM.                    " PROCESS_DATA
*&      Form  GET_SCHEDULE
      Get employee work schedule
FORM GET_SCHEDULE.
  CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'
    EXPORTING
      PERNR         = IT_PA0001-PERNR
      BEGDA         = S_DATE-LOW
      ENDDA         = S_DATE-HIGH
    TABLES
      PERWS         = IT_PTPSP
    EXCEPTIONS
      ERROR_OCCURED = 1
      ABORT_OCCURED = 2
      OTHERS        = 3.
  IF SY-SUBRC <> 0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " GET_SCHEDULE
*&      Form  build_fieldcatalog
FORM BUILD_FIELDCATALOG .
  X_FIELDCATALOG-COL_POS     = 1.
  X_FIELDCATALOG-FIELDNAME   = 'PERNR'.
  X_FIELDCATALOG-SELTEXT_L   = 'Personnel No'(006).
  X_FIELDCATALOG-DDICTXT = 'L'.
  APPEND X_FIELDCATALOG TO FIELDCATALOG.
  CLEAR  X_FIELDCATALOG.
  X_FIELDCATALOG-COL_POS     = 2.
  X_FIELDCATALOG-FIELDNAME   = 'ENAME'.
  X_FIELDCATALOG-SELTEXT_L   = 'Employee Name'(007).
  X_FIELDCATALOG-DDICTXT = 'L'.
  APPEND X_FIELDCATALOG TO FIELDCATALOG.
  CLEAR  X_FIELDCATALOG.
  X_FIELDCATALOG-COL_POS     = 5.
  X_FIELDCATALOG-FIELDNAME   = 'LDATE'.
  X_FIELDCATALOG-SELTEXT_L   = 'Date'(008).
  X_FIELDCATALOG-DDICTXT = 'L'.
  APPEND X_FIELDCATALOG TO FIELDCATALOG.
  CLEAR  X_FIELDCATALOG.
  X_FIELDCATALOG-COL_POS     = 6.
  X_FIELDCATALOG-FIELDNAME   = 'TPROG'.
  X_FIELDCATALOG-SELTEXT_L   = 'Planned Shift'(009).
  X_FIELDCATALOG-DDICTXT = 'L'.
  APPEND X_FIELDCATALOG TO FIELDCATALOG.
  CLEAR  X_FIELDCATALOG.
  X_FIELDCATALOG-COL_POS     = 7.
  X_FIELDCATALOG-FIELDNAME   = 'LTIMEI'.
  X_FIELDCATALOG-SELTEXT_L   = 'Attended Time-In'(010).
  X_FIELDCATALOG-DDICTXT = 'L'.
  APPEND X_FIELDCATALOG TO FIELDCATALOG.
  CLEAR  X_FIELDCATALOG.
  X_FIELDCATALOG-COL_POS     = 8.
  X_FIELDCATALOG-FIELDNAME   = 'LTIMEO'.
  X_FIELDCATALOG-SELTEXT_L   = 'Attended Time-Out'(011).
  X_FIELDCATALOG-DDICTXT = 'L'.
  APPEND X_FIELDCATALOG TO FIELDCATALOG.
  CLEAR  X_FIELDCATALOG.
  X_FIELDCATALOG-COL_POS     = 3.
  X_FIELDCATALOG-FIELDNAME   = 'ORGTX'.
  X_FIELDCATALOG-SELTEXT_L   = 'Organization Unit'(005).
  X_FIELDCATALOG-DDICTXT = 'L'.
  APPEND X_FIELDCATALOG TO FIELDCATALOG.
  CLEAR  X_FIELDCATALOG.
  X_FIELDCATALOG-COL_POS     = 4.
  X_FIELDCATALOG-FIELDNAME   = 'PTEXT'.
  X_FIELDCATALOG-SELTEXT_L   = 'Emp Subgroup'(016).
  X_FIELDCATALOG-DDICTXT = 'L'.
  APPEND X_FIELDCATALOG TO FIELDCATALOG.
  CLEAR  X_FIELDCATALOG.
  X_FIELDCATALOG-COL_POS     = 9.
  X_FIELDCATALOG-FIELDNAME   = 'ATEXT'.
  X_FIELDCATALOG-SELTEXT_L   = 'Leaves/Tours'(015).
  X_FIELDCATALOG-DDICTXT = 'L'.
  X_FIELDCATALOG-OUTPUTLEN = '25'.
  APPEND X_FIELDCATALOG TO FIELDCATALOG.
  CLEAR  X_FIELDCATALOG.
ENDFORM.                    " build_fieldcatalog
*&      Form  build_layout
FORM BUILD_LAYOUT.
  GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  GD_LAYOUT-ZEBRA = 'X'.
ENDFORM.                    " build_layout
*&      Form  ALV_EVENTS
      For ALV Events
FORM ALV_EVENTS .
  IT_EVENT-NAME = 'TOP_OF_PAGE'.
  IT_EVENT-FORM = 'TOP_OF_PAGE'.
  APPEND IT_EVENT TO IT_EVENT1.
ENDFORM.                    " ALV_EVENTS
*&      Form TOP_OF_PAGE
      ALV TOP-OF-PAGE
FORM TOP_OF_PAGE.                                           "#EC CALLED
  REFRESH : IT_LIST_TOP_OF_PAGE.
  CLEAR : IT_LINE.
  IT_LINE-TYP  = 'H'.
  IT_LINE-INFO = 'Attendance Report for the Period'(013).
  APPEND IT_LINE TO IT_LIST_TOP_OF_PAGE.
  CONCATENATE S_DATE-LOW6(2) '.' S_DATE-LOW4(2) '.' S_DATE-LOW+0(4)
       INTO IT_LINE-INFO.
  CONCATENATE S_DATE-HIGH6(2) '.'  S_DATE-HIGH4(2) '.' S_DATE-HIGH+0(4) INTO V_ENDDA.
  CONCATENATE IT_LINE-INFO '-' V_ENDDA INTO IT_LINE-INFO SEPARATED BY SPACE.
  APPEND IT_LINE TO IT_LIST_TOP_OF_PAGE.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY = IT_LIST_TOP_OF_PAGE.
ENDFORM.                               "TOP_OF_PAGE
*&      Form  display_alv_report
FORM DISPLAY_ALV_REPORT.
  GD_REPID = SY-REPID.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = GD_REPID
      IT_EVENTS          = IT_EVENT1
      IS_LAYOUT          = GD_LAYOUT
      IT_FIELDCAT        = FIELDCATALOG
    TABLES
      T_OUTTAB           = IT_FINAL
    EXCEPTIONS
      PROGRAM_ERROR      = 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.
ENDFORM.                    "display_alv_report
*&      Form  VALIDATE_PERSK
      text
-->  p1        text
<--  p2        text
FORM VALIDATE_PERSK .
  IF NOT S_PERSK IS INITIAL.
    SELECT SINGLE * FROM T503K WHERE PERSK IN S_PERSK.      "#EC *
    IF SY-SUBRC <> 0.
      MESSAGE E000 WITH 'Enter valid Employee subgroup'(012).
    ENDIF.
  ENDIF.
ENDFORM.                    " VALIDATE_PERSK
*&      Form  VALIDATE_WERKS
      Validate user Entered Personnel area
FORM VALIDATE_WERKS .
  IF S_WERKS[] IS NOT INITIAL.
    SELECT SINGLE * FROM T500P WHERE PERSA IN S_WERKS.
    IF SY-SUBRC <> 0.
      MESSAGE E000 WITH 'Enter valid Personnel Area'(014).
    ENDIF.
  ENDIF.
ENDFORM.                    " VALIDATE_WERKS
*&      Form  VALIDATE_DATE_LOW
      Validate user Entered Date
FORM VALIDATE_DATE_LOW .
  IF S_DATE-LOW IS INITIAL.
    MESSAGE E000 WITH 'Enter Date'(004).
  ENDIF.
  IF S_DATE-HIGH IS INITIAL.
    MESSAGE E000 WITH 'Enter Date'(004).
  ENDIF.
ENDFORM.                    " VALIDATE_DATE_LOW
*&      Form  GET_HOLIDAY
        Get Holiday
FORM GET_HOLIDAY .
  CLEAR V_MODIF.
  SELECT SINGLE MOFID
                FROM T001P
                INTO V_MODIF
                WHERE WERKS = IT_PA0001-WERKS
                AND   BTRTL = IT_PA0001-BTRTL.
  CALL FUNCTION 'HOLIDAY_GET'
    EXPORTING
      HOLIDAY_CALENDAR           = V_MODIF
      DATE_FROM                  = S_DATE-LOW
      DATE_TO                    = S_DATE-HIGH
    TABLES
      HOLIDAYS                   = IT_ISCAL_DAY
    EXCEPTIONS
      FACTORY_CALENDAR_NOT_FOUND = 1
      HOLIDAY_CALENDAR_NOT_FOUND = 2
      DATE_HAS_INVALID_FORMAT    = 3
      DATE_INCONSISTENCY         = 4
      OTHERS                     = 5.
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " GET_HOLIDAY
<b>Reward Points if useful.</b>

Similar Messages

  • Mobile phone - SAP interface (pls treat this as urgent)

    Hi SD Champs,
    Can you pls throw some light -
    Our client want to capture sales data like quotations or sales orders from field Sales employees via their mobile phones.
    Which SAP solution / process is best for this ???
    Kindly forward some documentation or links which can help me to [email protected]
    Thanks in advance
    Rajesh
    Edited by: Rajesh Dangle on Dec 31, 2007 3:09 PM

    Also suggest about the resource requirements / infrastructure required for this.
    Regards
    Rajesh

  • Need case studies and sample code for all concept of ABAP

    Hello,
           Can anybody provide me the case studies and sample code for learning different concepts in ABAP programming like: module pool, ALV, interactive reports, BDC, Smart Form etc.? As I want to do some practical application by which i can learn more.
    Thanks & Regards,
    Vikram Rawal

    In this link You can find Step by Step Scren Shot document :
    http://www.201interviewquestions.com/docs/User%20exits.ppt
    http://erpgenie.com/abaptips/component/option,com_docman/task,doc_details/gid,27/
    <b>
    Reprots</b>
    http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    <b>Dictionary</b>
    http://sapabap.iespana.es/sapabap/manuales/learnabap/
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb6e446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ea31446011d189700000e8322d00/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf
    <b>ABAP objects</b>
    Please check this online document (starting page 1291).
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    Also check this links as well.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.futureobjects.de/content/intro_oo_e.html
    http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
    /people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
    <b>
    SAPScripts</b>
    http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
    http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
    http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
    http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
    http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
    http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
    SAP SCRIPT FIELDS
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
    scripts easy material
    http://www.allsaplinks.com/sap_script_made_easy.html
    Check these step-by-step links
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    <b>Smartforms material</b>
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    http://www.sap-img.com/smartforms/smartform-tutorial.htm
    http://www.sapgenie.com/abap/smartforms.htm
    How to trace smartform
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF
    http://www.sap-img.com/smartforms/smart-006.htm
    http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm
    Re: Need FAQ's
    check most imp link
    http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    <b>
    BAPI</b>
    http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sapgenie.com/abap/bapi/example.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
    <b>List of all BAPIs</b>
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    http://www.planetsap.com/Bapi_main_page.htm
    http://www.topxml.com/sap/sap_idoc_xml.asp
    http://www.sapdevelopment.co.uk/
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    <b>ALV programs.</b>
    http://www.geocities.com/mpioud/Abap_programs.html
    . How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    <b>ALV</b>
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    <b>Top-of-page in ALV</b>
    selection-screen and top-of-page in ALV
    <b>ALV Group Heading</b>
    http://www.sap-img.com/fu037.htm
    <b>ALV</b>
    http://www.geocities.com/mpioud/Abap_programs.html
    <b>
    RFC Destination</b>
    Re: SM59
    <b>
    ALE/ IDOC</b>http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapgenie.com/sapedi/idoc_abap.htm
    http://www.allsaplinks.com/idoc_sample.html
    http://www.sappoint.com/abap.html
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.allsaplinks.com/idoc_sample.html
    <b>Table Control</b>
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
    <b>
    ABAP transactions</b>
    http://www.easymarketplace.de/transactions-a-e.php?Area=4soi&name=volker&pw=vg&
    Regards,
    Priyanka.

  • Sample Code for CRM enhancement in BADI

    hi,
      can anybody please give me sample code for BADI for CRM enhancement.
    i have added couple of z field in a extract structure. now i have to write code in BADI to populate those fields.
    please do not send code for user exit.
    Regards
    Subrata

    Hi Aviral,
    Please consider below thread :
    http://scn.sap.com/thread/2069370
    Best regards - Christophe

  • ABAP Sample code for HR_MAINTAIN_MASTERDATA

    Hi folks,
    I want to delimit a record in the HR master Table wi the help of Function Module HR_MAINTAIN_MASTERDATA, but its not updating HR master table correctly so please send me some sample code for that function module.
    usefull points will rewarded.
    Reg,
    Hariharan

    hi
    good
    check with this code
    Call update function module:
          CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
            EXPORTING
              PERNR           = SS300_0001T-PERNR
              ACTIO           = OPERATION
              BEGDA           = VALIDITYBEGIN
              ENDDA           = '99991231'
              SUBTY           = SPACE
              NO_ENQUEUE      = SPACE
            IMPORTING
              RETURN1         = RETURN
            TABLES
              PROPOSED_VALUES = VALUES
            MODIFIED_KEYS   =
            EXCEPTIONS
              OTHERS          = 1.
          IF RETURN IS INITIAL.
            CONCATENATE SS300_0002-VORNA SS300_0002-NACHN
              INTO ENAME SEPARATED BY SPACE.
            CONDENSE ENAME.
            MESSAGE S006 WITH ENAME SPACE.
          ELSE.
            MESSAGE ID     RETURN-ID
                    TYPE   'S'
                    NUMBER RETURN-NUMBER
                    WITH   RETURN-MESSAGE_V1 RETURN-MESSAGE_V2
                           RETURN-MESSAGE_V3 RETURN-MESSAGE_V4.
          ENDIF.
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0ce464dc8b11d2803800c04f99fbf0/content.htm
    reward point if helpful.
    thanks
    mrutyun^

  • Hi guys please give me sample code for call transaction that handles error

    hi guys, please give me sample code for call transaction that handles error,
    please send me the sample code in which there should be all decleration part and everything, based on the sample code i will develop my code.
    please do help me as it is urgent.
    thanks and regards.
    prasadnn.

    Hi Prasad,
    Check this code.
    Source Code for BDC using Call Transaction
    *Code used to create BDC
    *& Report  ZBDC_EXAMPLE                                                *
    *& Example BDC program, which updates net price of item 00010 of a     *
    *& particular Purchase order(EBELN).                                   *
    REPORT  ZBDC_EXAMPLE  NO STANDARD PAGE HEADING
                          LINE-SIZE 132.
    Data declaration
    TABLES: ekko, ekpo.
    TYPES: BEGIN OF t_ekko,
        ebeln TYPE ekko-ebeln,
        waers TYPE ekko-waers,
        netpr TYPE ekpo-netpr,
        err_msg(73) TYPE c,
    END OF t_ekko.
    DATA: it_ekko  TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko  TYPE t_ekko,
          it_error TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_error TYPE t_ekko,
          it_success TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_success TYPE t_ekko.
    DATA: w_textout            LIKE t100-text.
    DATA: gd_update TYPE i,
          gd_lines TYPE i.
    *Used to store BDC data
    DATA: BEGIN OF bdc_tab OCCURS 0.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdc_tab.
    *Used to stores error information from CALL TRANSACTION Function Module
    DATA: BEGIN OF messtab OCCURS 0.
            INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END OF messtab.
    *Screen declaration
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
                                        TITLE text-001. "Purchase order Num
    SELECT-OPTIONS: so_ebeln FOR ekko-ebeln OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK block1.
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME
                                        TITLE text-002. "New NETPR value
    PARAMETERS:  p_newpr(14)   TYPE c obligatory.  "LIKE ekpo-netpr.
    SELECTION-SCREEN END OF BLOCK block2.
    *START-OF-SELECTION
    START-OF-SELECTION.
    Retrieve data from Purchase order table(EKKO)
      SELECT ekkoebeln ekkowaers ekpo~netpr
        INTO TABLE it_ekko
        FROM ekko AS ekko INNER JOIN ekpo AS ekpo
          ON ekpoebeln EQ ekkoebeln
       WHERE ekko~ebeln IN so_ebeln AND
             ekpo~ebelp EQ '10'.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Check data has been retrieved ready for processing
      DESCRIBE TABLE it_ekko LINES gd_lines.
      IF gd_lines LE 0.
      Display message if no data has been retrieved
        MESSAGE i003(zp) WITH 'No Records Found'(001).
        LEAVE TO SCREEN 0.
      ELSE.
      Update Customer master data (instalment text)
        LOOP AT it_ekko INTO wa_ekko.
          PERFORM bdc_update.
        ENDLOOP.
      Display message confirming number of records updated
        IF gd_update GT 1.
          MESSAGE i003(zp) WITH gd_update 'Records updated'(002).
        ELSE.
          MESSAGE i003(zp) WITH gd_update 'Record updated'(003).
        ENDIF.
    Display Success Report
      Check Success table
        DESCRIBE TABLE it_success LINES gd_lines.
        IF gd_lines GT 0.
        Display result report column headings
          PERFORM display_column_headings.
        Display result report
          PERFORM display_report.
        ENDIF.
    Display Error Report
      Check errors table
        DESCRIBE TABLE it_error LINES gd_lines.
      If errors exist then display errors report
        IF gd_lines GT 0.
        Display errors report
          PERFORM display_error_headings.
          PERFORM display_error_report.
        ENDIF.
      ENDIF.
    *&      Form  DISPLAY_COLUMN_HEADINGS
          Display column headings
    FORM display_column_headings.
      WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
      SKIP.
      WRITE:2 'The following records updated successfully:'(013).
      WRITE:/ sy-uline(42).
      FORMAT COLOR COL_HEADING.
      WRITE:/      sy-vline,
              (10) 'Purchase Order'(004), sy-vline,
              (11) 'Old Netpr'(005), sy-vline,
              (11) 'New Netpr'(006), sy-vline.
      WRITE:/ sy-uline(42).
    ENDFORM.                    " DISPLAY_COLUMN_HEADINGS
    *&      Form  BDC_UPDATE
          Populate BDC table and call transaction ME22
    FORM bdc_update.
      PERFORM dynpro USING:
          'X'   'SAPMM06E'        '0105',
          ' '   'BDC_CURSOR'      'RM06E-BSTNR',
          ' '   'RM06E-BSTNR'     wa_ekko-ebeln,
          ' '   'BDC_OKCODE'      '/00',                      "OK code
          'X'   'SAPMM06E'        '0120',
          ' '   'BDC_CURSOR'      'EKPO-NETPR(01)',
          ' '   'EKPO-NETPR(01)'  p_newpr,
          ' '   'BDC_OKCODE'      '=BU'.                      "OK code
    Call transaction to update customer instalment text
      CALL TRANSACTION 'ME22' USING bdc_tab MODE 'N' UPDATE 'S'
             MESSAGES INTO messtab.
    Check if update was succesful
      IF sy-subrc EQ 0.
        ADD 1 TO gd_update.
        APPEND wa_ekko TO it_success.
      ELSE.
      Retrieve error messages displayed during BDC update
        LOOP AT messtab WHERE msgtyp = 'E'.
        Builds actual message based on info returned from Call transaction
          CALL FUNCTION 'MESSAGE_TEXT_BUILD'
               EXPORTING
                    msgid               = messtab-msgid
                    msgnr               = messtab-msgnr
                    msgv1               = messtab-msgv1
                    msgv2               = messtab-msgv2
                    msgv3               = messtab-msgv3
                    msgv4               = messtab-msgv4
               IMPORTING
                    message_text_output = w_textout.
        ENDLOOP.
      Build error table ready for output
        wa_error = wa_ekko.
        wa_error-err_msg = w_textout.
        APPEND wa_error TO it_error.
        CLEAR: wa_error.
      ENDIF.
    Clear bdc date table
      CLEAR: bdc_tab.
      REFRESH: bdc_tab.
    ENDFORM.                    " BDC_UPDATE
          FORM DYNPRO                                                   *
          stores values to bdc table                                    *
    -->  DYNBEGIN                                                      *
    -->  NAME                                                          *
    -->  VALUE                                                         *
    FORM dynpro USING    dynbegin name value.
      IF dynbegin = 'X'.
        CLEAR bdc_tab.
        MOVE:  name TO bdc_tab-program,
               value TO bdc_tab-dynpro,
               'X'  TO bdc_tab-dynbegin.
        APPEND bdc_tab.
      ELSE.
        CLEAR bdc_tab.
        MOVE:  name TO bdc_tab-fnam,
               value TO bdc_tab-fval.
        APPEND bdc_tab.
      ENDIF.
    ENDFORM.                               " DYNPRO
    *&      Form  DISPLAY_REPORT
          Display Report
    FORM display_report.
      FORMAT COLOR COL_NORMAL.
    Loop at data table
      LOOP AT it_success INTO wa_success.
        WRITE:/      sy-vline,
                (10) wa_success-ebeln, sy-vline,
                (11) wa_success-netpr CURRENCY wa_success-waers, sy-vline,
                (11) p_newpr, sy-vline.
        CLEAR: wa_success.
      ENDLOOP.
      WRITE:/ sy-uline(42).
      REFRESH: it_success.
      FORMAT COLOR COL_BACKGROUND.
    ENDFORM.                    " DISPLAY_REPORT
    *&      Form  DISPLAY_ERROR_REPORT
          Display error report data
    FORM display_error_report.
      LOOP AT it_error INTO wa_error.
        WRITE:/      sy-vline,
                (10) wa_error-ebeln, sy-vline,
                (11) wa_error-netpr CURRENCY wa_error-waers, sy-vline,
                (73) wa_error-err_msg, sy-vline.
      ENDLOOP.
      WRITE:/ sy-uline(104).
      REFRESH: it_error.
    ENDFORM.                    " DISPLAY_ERROR_REPORT
    *&      Form  DISPLAY_ERROR_HEADINGS
          Display error report headings
    FORM display_error_headings.
      SKIP.
      WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
      SKIP.
      WRITE:2 'The following records failed during update:'(008).
      WRITE:/ sy-uline(104).
      FORMAT COLOR COL_HEADING.
      WRITE:/      sy-vline,
              (10) 'Purchase Order'(009), sy-vline,
              (11) 'Netpr'(010), sy-vline,
              (73) 'Error Message'(012), sy-vline.
      WRITE:/ sy-uline(104).
      FORMAT COLOR COL_NORMAL.
    ENDFORM.                    " DISPLAY_ERROR_HEADINGS
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Need sample code for Using BADI ME_PROCESS_REQ_CUST

    Dear all,
    Initially my requirement is to Validate the Document Type of Purchase Request ion as per material.
    I have created a implementation for BADI : ME_PROCESS_REQ_CUST .
    im new to OOPS-ABAP, so pls send *sample code for how to use these methods PROCESS_ITEM,
    like declarations, assignment of data into internal table  for further validation*.
    Regards,
    NIranjan.G

    Hi,
    get the item data ....
         *DATA : lt_item TYPE MEREQ_ITEM,
                       ls_item liek line of it_item*
             CALL METHOD im_item->GET_DATA
               RECEIVING
                 RE_DATA = lt_item .
    you will get the data in lt_item.. table
    Thanks,
    Shailaja Ainala.

  • Any sample code for an Extractor to read in a flat file?

    Hi SAP gurus,
    Are there any sample code for an extractor to read in a flat file?
    Are there any documentation on custom coding an extractor to dump
    information into an info source?
    Are there any documentation on the pit falls and contraints using Solution
    Manager, the BI tools, particularly on the Info Source?
    Thanks,
    Steve

    Thanks Muppet Mark
    I forgot to mention that I had also tried just fileObject.read() as well and it didn't work either.  It was the same run on sentence result I got with the script I showed above.  Seems odd.  However, the \r instead of \n did the trick.  I had some recollection of another line feed character but couldn't remember what it was, so thanks for that.
    Doug

  • Sample code for connect to database

    Hi
    like to know if there is any sample code for me to follow through to connect to database using ODBC.
    I am currently writing a program in visual c++.
    like to know how to connect database to store image in the database
    using visual c++ code.....
    hope that is not too difficult.

    in JSTL pratical guide for JSP programmers by Sue Spielman
    <sql:setDataSource var="datasource"
    driver="org.gjt.mm.mysql.driver"
    url="jdbc:mysql://localhost/db"
    user="guest"
    password="guest" />
    <sql:query datasource="${datasource}...
    <html>
    <head>
    <title>
    Display Results
    </title>
    </head>
    <body>
    <c:catch var="sqlError">
    <sql:query var="bookList" dataSource="${datasource}">
         SELECT * FROM books WHERE title LIKE 'J%' ORDER BY author
    </sql:query>
    </c:catch>
    <c:if test="${not empty sqlError}" >
    Make sure you have already run the databaseinit.jsp file
    </c:if>
    <h2>Listing all books that start with a 'J', ordered by author</h2>
    <br>
    <table>
    <th>Title</th>
    <th>Author</th>
    <c:forEach var="book" items="${bookList.rows}">
         <tr>
              <td><c:out value="${book.title}" /></td>
              <td><c:out value="${book.author}" /></td>
         </tr>
    </c:forEach>
    </table>
    </table>
    <h2>Show using choose/when/otherwise conditional to display results</h2>
    <table>
    <tr><th>Title</th></tr>
    <c:forEach var="book" varStatus="current" items="${bookList.rows}">
    <tr>
    <c:choose>
         <c:when test="${current.first}" >
              <td><font color="#0000FF"><c:out value="${book.title}"/></font></td>
         </c:when>
         <c:when test="${current.count % 2 == 1 }" >
              <td><font color="#FF0000"><c:out value="${book.title}"/></font></td>
         </c:when>
         <c:otherwise>
              <td><c:out value="${book.title}"/></td>
         </c:otherwise>
    </c:choose>
    </tr>
    </c:forEach>
    </table>
    </body>
    </html>

  • ABAP  Code for SAP exit varaibles?

    Hi,
    i) Where can I find the abap code for SAP exit variables
    OP_KEYDT used for the net due date
    OP_KEYD2 used for the posting date
    OP_KEYD3 used for the clearing date, which are used in FI AR aging report(0FIAR_C03).
    Based on the Net Due Date, which is key date(0NETDUEDATE), entered by the user at runtime, the posting date and celaring date are populated.
    II) The problem is we want to simulate a similar scenario, but with key date, which user enters is based on the custom Net Due Date(ZNETDUEDATE).And this date is populated to posting date and clearing date variables.
    How do we acheive that.
    Thanks.

    Hi Kumar,
    Try this below mentioned example where default date is current date.
    Step1: Create a variable(ex: cur_date) on requrired characteristic with Processing type "Customer Eixt" and check the check box for ready for input(if this variable need in selection screen).
    Step 2: Goto T Code : CMOD and provide appropriate Project and choose components and click on display.
    Step3: Double click on exit "EXIT_SAPLRRS0_001" you can see include "ZXRSRU01", double click on include.
    Step4: Sample code to populate.
    WHEN 'CUR_DATE'.
    Data : l_p_range_SSS TYPE rrrangesid.
    IF I_STEP = 1.
    l_p_range_SSS-Low = sy-datum.
    l_p_range_SSS-Sign = 'I'.
    l_p_range_SSS-Opt = 'EQ'.
    APPEND l_p_range_SSS TO e_t_range.
    Endif.
    The following values are valid for I_STEP:
    · I_STEP = 1
    Call up takes place directly before variable entry
    · I_STEP = 2
    Call up takes place directly after variable entry. This step is only started up when the same variable could not be filled at I_STEP=1.
    · I_STEP = 3
    In this call up, you can check the values of the variables. Triggering an exception (RAISE) causes the variable screen to appear once more. Afterwards, I_STEP=2 is also called up again.
    · I_STEP = 0
    The enhancement is not called from the variable screen. The call up can come from the authorization check or from the Monitor.
    Also, refer this link..
    http://help.sap.com/saphelp_bw320/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htm
    Cheers,
    Allen

  • Exception in running the sample code for XA

    Hi,
    I'm trying out sample code for XA with Two-phase commit operation - X4.java provided in "Oracle8i JDBC Developer's Guide and Reference"
    http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83724/samapp9.htm#1012235
    I'm getting the following exception.
    java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00201: identifier 'JAVA_XA.XA_START' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:407)
         at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:156)
         at orajta.XA4.main(XA4.java:126)
    oracle.jdbc.xa.OracleXAException
         at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:498)
         at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:190)
         at orajta.XA4.main(XA4.java:126)
    What's the reason for the above exception and can someone help me with a possible fix for the same? Your help is greatly appreciated.
    Thanks,
    Haja

    Hi,
    I dont have access to a 8i db, but i ran the sample between two oracle9i db and it ran successfully.
    Regards
    Elango.

  • Sample code for Org Management

    Hi,
             I am new to Org Management coding in HR ABAP.
       Can anybody post some simple sample code for Org. Management so that I can understand the flow of coding..
    Thanks and Regards,
    Ram

    Hi
    see the sample code using Orgn management infotypes like HRP1000 etc
    report zporgr0040
           line-size 108
           line-count 60(1)
           no standard page heading
           message-id zndc.
    Database Tables
    tables: hrp1001,     " HR Master Record (Orgn. Assignment)
            pa0002,      " Personal Data
            t528t,       " Position Texts
            t527x,       " Org Unit Text
            t528b,       " Positions
            csks,        " Cost Center
            cskt.        " Cost Center Texts
    Declaration of Internal Tables
    Internal Table for Orgn Object Data  HRP1000
    data: begin of obj_tab occurs 0,
            otype like hrp1000-otype,      " Object Type
            objid like hrp1000-objid,      " Object ID
            plvar like hrp1000-plvar,      " Plan Version
            istat like hrp1000-istat,      " Planning Status
            begda like hrp1000-begda,      " Begin date
            endda like hrp1000-endda,      " End date
          end of obj_tab.
    Internal Table for Active Employees data PA0000
    data: begin of stat_tab occurs 0,
            pernr like pa0000-pernr,       " Object Type
            begda like pa0000-begda,       " Begin date
            endda like pa0000-endda,       " End date
            stat2 like pa0000-stat2,       " Employment Status
          end of stat_tab.
    Internal Table for Actual Orgn Assignment Data PA0001
    data: begin of act_tab occurs 0,
            pernr like pa0001-pernr,       " Object Type
            begda like pa0001-begda,       " Begin date
            endda like pa0001-endda,       " End date
            kostl like pa0001-kostl,       " Cost Center
            orgeh like pa0001-orgeh,       " Org Unit
            plans like pa0001-plans,       " Position
            natio like pa0002-natio,       " Nationality
          end of act_tab.
    Internal Table for Orgn Data HRP1001
    data: begin of org_tab occurs 0,
            otype like hrp1001-otype,      " Object Type
            objid like hrp1001-objid,      " Object ID
            plvar like hrp1001-plvar,      " Plan Version
            istat like hrp1001-istat,      " Planning Status
            begda like hrp1001-begda,      " Begin date
            endda like hrp1001-endda,      " End date
            subty like hrp1001-subty,      " Sub Type
            sclas like hrp1001-sclas,      " Type of Related Object
            sobid like hrp1001-sobid,      " Id of Related Object
            kostl like pa0001-kostl,       " Cost Center
            plstx like t528t-plstx,        " Position Text
            orgtx like t527x-orgtx,        " Org Unit Text
          end of org_tab.
    Internal Table for Position Calculations
    data: begin of org1_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            objid like hrp1001-objid,      " Object ID
          end of org1_tab.
    Internal Table for Position Calculations
    data: begin of org2_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            count type i,                  " No of Positions
          end of org2_tab.
    Internal Table for Actual Manpower Calculations
    data: begin of act1_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            natio like pa0002-natio,       " Nationality
            plans like pa0001-plans,       " Position
          end of act1_tab.
    Internal Table for Actual Manpower Calculations(UAE)
    data: begin of act2_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            natio like pa0002-natio,       " Nationality
          end of act2_tab.
    Internal Table for Actual Manpower Calculations(Others)
    data: begin of act3_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            natio like pa0002-natio,       " Nationality
          end of act3_tab.
    Internal Table for Actual Manpower Calculations(UAE)
    data: begin of act4_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            count1 type i,                 " No of Positions(UAE)
          end of act4_tab.
    Internal Table for Actual Manpower Calculations(OTHERS)
    data: begin of act5_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            count2 type i,                 " No of Positions(Others)
          end of act5_tab.
    Internal Table for Vaccancies Data
    data: begin of vac_tab occurs 0,
            plvar like hrp1007-plvar,      " Plan Version
            otype like hrp1007-otype,      " Object Type
            objid like hrp1007-objid,      " Object ID
            istat like hrp1007-istat,      " Planning Status
            begda like hrp1007-begda,      " Begin date
            endda like hrp1007-endda,      " End date
            vacan like hrp1007-vacan,      " Vacancy Indicator
            status like hrp1007-status,    " Status of Vacancy
          end of vac_tab.
    Internal Table to store the Report Output data
    data : begin of rep_tab occurs 0 ,
             kostl(10) type n,                  " Cost Cente
             plans   like pa0001-plans,         " Position
             vacan   like hrp1007-vacan,        " Vacancy Indicator
             status  like hrp1007-status,       " Status of Vacancy
             plstx   like t528t-plstx,          " Position Text
             orgtx like t527x-orgtx,            " Org Unit Text
           end of rep_tab.
    Internal Table to store the Report Output data
    data : begin of rep1_tab occurs 0 ,
             kostl(10) type n,                  " Cost Cente
             cnt     type i,                    " No of Vacancies
           end of rep1_tab.
    Internal Table to store the Report Output data
    data : begin of rep2_tab occurs 0 ,
             kostl(10) type n,                  " Cost Cente
             app_no    type i,                  " Approved
             nat_no    type i,                  " National
             exp_no    type i,                  " Expatriate
             tot_no    type i,                  " Total
             vac_no    type i,                  " Vacancies
           end of rep2_tab.
    Declaration of Variables
    data: v_sobid  like hrp1001-sobid,   " Object Id
          v_sobid1 like hrp1001-sobid,   " Object Id
          v_sobid2 like hrp1001-sobid,   " Object Id
          v_sclas  like hrp1001-sclas,   " Related Obj Type
          v_subty  like hrp1001-subty,   " Related Object Id
          v_otype  like hrp1007-otype,   " Object Type
         v_str(9)    type c,            " Text
         v_str1(10)  type c,            " Text
          v_cnt    like sy-tabix.        " Table Index
    Declaration of Constants
    constants : c_x         type c value 'X',            " Flag
                c_stat1  like pa0000-stat2  value '3',   " Emp Status
                c_plan   like hrp1001-plvar value '01',  " Plan Version
                c_name   like hrp1000-uname value 'SAP', " Uname
                c_uae    like pa0002-natio  value 'AE',  " Country
                c_type   like hrp1007-otype  value 'O',  " Object Type
                c_otype  like hrp1007-otype  value 'S',  " Object Type
                c_stat   like hrp1007-status value '0',  " Status
                c_pstat  like hrp1007-istat  value '1',  " Plang Status
                c_sclas  like hrp1001-sclas value 'K',    " Rel. Obj Type
                c_subty  like hrp1001-subty value 'A002', " Related ObjId
                c_subty2 like hrp1001-subty value 'A003', " Related ObjId
                c_sclas1 like hrp1001-sclas value 'O',    " Rel.Obj Type
                c_subty1 like hrp1001-subty value 'A011', " Rel.Object Id
                c_kokrs  like coej-kokrs value '1000'. " Controlling Area
    Selection Screen
    selection-screen begin of block b1 with frame title text-001.
    parameters     :
      p_date  like pa0001-begda obligatory default sy-datum. " Date
    select-options :
      s_kostl for csks-kostl,                     " Cost Center
      s_plans for t528b-plans.                    " Position ID
    selection-screen end of block b1.
    At selection-screen
    at selection-screen.
    Validate the Selection Screen fields
      perform validate_screen.
    Start-of-Selection
    start-of-selection.
    Get the Orgn data from database Table HRP1001
      perform get_org_data.
    Get the Actual Manpower from PA0001
      perform get_act_data.
    Get the Vaccancies data from database Table HRP1007
      perform get_vac_data.
    Append the data into final Internal Table
      perform append_data.
    Top-of-page
    top-of-page.
    Write the Report and Column Headings
      perform top_of_page.
    End-of-Page
    end-of-page.
      write /1(108) sy-uline.
    End-of-Selection
    end-of-selection.
    Display the Output Report.
      perform display_report.
    Form-Routines
    *&      Form  validate_screen
    Validation of selection Screen fields
    form validate_screen.
    Validation of Position ID
      clear t528b.
      if not s_plans[] is initial.
        select single plans
          into t528b-plans
          from t528b
          where plans in s_plans.
        if sy-subrc <> 0.
          message e999 with 'Invalid Position ID'(009).
        endif.
      endif.
    Validation of Cost Center
      clear csks.
      if not s_kostl[] is initial.
        select single kostl
          into csks-kostl
          from csks
          where kostl in s_kostl.
        if sy-subrc <> 0.
          message e999 with 'Invalid Cost Center'(008).
        endif.
      endif.
    endform.                  "validate_screen
    *&      Form  get_org_data
    Get the Orgn Data from Database Table HRP1001
    form get_org_data.
    v_str  = 'Developee'(002).
    v_str1 = 'Deployment'(003).
    Select All the Positions from HRP1000
      select otype       " Object Type
             objid       " Object ID
             plvar       " Plan Version
             istat       " Planning Status
             begda       " Begin date
             endda       " End date
         into table obj_tab
         from hrp1000
         where otype = c_otype  and
               plvar = c_plan   and
               istat = c_pstat  and
               begda le p_date  and
               endda ge p_date  and
               objid in s_plans and
               uname ne c_name.
      sort obj_tab by otype objid.
    Get the Orgn and Cost Center for all the above Positions
      if not obj_tab[] is initial.
        select otype       " Object Type
               objid       " Object ID
               plvar       " Plan Version
               istat       " Planning Status
               begda       " Begin date
               endda       " End date
               subty       " Sub Type
               sclas       " Type of Related Object
               sobid       " Id of Related Object
           into table org_tab
           from hrp1001
           for all entries in obj_tab
           where otype = c_otype  and
                 plvar = c_plan   and
                 istat = c_pstat  and
                 begda le p_date  and
                 endda ge p_date  and
                 sclas eq c_sclas1 and
                 subty eq c_subty2 and
                 objid eq obj_tab-objid.
      endif.
      sort org_tab by otype objid.
    Get the Cost Center
      loop at org_tab.
        v_otype = c_otype.       " S
        v_sclas = c_sclas.       " K
        v_subty = c_subty1.                                     " A011
        v_sobid = org_tab-objid.
        perform get_org using v_otype v_sclas v_subty
                        v_sobid.
        if sy-subrc = 0.
          org_tab-kostl = hrp1001-sobid+0(10).
        else.
          v_otype = c_otype.    " S
          v_sclas = c_sclas1.   " O
          v_subty = c_subty2.                                   " A003
          v_sobid = org_tab-objid.
          perform get_org using v_otype v_sclas v_subty
                         v_sobid.
          if sy-subrc = 0.
            v_otype = c_type.     " O
            v_sclas = c_sclas.    " K
            v_subty = c_subty1.                                 " A011
            v_sobid1 = v_sobid.
            perform get_org using v_otype v_sclas v_subty
                                 v_sobid.
            if sy-subrc <> 0.
              v_otype = c_type.    " O
              v_sclas = c_sclas1.  " O
              v_subty = c_subty.                                " A002
              v_sobid = v_sobid1.
              perform get_org using v_otype v_sclas v_subty
                        v_sobid.
              if sy-subrc = 0.
                v_otype = c_type.   " O
                v_sclas = c_sclas.  " K
                v_subty = c_subty1.                             " A011
                v_sobid2 = v_sobid.
                perform get_org using v_otype v_sclas v_subty
                                 v_sobid.
                if sy-subrc <> 0.
                  v_otype = c_type.   " O
                  v_sclas = c_sclas1. " O
                  v_subty = c_subty.                            " A002
                  v_sobid = v_sobid2.
                  perform get_org using v_otype v_sclas v_subty
                          v_sobid.
                else.
                  org_tab-kostl = hrp1001-sobid+0(10).
                endif.
              endif.
            else.
              org_tab-kostl = hrp1001-sobid+0(10).
            endif.
          else.
            v_otype = c_otype.   " S
            v_sclas = c_otype.   " S
            v_subty = c_subty.                                  " A002
            v_sobid = org_tab-objid.
            perform get_org using v_otype v_sclas v_subty
                           v_sobid.
            if sy-subrc = 0.
              v_otype = c_otype.  " S
              v_sclas = c_sclas.  " K
              v_subty = c_subty1.                               " A011
              v_sobid1 = v_sobid.
              perform get_org using v_otype v_sclas v_subty
                                   v_sobid.
              if sy-subrc <> 0.
                v_otype = c_otype.  " S
                v_sclas = c_sclas1. " O
                v_subty = c_subty2.                             " A003
                v_sobid = v_sobid1.
                perform get_org using v_otype v_sclas v_subty
                          v_sobid.
                if sy-subrc = 0.
                  v_otype = c_type.   " O
                  v_sclas = c_sclas.  " K
                  v_subty = c_subty1.                           " A011
                  v_sobid2 = v_sobid.
                  perform get_org using v_otype v_sclas v_subty
                                   v_sobid.
                  if sy-subrc <> 0.
                    v_otype = c_type.    " O
                    v_sclas = c_sclas1.  " O
                    v_subty = c_subty.                          " A002
                    v_sobid = v_sobid2.
                    perform get_org using v_otype v_sclas v_subty
                            v_sobid.
                  else.
                    org_tab-kostl = hrp1001-sobid+0(10).
                  endif.
                endif.
              else.
                org_tab-kostl = hrp1001-sobid+0(10).
              endif.
            endif.
          endif.
        endif.
    Get the Position Text
        clear t528t.
        select single plstx from t528t into t528t-plstx
          where sprsl = sy-langu and
                otype = c_otype  and
                plans = org_tab-objid.
        org_tab-plstx = t528t-plstx.
    Get the Org Unit Text
        clear t527x.
        select single orgtx from t527x into t527x-orgtx
          where sprsl = sy-langu and
                orgeh = org_tab-sobid+0(8).
        org_tab-orgtx = t527x-orgtx.
        modify org_tab index sy-tabix.
        clear v_sobid.
      endloop.
      sort org_tab by otype objid.
    Calculate the Approved No of Positions
      loop at org_tab.
        if org_tab-kostl in s_kostl.
          move-corresponding org_tab to org1_tab.
          append org1_tab.
          clear org1_tab.
        endif.
      endloop.
      sort org1_tab by kostl objid.
      clear v_cnt.
      loop at org1_tab.
        at end of kostl.
          sy-tabix = sy-tabix - v_cnt.
          org2_tab-kostl = org1_tab-kostl.
          org2_tab-count   = sy-tabix.
          v_cnt = v_cnt + sy-tabix.
          append org2_tab.
          clear:org2_tab.
        endat.
      endloop.
      sort org2_tab by kostl.
    endform.              "get_org_data
    *&      Form  get_act_data
    Get the Actual Manpower Data from Database Table PA0001
    form get_act_data.
      clear  : stat_tab, act_tab.
      refresh: stat_tab, act_tab.
    Get all the Active Employees
      select pernr       " Object Type
             begda       " Begin date
             endda       " End date
             stat2       " Emp Status
           into table stat_tab
           from pa0000
           where stat2 eq c_stat1 and
                 begda le p_date  and
                 endda ge p_date.
      sort act_tab by pernr.
      if not stat_tab[] is initial.
        select pernr       " Object Type
               begda       " Begin date
               endda       " End date
               kostl       " Cost Center
               orgeh       " Org Unit
               plans       " Position
           into table act_tab
           from pa0001
           for all entries in stat_tab
           where pernr eq stat_tab-pernr and
                 kostl in s_kostl and
                 plans in s_plans and
                 persg eq '1'     and
                 begda le p_date  and
                 endda ge p_date.
      endif.
      sort act_tab by pernr.
      loop at act_tab.
        move-corresponding act_tab to act1_tab.
        clear pa0002-natio.
        select single natio into pa0002-natio from pa0002
          where pernr = act_tab-pernr.
        if sy-subrc = 0.
          act1_tab-natio = pa0002-natio.
        endif.
        append act1_tab.
        clear act1_tab.
      endloop.
      sort act1_tab by kostl natio.
    Calculate the Local and Expatriate Manpower
      loop at act1_tab.
        if act1_tab-natio = c_uae.
          act2_tab-kostl = act1_tab-kostl.
          act2_tab-natio = act1_tab-natio.
        else.
          act3_tab-kostl = act1_tab-kostl.
          act3_tab-natio = act1_tab-natio.
        endif.
        append: act2_tab, act3_tab.
        clear : act2_tab,act3_tab.
      endloop.
      sort act2_tab by kostl.
      sort act3_tab by kostl.
    Actual UAE Manpower
      clear v_cnt.
      loop at act2_tab.
        at end of kostl.
          sy-tabix = sy-tabix - v_cnt.
          act4_tab-kostl   = act2_tab-kostl.
          act4_tab-count1  = sy-tabix.
          v_cnt = v_cnt + sy-tabix.
          append act4_tab.
          clear:act4_tab.
        endat.
      endloop.
      sort act4_tab by kostl.
    Other Countries
      clear v_cnt.
      loop at act3_tab.
        at end of kostl.
          sy-tabix = sy-tabix - v_cnt.
          act5_tab-kostl   = act3_tab-kostl.
          act5_tab-count2  = sy-tabix.
          v_cnt = v_cnt + sy-tabix.
          append act5_tab.
          clear:act5_tab.
        endat.
      endloop.
      sort act5_tab by kostl.
    endform.              "get_act_data
    *&      Form  get_org
    Get the Cost Center from Parent Org Id
    form get_org using p_v_otype p_v_sclas p_v_subty p_v_sobid.
      clear hrp1001.
      select single * from hrp1001
            where otype = p_v_otype  and
                  plvar = c_plan   and
                  istat = c_pstat  and
                  begda le p_date  and
                  endda ge p_date  and
                  sclas eq p_v_sclas   and
                  subty eq p_v_subty  and
                  objid eq p_v_sobid.
      v_sobid = hrp1001-sobid+0(8).
    endform.                    " get_org
    *&      Form  get_vac_data
    Get the Vaccancies Data from Database Table HRP1007
    form get_vac_data.
      if not org_tab[] is initial.
        select plvar       " Plan Version
               otype       " Object Type
               objid       " Object ID
               istat       " Planning Status
               begda       " Begin date
               endda       " End date
               vacan       " Vacancy Indicator
               status      " Status of Vacancy
           into table vac_tab
           from hrp1007
           for all entries in org_tab
           where plvar = c_plan   and
                 otype = c_otype  and
                 istat eq c_pstat and
                 objid = org_tab-objid and
                 begda le p_date and
                 endda ge p_date and
                 vacan eq c_x  and
                 status eq c_stat.
      endif.
      sort vac_tab by plvar otype objid.
    Get the HR data into the rep_tab Internal Table
      loop at vac_tab.
        rep_tab-plans  = vac_tab-objid.
        rep_tab-vacan  = vac_tab-vacan.
        rep_tab-status = vac_tab-status.
        read table org_tab with key objid = vac_tab-objid.
        if sy-subrc = 0.
          rep_tab-kostl = org_tab-kostl.
          rep_tab-plstx = org_tab-plstx.
          rep_tab-orgtx = org_tab-orgtx.
        endif.
        append rep_tab.
        clear  rep_tab.
      endloop.
      loop at rep_tab.
        if not rep_tab-kostl in s_kostl.
          delete rep_tab index sy-tabix.
        endif.
      endloop.
      sort rep_tab by kostl plans.
    delete rep_tab where plstx cs v_str.
    delete rep_tab where orgtx cs v_str1.
    Calculate the Count of Vacancies in each Division
      clear v_cnt.
      loop at rep_tab.
        at end of kostl.
          sy-tabix = sy-tabix - v_cnt.
          rep1_tab-kostl = rep_tab-kostl.
          rep1_tab-cnt   = sy-tabix.
          v_cnt = v_cnt + sy-tabix.
          append rep1_tab.
          clear:rep1_tab.
        endat.
      endloop.
      sort rep1_tab by kostl.
    endform.                  "get_vac_data
    *&      Form append_data
    Append the data into final Internal Table
    form append_data.
      loop at org2_tab.
        rep2_tab-kostl = org2_tab-kostl.
        rep2_tab-app_no = org2_tab-count.
        read table act4_tab with key kostl = org2_tab-kostl
                                     binary search.
        if sy-subrc = 0.
          rep2_tab-nat_no = act4_tab-count1.
        endif.
        read table act5_tab with key kostl = org2_tab-kostl
                                     binary search.
        if sy-subrc = 0.
          rep2_tab-exp_no = act5_tab-count2.
        endif.
        read table rep1_tab with key kostl = org2_tab-kostl
                                     binary search.
        if sy-subrc = 0.
          rep2_tab-vac_no = rep1_tab-cnt.
        endif.
        rep2_tab-tot_no = rep2_tab-nat_no + rep2_tab-exp_no.
        append rep2_tab.
        clear rep2_tab.
      endloop.
      sort rep2_tab by kostl.
    endform.             "append_data
    *&      Form  top_of_page
    Write the Report and Column Headings
    form top_of_page.
      skip.
      format color col_heading on.
      write: /1(108) 'NATIONAL DRILLING COMPANY'(010) centered,
             /1(108) 'Summary of Manning Level Report'(011) centered.
      format color off.
      skip.
      write: /2 'Key Date        :'(013), p_date,
             75 'Report Run Date:'(041), sy-datum.
      if not s_kostl[] is initial.
        if s_kostl-high is initial.
          write: /2 'Cost Center     :'(023), s_kostl-low,
                 75 'Time           :'(042), sy-uzeit.
        else.
          write: /2 'Cost Center From:'(024), s_kostl-low+7(3),
                                    'To'(022), s_kostl-high,
                 75 'Time           :'(042), sy-uzeit.
        endif.
      else.
        write: /75  'Time           :'(042), sy-uzeit.
      endif.
      if not s_plans[] is initial.
        if s_plans-high is initial.
          write: /2 'Position Id     :'(019), s_plans-low,
                 75 'User           :'(043), sy-uname.
        else.
          write: /2 'Position Id From:'(021), s_plans-low,
                              'To'(022), s_plans-high,
                 75 'User           :'(043), sy-uname.
        endif.
      else.
        write: /75 'User           :'(043), sy-uname.
      endif.
      write: /75 'Page No        :'(044), sy-pagno.
      skip.
      write /1(108) sy-uline.
      format color col_heading.
      write:/1 sy-vline,
            12 sy-vline, 53 sy-vline,
            64 sy-vline, 65(32)  'Actual'(018) centered,
            97 sy-vline,108 sy-vline.
      write:/1 sy-vline,  2(10) 'CostCenter'(014),
            12 sy-vline, 13(40) 'Description'(026) centered,
            53 sy-vline, 54(10) 'Approved'(025) centered,
            64 sy-vline, 65(32)  sy-uline,
            97 sy-vline, 98(10) 'Vacancies'(017),
           108 sy-vline.
      write:/1 sy-vline,
            12 sy-vline, 53 sy-vline,
            64 sy-vline, 65(10) 'National'(015) centered,
            75 sy-vline, 76(10) 'Expatriate'(020) centered,
            86 sy-vline, 87(10) 'Total'(016) centered,
            97 sy-vline,108 sy-vline.
      format color off.
      write /1(108) sy-uline.
    endform.               "top_of_page
    *&      Form  Display_report
    Write the Report Output
    form display_report.
      if rep2_tab[] is initial.
        message i999 with
        'No Data found for the entered Selection'(035).
      else.
        loop at rep2_tab.
    Authorization Check for the Orgn and Cost Centers
          perform auth_check_org.
          if sy-subrc = 0.
            clear cskt.
            select single ltext into cskt-ltext from cskt
                where spras = sy-langu and
                      kokrs = c_kokrs and
                      kostl = rep2_tab-kostl.
            format color col_normal.
            write: /1 sy-vline, 2(10) rep2_tab-kostl+7(3),
                   12 sy-vline, 13(40) cskt-ltext,
                   53 sy-vline, 54(10) rep2_tab-app_no,
                   64 sy-vline, 65(10) rep2_tab-nat_no,
                   75 sy-vline, 76(10) rep2_tab-exp_no,
                   86 sy-vline, 87(10) rep2_tab-tot_no,
                   97 sy-vline, 98(10) rep2_tab-vac_no,
                  108 sy-vline.
            format color off.
            at last.
              sum.
              format color 3.
              write /1(108) sy-uline.
              write: /1 sy-vline, 2(10) 'Total'(027),
                     12 sy-vline,
                     53 sy-vline, 54(10) rep2_tab-app_no,
                     64 sy-vline, 65(10) rep2_tab-nat_no,
                     75 sy-vline, 76(10) rep2_tab-exp_no,
                     86 sy-vline, 87(10) rep2_tab-tot_no,
                     97 sy-vline, 98(10) rep2_tab-vac_no,
                    108 sy-vline.
              format color off.
            endat.
          endif.
        endloop.
      endif.
      write /1(108) sy-uline.
    endform.                    " Display_report
    *&      Form  auth_check_org
    Authorization Check for the Orgn and Cost Center
    form auth_check_org.
      authority-check object 'ZNDCHROM'
            id 'PLVAR' dummy
            id 'OTYPE' dummy
            id 'KOSTL' field rep2_tab-kostl.
    endform.                  "auth_check_org
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Routine sample code for reading 2 fields from existing DSO

    Hi Gurus,
                 I am a monkey when it comes to write ABAP code. I have one DSO-A where we store accounting info of purchading (from DS 2lis_02_acc) and one DSO-B getting data from 2lis_02_scl data source.
    We need to write a rountine to read DSO-A for G/L account and populate DSO-B G/L account field.
    Please provide me the sample code for this.
    Warm Regards,
    Anil

    Hi anil,
    Create a local table this is type of you source,
    Data : LV_table  TYPE  XXXX
    use the select statement to read the table of DSO .You have to use th active table for the dso that you want to read data from.
    Select xxxfieldxxx FROM  /BIC/A..........50
    into lv_table where
    filed name of of scheule line probably order no and item no .
    <soruce-fields>-IOBELN = IOBELN
    and <source-fields>-IOBELP = IOBELP.
    Checke the techinal name i am not sure about it. It will be something like that.
    Cheers mate

  • Transaction code for SAP query reports

    Hi All,
    I am trying to create transaction code for sap query report but couldn't go further.
    1) Created User group in SQ03
    2) Created infoset in SQ03 and assigned that to the user group
    3) Created query in SQ01 using the infoset.
    I executed the report in SQ01 and it is working fine.
    Now I try to create a transaction code in SE93 using the steps mentioned in the following link:
    Assign transaction code to SAP Query (created via SQ01)
    But when try to execute the report using the transaction code, it is giving error message 'User group xxxxxx is not yet created'
    Could any one advice me if I miss something? Or please help me to create this transaction code and transport to production?
    Thanks in advance

    HI,
    based on the thread you've already mentioned:
    In SE93, Create a Paramter Transaction
    -> Transaction = Start_report
    -> In default values, give the below details:
    D_SREPOVARI-REPORTTYPE = AQ
    D_SREPOVARI-EXTDREPORT = Name of the Query
    D_SREPOVARI-REPORT = User Group
    So check if the user group is typed correct in SE93 and check also if the user group exits in the system where you are trying to run the transaction.
    best regards, Christian

  • Urgent need of code for abap hr program

    Hi,
    Can any one provide with coding to calculate the leave balance  for employee
    for a given period. Its very urgent.
    Thanks in advance,
    Subha

    Hi
    See this sample code for calculation of absence quota
    using 2001 and 2006 infotypes
    make changes as per your requirement
    REPORT zh_absence_quota
           NO STANDARD PAGE HEADING
           MESSAGE-ID zh_msg
           LINE-SIZE 169
           LINE-COUNT 60(1).
                   T A B L E S  D E C L A R A T I O N S
    TABLES:    pernr,    " Logical PNP
               t001p,    " Personnel Subarea
               t529u,    " Employment Status
               t500p,    " Personnel Area
               t501,     " Employee Group
               t503k,    " Employee Subgroup
               t549a,    " Payroll Area
               t554s,    " Absence Type
               t554t,    " Absence Type Texts
               t556a,    " Quota Type
               t527x,    " Orgn. Unit
               t556b,    " Quota Type Text
               pa0003.   " Payroll Status
    INFOTYPES:
               0000,   " Actions
               0001,   " Organizational Assignment
               2006,   " Absence Quota
               2001.   " Absences
                   T Y P E S  D E C L A R A T I O N S
    Employee Absence Structure
    TYPES: BEGIN OF s_2001,
             pernr TYPE persno,       " Personal Number
             awart TYPE awart,        " Absence Type
             subty TYPE subty,        " Sub Type
             endda TYPE endda,        " End date
             begda TYPE begda,        " Begin date
             abrtg TYPE abrtg,        " Absence days
             ename TYPE emnam,        " employee Name
             atext TYPE abwtxt,       " Absence Type Text
           END OF s_2001.
    Employee Absence Quota Structure
    TYPES: BEGIN OF s_2006,
             pernr TYPE persno,       " Personal Number
             ktart TYPE abwko,        " Absence Quota Type
             year(4) TYPE n,          " Year
             subty TYPE subty,        " Sub Type
             endda TYPE endda,        " End date
             begda TYPE begda,        " Begin date
             anzhl TYPE ptm_quonum,   " Absence Entitlement days
             ename TYPE emnam,        " employee Name
             ktext TYPE kotxt,        " Absence Type Text
             kverb TYPE kverb,        " Deduction Quota days
             anzhb TYPE ptm_quonum,   " Balance days
           END OF s_2006.
    Combined Employee Absence and Quota Structure
    TYPES: BEGIN OF s_rep,
             pernr TYPE persno,       " Personal Number
             ktart TYPE abwko,        " Absence Quota Type
             year(4) TYPE n,          " Year
             anzhl TYPE ptm_quonum,   " Absence Entitlement days
             kverb TYPE kverb,        " Deduction Quota days
             anzhb TYPE ptm_quonum,   " Balance days
             ktext TYPE kotxt,        " Quota Type Text
             awart TYPE awart,        " Absence Type
             abrtg TYPE abrtg,        " Absence days
             ename TYPE emnam,        " employee Name
             atext TYPE abwtxt,       " Absence Type Text
             endda TYPE endda,        " End date
             begda TYPE begda,        " Begin date
           END OF s_rep.
    Declaration of Variables
    DATA : gv_atext TYPE abwtxt,              " Absence Type Text
           gv_ktext TYPE kotxt,               " Absence Type Text
           gv_title1   TYPE sylisel,          " Report title
           gv_year(4)  TYPE c,                " Year
           gv_mon(2)   TYPE c,                " Month
           gv_hrs    TYPE abwtg,              " Hours
           gv_date   TYPE sydatum,            " Date
           gv_date1  TYPE sydatum,            " Date
           gv_dial.                           " Color flag
    Declaration of Constants
    CONSTANTS :
      c_x      TYPE c VALUE 'X',               " Sign
      c_1      TYPE persg   VALUE '1',         " Emp Group
      c_pernr(8) TYPE n VALUE '00000000',      " Pernr
      c_moabw  TYPE moabw   VALUE '01',        " Per SA Grouping
      c_mozko  TYPE mozko   VALUE '01',        " Per SA Grouping
      c_mopgk  TYPE mopgk   VALUE '1',         " Emp SGrp Grouping
      c_endda  TYPE sydatum VALUE '99991231',  " End Date
      c_val1(2) TYPE c VALUE '31',             " Date Type
      c_val2(2) TYPE c VALUE '12',             " Date Type
      c_val    LIKE p0041-dar01 VALUE '01',    " Date Type
      c_date1  LIKE sy-datum VALUE '18000101'. " Date
         I N T E R N A L  T A B L E S  D E C L A R A T I O N S
    DATA: i_2001 TYPE STANDARD TABLE OF s_2001 WITH HEADER LINE,
          i_2006 TYPE STANDARD TABLE OF s_2006 WITH HEADER LINE,
          i_rep1 TYPE STANDARD TABLE OF s_2006 WITH HEADER LINE,
          i_rep  TYPE STANDARD TABLE OF s_rep WITH HEADER LINE.
                     S E L E C T I O N  S C R E E N
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_ktart FOR t556a-ktart,  " Absence Quota Type
                    s_awart FOR t554s-subty.  " Absence Type
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) text-003.   " Quota & Absence
    PARAMETERS: p_qa RADIOBUTTON GROUP rb1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) text-004.   " Quota
    PARAMETERS: p_q RADIOBUTTON GROUP rb1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) text-005.   " Absence
    PARAMETERS: p_a RADIOBUTTON GROUP rb1.
    SELECTION-SCREEN END OF LINE.SELECTION-SCREEN END OF BLOCK b2.
                      I N I T I A L I Z A T I O N                        *
    INITIALIZATION.
                  A T  S E L E C T I O N - S C R E E N                   *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_screen.
                   S T A R T - O F - S E L E C T I O N                   *
    START-OF-SELECTION.
    Selection of Period
      PERFORM get_period.
    Get PERNR from LDB
    GET pernr.
      IF p0000-stat2 <> '0'.
    Get the data from PA0001,PA2001, PA2006
        PERFORM get_pers_data.
      ENDIF.
                   T O P - O F - P A G E                                 *
    TOP-OF-PAGE.
    Header of the List
      PERFORM header.
                   E N D - O F - P A G E                                 *
    Footer
    END-OF-PAGE.
      IF p_qa = c_x.
    Display both Absence and Quota Data
        WRITE /1(188) sy-uline.
      ELSEIF p_q = c_x.
    Display only Quota Data
        WRITE /1(114) sy-uline.
      ELSEIF p_a = c_x.
    Display only Absence Data
        WRITE /1(125) sy-uline.
      ENDIF.
                   E N D - O F - S E L E C T I O N                       *
    END-OF-SELECTION.
    Combine the Absence and Quota Data
      PERFORM append_data.
      IF p_qa = c_x.
    Display both Absence and Quota Data
        PERFORM display_qa_data.
      ELSEIF p_q = c_x.
    Display only Quota Data
        PERFORM display_q_data.
      ELSEIF p_a = c_x.
    Display only Absence Data
        PERFORM display_a_data.
      ENDIF.
    *&      Form  validate_screen
    Validation of Selection Screen fields
    FORM validate_screen .
    Validation of Personnel Number
      CLEAR pa0003.
      IF NOT pnppernr[] IS INITIAL.
        SELECT pernr
        FROM pa0003 UP TO 1 ROWS
          INTO pa0003-pernr
          WHERE pernr IN pnppernr.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e999 WITH 'Incorrect Personnel Number'(006).
        ENDIF.
      ENDIF.
    Validation of Employee Status
      CLEAR t529u.
      IF NOT pnpstat2[] IS INITIAL.
        SELECT SINGLE statv
          INTO t529u-statv
          FROM t529u
          WHERE statv IN pnpstat2 AND
                statn = '2' AND
                sprsl = sy-langu.
        IF sy-subrc <> 0.
          MESSAGE e999 WITH 'Invalid Employee Status'(007).
        ENDIF.
      ENDIF.
    Validation of Personnel Area
      CLEAR t500p.
      IF NOT pnpwerks[] IS INITIAL.
        SELECT persa
        FROM t500p UP TO 1 ROWS
          INTO t500p-persa
          WHERE persa IN pnpwerks.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e999 WITH 'Incorrect Personnel Area'(008).
        ENDIF.
      ENDIF.
    Validation of Personnel Sub Area
      CLEAR t001p.
      IF NOT pnpbtrtl[] IS INITIAL.
        SELECT btrtl
        FROM t001p UP TO 1 ROWS
          INTO t001p-btrtl
          WHERE btrtl IN pnpbtrtl.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e999 WITH 'Incorrect Personnel Sub Area'(009).
        ENDIF.
      ENDIF.
    Validation of Employee Group
      CLEAR t501.
      IF NOT pnppersg[] IS INITIAL.
        SELECT persg
        FROM t501 UP TO 1 ROWS
          INTO t501-persg
          WHERE persg IN pnppersg.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e999 WITH 'Incorrect Employee Group'(010).
        ENDIF.
      ENDIF.
    Validation of Employee Sub Group
      CLEAR t503k.
      IF NOT pnppersk[] IS INITIAL.
        SELECT persk
        FROM t503k UP TO 1 ROWS
          INTO t503k-persk
          WHERE persk IN pnppersk.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e999 WITH 'Incorrect Employee Sub Group'(011).
        ENDIF.
      ENDIF.
    Validation of Payroll Area
      CLEAR t549a.
      IF NOT pnpabkrs[] IS INITIAL.
        SELECT abkrs
        FROM t549a UP TO 1 ROWS
          INTO t549a-abkrs
          WHERE abkrs IN pnpabkrs.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e999 WITH 'Incorrect Employee Payroll Area'(026).
        ENDIF.
      ENDIF.
    Validation of Absence Type
      CLEAR t554s.
      IF NOT s_awart[] IS INITIAL.
        SELECT subty
        FROM t554s UP TO 1 ROWS
          INTO t554s-subty
          WHERE subty IN s_awart AND
                moabw EQ c_moabw AND
                endda EQ c_endda.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e999 WITH 'Incorrect Employee Absence Type'(012).
        ENDIF.
      ENDIF.
    Validation of Absence Quota Type
      CLEAR t556a.
      IF NOT s_ktart[] IS INITIAL.
        SELECT ktart
        FROM t556a UP TO 1 ROWS
          INTO t556a-ktart
          WHERE ktart IN s_ktart AND
                mopgk EQ c_mopgk AND
                mozko EQ c_mozko AND
                endda EQ c_endda.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e999 WITH 'Incorrect Employee Quota Type'(013).
        ENDIF.
      ENDIF.
    ENDFORM.                  "validate_screen
    *&      Form  get_period
    Get the Correct Period based on Selection screen selection
    FORM get_period.
      CLEAR: gv_year,gv_mon, gv_date, gv_date1.
      gv_year = sy-datum+0(4).
      gv_mon  = sy-datum+4(2).
      IF pnptimr1 = c_x.      " Current Date
        pnpbegda = sy-datum.
        pnpendda = sy-datum.
      ELSEIF pnptimr2 = c_x.  " Current Month
        CONCATENATE gv_year gv_mon c_val INTO gv_date.
        CONCATENATE gv_year gv_mon c_val1 INTO gv_date1.
        pnpbegda = gv_date.
        pnpendda = gv_date1.
      ELSEIF pnptimr3 = c_x.  " Current Year
        CONCATENATE gv_year c_val c_val INTO gv_date.
        CONCATENATE gv_year c_val2 c_val1 INTO gv_date1.
        pnpbegda = gv_date.
        pnpendda = gv_date1.
      ELSEIF pnptimr4 = c_x.  " Upto Today
        pnpbegda = c_date1.
        pnpendda = sy-datum.
      ELSEIF pnptimr5 = c_x.  " From Today
        pnpbegda = sy-datum.
        pnpendda = c_endda.
      ELSE.
        IF ( pnpbegda IS INITIAL AND pnpendda IS INITIAL ).
          pnpbegda = c_date1.
          pnpendda = c_endda.
        ELSEIF pnpbegda IS INITIAL AND NOT pnpendda IS INITIAL.
          pnpbegda = c_date1.
          pnpendda = pnpendda.
        ELSEIF NOT ( pnpbegda IS INITIAL AND pnpendda IS INITIAL ).
          pnpbegda = pnpbegda.
          pnpendda = pnpendda.
        ENDIF.
      ENDIF.
    ENDFORM.              "get_period
    *&      Form  get_pers_data
    Get the Absence and Quota Data from PA0001,PA2001,PA2006
    FORM get_pers_data.
      DATA: lv_year1(4) TYPE n,
            lv_year2(4) TYPE n,
            lv_date1 TYPE sydatum,
            lv_date2 TYPE sydatum,
            lv_anzhb TYPE ptm_quonum.   " Last Year Balance days
    Get data from Respective Infotypes
      rp_provide_from_last p0001 space pnpbegda pnpendda.
    Absence Data
      LOOP AT p2001 WHERE pernr = pernr-pernr AND
                          begda GE pnpbegda   AND
                          endda LE pnpendda.
        IF p2001-awart IN s_awart.
          i_2001-pernr    = pernr-pernr.
          i_2001-subty    = p2001-subty.
          i_2001-awart    = p2001-awart.
          i_2001-abrtg    = p2001-abrtg.
          i_2001-begda    = p2001-begda.
          i_2001-endda    = p2001-endda.
          READ TABLE p0001 WITH KEY pernr = p2001-pernr.
          i_2001-ename    = p0001-ename.
    Get the Absence Type Text
          CLEAR gv_atext.
          SELECT SINGLE atext INTO gv_atext FROM t554t
                  WHERE sprsl = sy-langu AND
                        moabw = c_moabw  AND
                        awart = p2001-awart.
          IF sy-subrc = 0.
            i_2001-atext = gv_atext.
          ENDIF.
          APPEND i_2001.
          CLEAR i_2001.
        ENDIF.
      ENDLOOP.
    Quota Data
      LOOP AT p2006 WHERE pernr = pernr-pernr AND
                          begda GE pnpbegda   AND
                          endda LE pnpendda.
        IF p2006-ktart IN s_ktart.
          i_2006-pernr    = pernr-pernr.
          i_2006-subty    = p2006-subty.
          i_2006-begda    = p2006-begda.
          i_2006-endda    = p2006-endda.
          i_2006-year     = p2006-endda+0(4).
          i_2006-ktart    = p2006-ktart.
          i_2006-anzhl    = p2006-anzhl.
          i_2006-kverb    = p2006-kverb.
          i_2006-anzhb    = p2006-anzhl - p2006-kverb.
          READ TABLE p0001 WITH KEY pernr = p2001-pernr.
          i_2006-ename    = p0001-ename.
    Get the Quota Type Text
          CLEAR gv_ktext.
          SELECT SINGLE ktext INTO gv_ktext FROM t556b
                  WHERE sprsl = sy-langu AND
                        mopgk = c_mopgk  AND
                        mozko = c_mozko  AND
                        ktart = p2006-ktart.
          IF sy-subrc = 0.
            i_2006-ktext = gv_ktext.
          ENDIF.
          APPEND i_2006.
          CLEAR i_2006.
        ENDIF.
      ENDLOOP.
    For Vacation Quota (80) get the Balance of the Last Year and
    add to the Current Year Quota
      LOOP AT i_2006.
        IF i_2006-ktart = '80'.
          lv_year1 = i_2006-endda+0(4).
          lv_year2 = lv_year1 - 1.
          CONCATENATE lv_year2 '01' '01' INTO lv_date1.
          CONCATENATE lv_year2 '12' '31' INTO lv_date2.
          LOOP AT p2006 WHERE pernr = i_2006-pernr AND
                              begda GE lv_date1    AND
                              endda LE lv_date2    AND
                              ktart = '80'.
            lv_anzhb = p2006-anzhl - p2006-kverb.
            i_rep1-pernr = i_2006-pernr.
            i_rep1-ktext = i_2006-ktext.
            i_rep1-anzhl = p2006-anzhl.
            i_rep1-kverb = p2006-kverb.
            i_rep1-ename = i_2006-ename.
            i_rep1-begda = p2006-begda.
            i_rep1-endda = p2006-endda.
            i_rep1-anzhb = lv_anzhb.
            i_rep1-ktart = '80'.
            i_rep1-year = lv_year2.
            APPEND i_rep1.
            CLEAR: i_rep1.
          ENDLOOP.
        ENDIF.
        CLEAR: lv_year1, lv_year2,
               lv_date1, lv_date2,lv_anzhb.
      ENDLOOP.
      SORT i_rep1 BY pernr ktart.
    ENDFORM.          "get_pers_data
    *&      Form  append_data
    Put the Absence and Quota Data into one Report Int Table
    FORM append_data.
      CLEAR:   i_rep.
      REFRESH: i_rep.
      SORT i_2001 BY pernr awart.
      SORT i_2006 BY pernr ktart year.
    Move I_REP1 data into i_2006
      LOOP AT i_rep1.
        MOVE-CORRESPONDING i_rep1 TO i_2006.
        APPEND i_2006.
        CLEAR  i_2006.
      ENDLOOP.
    Move the Absence and Quota Data into a final Int Table
      LOOP AT i_2006.
        i_rep-pernr = i_2006-pernr.
        i_rep-ename = i_2006-ename.
        i_rep-ktart = i_2006-ktart.
        i_rep-anzhl = i_2006-anzhl.
        i_rep-kverb = i_2006-kverb.
        i_rep-ktext = i_2006-ktext.
        i_rep-anzhb = i_2006-anzhb.
        i_rep-year  = i_2006-year.
        CLEAR i_2001.
        CASE i_2006-ktart.
          WHEN '81'.
            PERFORM get_2001 USING i_2006-pernr '1000' i_2006-year.
          WHEN '50'.
            PERFORM get_2001 USING i_2006-pernr '1002' i_2006-year.
          WHEN '80'.
            PERFORM get_2001 USING i_2006-pernr '1001' i_2006-year.
          WHEN '56'.
            PERFORM get_2001 USING i_2006-pernr '1003' i_2006-year.
          WHEN '51'.
            PERFORM get_2001 USING i_2006-pernr '1004' i_2006-year.
          WHEN '52'.
            PERFORM get_2001 USING i_2006-pernr '1005' i_2006-year.
          WHEN '54'.
            PERFORM get_2001 USING i_2006-pernr '1006' i_2006-year.
          WHEN '53'.
            PERFORM get_2001 USING i_2006-pernr '1007' i_2006-year.
          WHEN '55'.
            PERFORM get_2001 USING i_2006-pernr '1008' i_2006-year.
          WHEN '57'.
            PERFORM get_2001 USING i_2006-pernr '1009' i_2006-year.
          WHEN '90'.
            PERFORM get_2001 USING i_2006-pernr '2000' i_2006-year.
          WHEN '58'.
            PERFORM get_2001 USING i_2006-pernr '2001' i_2006-year.
          WHEN '59'.
            PERFORM get_2001 USING i_2006-pernr '2002' i_2006-year.
          WHEN '91'.
            PERFORM get_2001 USING i_2006-pernr '2003' i_2006-year.
        ENDCASE.
        IF sy-subrc <> 0.
          APPEND i_rep.
        ENDIF.
        CLEAR i_rep.
      ENDLOOP.
      SORT i_rep BY pernr ktart year.
      DELETE i_rep WHERE pernr = ' '.
    ENDFORM.              " append_data
    *&      Form  display_qa_data
    Display the Absence and Quota Data
    FORM display_qa_data.
      DATA: lv_flag,                   " New Flag
            lv_tot2 TYPE ptm_quonum.   " Absence Balance days
      IF i_rep[] IS INITIAL.
        MESSAGE i000 WITH 'No Data found'(014).
      ELSE.
        LOOP AT i_rep.
    toggle color
          PERFORM toggle_color.
          IF lv_flag <> space.
            NEW-LINE.
          ENDIF.
          AT NEW pernr.
            READ TABLE i_rep INDEX sy-tabix.
            WRITE:/1 sy-vline,2(8) i_rep-pernr,
              10 sy-vline,11(40)   i_rep-ename.
          ENDAT.
          AT NEW ktart.
            READ TABLE i_rep INDEX sy-tabix.
            WRITE: 1 sy-vline, 10 sy-vline,
              51 sy-vline,52(25)   i_rep-ktext.
          ENDAT.
          AT NEW year.
            READ TABLE i_rep INDEX sy-tabix.
            WRITE: 1 sy-vline, 10 sy-vline,
                  51 sy-vline,
                  77 sy-vline, 78(4)  i_rep-year,
                  82 sy-vline, 83(11) i_rep-anzhl,
                  94 sy-vline, 95(25) i_rep-atext,
                 120 sy-vline,133 sy-vline,
                 144 sy-vline,
                 155 sy-vline,156(13)  i_rep-anzhb,
                 169 sy-vline.
          lv_tot2 = lv_tot2 + i_rep-anzhb.
          ENDAT.
          WRITE: 1 sy-vline,  10 sy-vline,
                51 sy-vline,  77 sy-vline,
                82 sy-vline,  94 sy-vline,
               120 sy-vline,121(12)  i_rep-abrtg NO-ZERO,
               133 sy-vline,134(10)  i_rep-begda NO-ZERO,
               144 sy-vline,145(10)  i_rep-endda NO-ZERO,
               155 sy-vline,169 sy-vline.
          NEW-LINE.
          AT END OF pernr.
            WRITE  : /1(169) sy-uline.
            SUM.
            FORMAT COLOR 3.
            WRITE:/1 sy-vline,   10 sy-vline,
                  51 sy-vline,   77 sy-vline,
                  82 sy-vline,   94 sy-vline,
                 120 sy-vline,121(12) i_rep-abrtg,
                 133 sy-vline,144 sy-vline,
                 155 sy-vline, 156(13) lv_tot2,
                 169 sy-vline.
            FORMAT COLOR OFF.
            WRITE  : /1(169) sy-uline.
            CLEAR lv_tot2.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.              " display_qa_data
    *&      Form  display_q_data
    Display only the Quota Data
    FORM display_q_data.
      DATA: lv_flag.               " New Flag
      SORT i_2006 BY pernr ktart year.
      IF i_2006[] IS INITIAL.
        MESSAGE i000 WITH 'No Data found'(014).
      ELSE.
        LOOP AT i_2006.
    Toggle Color
          PERFORM toggle_color.
          IF lv_flag <> space.
            NEW-LINE.
          ENDIF.
          AT NEW pernr.
            READ TABLE i_2006 INDEX sy-tabix.
            WRITE: /1 sy-vline,  2(8)  i_2006-pernr,
                   10 sy-vline,11(40)  i_2006-ename.
          ENDAT.
          AT NEW ktart.
            READ TABLE i_2006 INDEX sy-tabix.
            WRITE: 1 sy-vline,10 sy-vline,
                  51 sy-vline,52(25)  i_2006-ktext.
          ENDAT.
          AT NEW year.
            READ TABLE i_2006 INDEX sy-tabix.
            WRITE: 1 sy-vline,  10 sy-vline,
                  51 sy-vline,
                  77 sy-vline,78(4)  i_2006-year,
                  82 sy-vline,83(11) i_2006-anzhl,
                  94 sy-vline,95(13) i_2006-anzhb,
                 108 sy-vline.
            NEW-LINE.
          ENDAT.
          AT END OF pernr.
            WRITE  : /1(108) sy-uline.
            SUM.
            FORMAT COLOR 3.
            WRITE: /1 sy-vline, 10 sy-vline,
                   51 sy-vline,
                   77 sy-vline, 82 sy-vline,
                   94 sy-vline, 95(13) i_2006-anzhb,
                  108 sy-vline.
            FORMAT COLOR OFF.
            WRITE  : /1(108) sy-uline.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.              " display_q_data
    *&      Form  display_a_data
    Display Only the Absence Quota
    FORM display_a_data.
      DATA: lv_flag.               " New Flag
      SORT i_2001 BY pernr awart.
      IF i_2001[] IS INITIAL.
        MESSAGE i000 WITH 'No Data found'(014).
      ELSE.
        LOOP AT i_2001.
    Toggle Color
          PERFORM toggle_color.
          IF lv_flag <> space.
            NEW-LINE.
          ENDIF.
          AT NEW pernr.
            READ TABLE i_2001 INDEX sy-tabix.
            WRITE: /1 sy-vline, 2(10) i_2001-pernr,
                   10 sy-vline,11(40) i_2001-ename.
          ENDAT.
          WRITE:  1 sy-vline, 10 sy-vline,
                  51 sy-vline,52(25) i_2001-atext,
                  77 sy-vline,78(12) i_2001-abrtg,
                  90 sy-vline,91(10) i_2001-begda,
                 101 sy-vline,102(10) i_2001-endda,
                 112 sy-vline.
          NEW-LINE.
          AT END OF pernr.
            WRITE  : /1(112) sy-uline.
            SUM.
            FORMAT COLOR 3.
            WRITE: /1 sy-vline, 10 sy-vline,
                   51 sy-vline,
                   77 sy-vline,78(12) i_2001-abrtg,
                   90 sy-vline,101 sy-vline,
                  112 sy-vline.
            FORMAT COLOR OFF.
            WRITE  : /1(112) sy-uline.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.              " display_a_data
    *&      Form  header
    Write the Report Header
    FORM header .
      data : lv_pers type pbtxt,
             lv_orgn type orgtx.
      gv_title1 = sy-title.              " Set List Header
      IF p_qa = c_x.
        NEW-PAGE LINE-SIZE 193.
      ELSEIF p_a = c_x.
        NEW-PAGE LINE-SIZE 125.
      ELSEIF p_q = c_x.
        NEW-PAGE LINE-SIZE 119.
      ENDIF.
    Standard header
      FORMAT RESET.
      CALL FUNCTION 'Z_STANDARD_HEADER'
        EXPORTING
          title1 = gv_title1.
    Get the Personal Area and Org.Unit Texts
      clear : lv_pers,lv_orgn.
      select single name1 into lv_pers
        from t500p where persa = pnpwerks-low.
      select single orgtx into lv_orgn
        from t527x where sprsl = sy-langu and
                         orgeh = pnporgeh-low and
                         endda = c_endda.
      if not lv_pers is initial.
        write : /2 'Personal Area:'(017), 17(25) lv_pers color 7.
      endif.
      if not lv_orgn is initial.
        write : /2 'Organization Unit:'(021), 20(25) lv_orgn color 3.
      endif.
      IF p_qa = c_x.
        FORMAT COLOR COL_HEADING.
        WRITE  : /1(169) sy-uline.
        WRITE:/1 sy-vline,2(8)    'Emp.No'(015) CENTERED,
              10 sy-vline,11(40)  'Employee Name'(016) CENTERED,
              51 sy-vline,52(25)  'Quota Description'(018) CENTERED,
              77 sy-vline,78(4)   'Year'(027),
              82 sy-vline,83(11)  'Entitlement'(019),
              94 sy-vline,95(25)  'Absence Description'(022) CENTERED,
             120 sy-vline,121(12) 'Absence days'(023),
             133 sy-vline,134(10) 'From Date'(024),
             144 sy-vline,145(10) 'To Date'(025),
             155 sy-vline,156(13) 'Quota Balance'(020),
             169 sy-vline.
        WRITE  : /1(169) sy-uline.
      ELSEIF p_q = c_x.
        FORMAT COLOR COL_HEADING.
        WRITE  : /1(108) sy-uline.
        WRITE:/1 sy-vline,2(8)   'Emp.No'(015) CENTERED,
              10 sy-vline,11(40) 'Employee Name'(016) CENTERED,
              51 sy-vline,52(25) 'Quota Description'(018) CENTERED,
              77 sy-vline,78(4)  'Year'(027),
              82 sy-vline,83(11) 'Entitlement'(019),
              94 sy-vline,95(13) 'Quota Balance'(020),
             108 sy-vline.
        WRITE  : /1(108) sy-uline.
      ELSEIF p_a = c_x.
        FORMAT COLOR COL_HEADING.
        WRITE  : /1(112) sy-uline.
        WRITE:/1 sy-vline,2(8)    'Emp.No'(015) CENTERED,
              10 sy-vline,11(40)  'Employee Name'(016) CENTERED,
              51 sy-vline,52(25)  'Absence Description'(022) CENTERED,
              77 sy-vline,78(12)  'Absence days'(023),
              90 sy-vline,91(10)  'From Date'(024),
             101 sy-vline,102(10) 'To Date'(025),
             112 sy-vline.
        WRITE  : /1(112) sy-uline.
      ENDIF.
    ENDFORM.                    " header
    *&      Form  toggle_color
    This routine alters the color of the records in the list
    FORM toggle_color.
      IF gv_dial = space.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        gv_dial = c_x.
      ELSE.
        FORMAT COLOR 1 INTENSIFIED OFF.
        CLEAR gv_dial.
      ENDIF.
    ENDFORM.                    " toggle_color
    *&      Form  get_2001
    Get the ABsence type for each Quota type
    FORM get_2001 USING p_pernr TYPE persno
                        p_value TYPE awart
                        p_year.
      LOOP AT i_2001 WHERE pernr = p_pernr AND
                           awart = p_value AND
                           endda+0(4) = p_year.
        i_rep-awart = i_2001-awart.
        i_rep-abrtg = i_2001-abrtg.
        i_rep-atext = i_2001-atext.
        i_rep-begda = i_2001-begda.
        i_rep-endda = i_2001-endda.
        APPEND i_rep.
      ENDLOOP.
    ENDFORM.                                                    " get_2001
    <b>
    Reward points for useful Answers</b>
    Regards
    Anji

Maybe you are looking for

  • 3 Creative Cloud packages all fail on Launch with Error 16

    Hi, I am using creative cloud packager to create applications to deploy using SCCM, which I have successfully deployed in the past. I created 3 new creative cloud packages this week, Edge Animate, After Affects and Premier Pro, for the 64bit platform

  • I downloaded Adobe Cloud setup but it wont open up anything

    SO I got myself a new PC lenova laptop and downloaded Cloud. It worked out well and was able to get photoshop (trial), but something happened to my laptop that forced me to system restore. I redownloaded and get Adobe Cloud setup, but when I double c

  • How to Get a BLOB Field from JDBC Coding

    Hi, I have written the JDBC Code to get the field values from the Table. There is a BLOB field in that table. How to get the BLOB ? What is the return type we should use. If it is Varchar then we can use rs.getString(). If it is BLOB then what is the

  • Backup Retention Policy?

    hi All, I'm planning my backup retention policy. what is the best backup planning for this plan: sunday - backuo level 0 (full) monday - defferential backup level 1 tuesday - defferential backup level 1 wednesday - cumulative backup level 1 thrusday

  • Dynamic Source Multicast Script

    Hello and thanks in advance for any advice. I am developing a presentation broadcasting application with annotation/inking functionality. The important thing is that the inking is live. My question is whether there is a simple way to have FMS receive