LDB   in abap hr

Hi,
    I am new to Abap Hr.Can anyone plz provide me with a sample program for a logical database.
Regards,
Subha

Hi
See the sample report using PNP LDB
LDB is attached in the attributes of the program
report zporgr0100
       line-size 252
       line-count 60(1)
       no standard page heading
       message-id zx.
Database Tables & Infotypes
tables: pcl1,        " HR Cluster1
        pcl2,        " HR Cluster1
        pa0003,      " Master data - Payroll Status
        cskt,        " Cost Center Texts
        t528t,       " Positions Texts
        t513s,       " Job Titles
        pernr,       " Logical PNP
        t001p,       " Personnel Subarea
        t500p,       " Personnel Area
        t501,        " Employee Group
        t503k,       " Employee Subgroup
        csks.        " Cost Center
infotypes:0000,0001.
*include rpclst00.
include rpc2rx00.
include rpc2rxx0.
include rpc2cd00.
*include rpc2ps00.
*include rpc2pt00.
*include rpcfvp00.
*include rpcfdc10.
*include rpcfdc00.
include rpppxd00.
include rpppxd10.
Declaration of Internal Tables
Internal Table for Output Data
data: begin of rep_tab occurs 0,
        kostl like pa0001-kostl,      " Cost Center
        pernr like pa0001-pernr,      " Personal Number
        ename like pa0001-ename,      " Employee Name
        ctext like cskt-ltext,        " Cost Center Text
        ptext like t528t-plstx,       " Position Text
        ot1   type p decimals 2,      " Jan OT Amount
        ot2   type p decimals 2,      " Feb OT Amount
        ot3   type p decimals 2,      " Mar OT Amount
        ot4   type p decimals 2,      " Apr OT Amount
        ot5   type p decimals 2,      " May OT Amount
        ot6   type p decimals 2,      " Jun OT Amount
        ot7   type p decimals 2,      " Jul OT Amount
        ot8   type p decimals 2,      " Aug OT Amount
        ot9   type p decimals 2,      " Sep OT Amount
        ot10  type p decimals 2,      " Oct OT Amount
        ot11  type p decimals 2,      " Nov OT Amount
        ot12  type p decimals 2,      " Dec OT Amount
        ott   type p decimals 2,      " Total OT Amount
      end of rep_tab.
Declaration of Variables
data: v_mon(2) type n,                   " Month
      v_no     type i,                   " Data Lines
      v_year(4)  type c,                 " Year
      v_date   like sy-datum,            " Date
      v_date1  like sy-datum,            " Date
      v_seqnr  like  pc261-seqnr.        " Sequence No.
Declaration of Constants
data: c_type   like hrp1001-otype  value 'S',  " Object Type
      c_kokrs  like cskt-kokrs value '1000',   " Controlling Area
      c_date1  like sy-datum value '18000101', " Date
      c_date2  like sy-datum value '99991231', " Date
      c_x       type c value 'X',              " Sign
     c_mon(2)  type c value '01',             " Month
      c_val1(2) type c value '31',             " Date
      c_val2(2) type c value '12',             " Month Type
      c_val    like p0041-dar01 value '01',    " Date Type
      c_lgart1 like p0008-lga01 value '0722',  " Wage Type
      c_lgart2 like p0008-lga01 value '0723',  " Wage Type
      c_1(2)   type n value '01',                           " Month1
      c_2(2)   type n value '02',                           " Month2
      c_3(2)   type n value '03',                           " Month3
      c_4(2)   type n value '04',                           " Month4
      c_5(2)   type n value '05',                           " Month5
      c_6(2)   type n value '06',                           " Month6
      c_7(2)   type n value '07',                           " Month7
      c_8(2)   type n value '08',                           " Month8
      c_9(2)   type n value '09',                           " Month9
      c_10(2)  type n value '10',                           " Month10
      c_11(2)  type n value '11',                           " Month11
      c_12(2)  type n value '12'.                           " Month12
Selection-screen
parameters:
  p_year like pc2b0-pabrj obligatory.       " Payroll Year
At selection-screen
at selection-screen.
Validate the Selection Screen fields
  perform validate_screen.
Start-of-Selection
start-of-selection.
Selection of Period
  perform get_period.
Get PERNR from LDB
get pernr.
Get the Master data from infotype 0001
  perform get_master_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(252) 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 Cost Center
  clear csks.
  if not pnpkostl[] is initial.
    select single kostl
      into csks-kostl
      from csks
      where kostl in pnpkostl.
    if sy-subrc <> 0.
      message e999 with 'Invalid Cost Center'(003).
    endif.
  endif.
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 Personal Number Entered'(002).
    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 Entered'(001).
    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 Entered'(037).
    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 Entered'(038).
    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 Entered'(039).
    endif.
  endif.
endform.                  "validate_screen
*&      Form  get_period
Get the Correct Period based on Selection screen selection
form get_period.
  clear: v_year,v_mon, v_date, v_date1.
  v_year = sy-datum+0(4).
  v_mon  = sy-datum+4(2).
  if pnptimr1 = c_x.      " Current Date
    pnpbegda = sy-datum.
    pnpendda = sy-datum.
  elseif pnptimr2 = c_x.  " Current Month
    concatenate v_year v_mon c_val into v_date.
    concatenate v_year v_mon c_val1 into v_date1.
    pnpbegda = v_date.
    pnpendda = v_date1.
  elseif pnptimr3 = c_x.  " Current Year
    concatenate v_year c_val c_val into v_date.
    concatenate v_year c_val2 c_val1 into v_date1.
    pnpbegda = v_date.
    pnpendda = v_date1.
  elseif pnptimr4 = c_x.  " Upto Today
    pnpbegda = c_date1.
    pnpendda = sy-datum.
  elseif pnptimr5 = c_x.  " From Today
    pnpbegda = sy-datum.
    pnpendda = c_date2.
  else.
    if ( pnpbegda is initial and pnpendda is initial ).
      pnpbegda = c_date1.
      pnpendda = c_date2.
    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_master_data
Get the Master Data from Database Tables PA0001,0002,0003
form get_master_data.
Get data from Respective Infotypes
  rp_provide_from_last p0001 space pnpbegda pnpendda.
  if p0001-kostl in pnpkostl.
    rep_tab-kostl = p0001-kostl.
    rep_tab-pernr = p0001-pernr.
    rep_tab-ename = p0001-ename.
Get the Position Text
    clear t528t-plstx.
    select single plstx into t528t-plstx from t528t
            where plans = p0001-plans and
                  otype = c_type and
                  sprsl = sy-langu.
    if sy-subrc = 0.
      rep_tab-ptext = t528t-plstx.
    endif.
Get the Cost Center Text
    clear cskt-ltext.
    select single ltext into cskt-ltext from cskt
            where spras = sy-langu and
                  kokrs = c_kokrs and
                  kostl = p0001-kostl.
    if sy-subrc = 0.
      rep_tab-ctext = cskt-ltext.
    endif.
Get the Overtime Payment Data
    perform get_ot_data.
    rep_tab-ott = rep_tab-ot1 + rep_tab-ot2 + rep_tab-ot3 +
                  rep_tab-ot4 + rep_tab-ot5 + rep_tab-ot6 +
                  rep_tab-ot7 + rep_tab-ot8 + rep_tab-ot9 +
                  rep_tab-ot10 + rep_tab-ot11 + rep_tab-ot12.
    append rep_tab.
    clear  rep_tab.
  endif.
  sort rep_tab by kostl pernr.
  delete rep_tab where kostl = ' '.
  delete rep_tab where ott = 0.
endform.                 "get_master_data
*&      Form  get_ot_data
Get the Overtime Payment Data
form get_ot_data.
  cd-key = pernr-pernr.
  rp-imp-c2-cd.
  sort rgdir by seqnr.
To get sequence number for the payroll period
  loop at rgdir where void     is initial
                    and reversal is initial
                    and outofseq is initial
                    and srtza    eq 'A'.
    if rgdir-fpper+0(4) = p_year.
To consider offcycle run data
      if not rgdir-ocrsn is initial.
        v_seqnr = rgdir-seqnr.
        exit.
      endif.
      v_seqnr = rgdir-seqnr.
    endif.
    if not v_seqnr is initial.
      perform import_rx.
    endif.
    perform process_wagetypes.
  endloop.
endform.                 "get_ot_data
include rpppxm00.
*&      Form  Import_rx
Import the RX data from Clusters
form import_rx.
  rx-key-pernr = cd-key-pernr.
  rx-key-seqno = v_seqnr.
  rp-init-buffer.
  rp-imp-c2-rx.
endform.                    " Import_rx
*&      Form  Process_wagetypes
Calculate the Overtime Amount based on Wage types
form process_wagetypes.
  loop at rt.
    if  rt-lgart = c_lgart1 or rt-lgart = c_lgart2.
      if rgdir-fpper+0(4) = p_year.
        v_mon = rgdir-fpper+4(2).
        case v_mon .
          when c_1.
            rep_tab-ot1 = rep_tab-ot1 + rt-betrg.
          when c_2.
            rep_tab-ot2 = rep_tab-ot2 + rt-betrg.
          when c_3.
            rep_tab-ot3 = rep_tab-ot3 + rt-betrg.
          when c_4.
            rep_tab-ot4 = rep_tab-ot4 + rt-betrg.
          when c_5.
            rep_tab-ot5 = rep_tab-ot5 + rt-betrg.
          when c_6.
            rep_tab-ot6 = rep_tab-ot6 + rt-betrg.
          when c_7.
            rep_tab-ot7 = rep_tab-ot7 + rt-betrg.
          when c_8.
            rep_tab-ot8 = rep_tab-ot8 + rt-betrg.
          when c_9.
            rep_tab-ot9 = rep_tab-ot9 + rt-betrg.
          when c_10.
            rep_tab-ot10 = rep_tab-ot10 + rt-betrg.
          when c_11.
            rep_tab-ot11 = rep_tab-ot11 + rt-betrg.
          when c_12.
            rep_tab-ot12 = rep_tab-ot12 + rt-betrg.
        endcase.
      endif.
    endif.
  endloop.
endform.          "process_wagetypes
*&      Form  top_of_page
Write the Report and Column Headings
form top_of_page.
  format color col_heading on.
  write: /1(252) 'NATIONAL DRILLING COMPANY'(010) centered,
         /1(252) 'Overtime Payments Details'(011) centered.
  format color off.
  if pnptimr1 = c_x.      " Current Date
    write: /2 'Period From     :'(036), sy-datum, 'To:'(006), sy-datum.
  elseif pnptimr2 = c_x.  " Current Month
    write: /2 'Period From     :'(036), v_date, 'To:'(006), v_date1.
  elseif pnptimr3 = c_x.  " Current Year
    write: /2 'Period From     :'(036), v_date, 'To:'(006), v_date1.
  elseif pnptimr4 = c_x.  " Upto Today
    write: /2 'Period From     :'(036), c_date1, 'To:'(006), sy-datum.
  elseif pnptimr5 = c_x.  " From Today
    write: /2 'Period From     :'(036), sy-datum, 'To:'(006), c_date2.
  else.
    if ( pnpbegda is initial and pnpendda is initial ).
      write: /2 'Period From     :'(036), c_date1, 'To:'(006), c_date2.
    elseif pnpbegda is initial and not pnpendda is initial.
      write: /2 'Period From     :'(036), c_date1, 'To:'(006), pnpendda.
    elseif not ( pnpbegda is initial and pnpendda is initial ).
      write: /2 'Period From     :'(036), pnpbegda,
               'To:'(006), pnpendda.
    endif.
  endif.
  write: 219 'Report Run Date:'(018), sy-datum.
  if not pnpkostl[] is initial.
    if pnpkostl-high is initial.
      write: /2 'Cost Center     :'(004), pnpkostl-low,
            219 'Time           :'(020), sy-uzeit.
    else.
      write: /2 'Cost Center From:'(005), pnpkostl-low+7(3),
                                'To:'(006), pnpkostl-high,
            219 'Time           :'(020), sy-uzeit.
    endif.
  else.
    write: /219  'Time           :'(020), sy-uzeit.
  endif.
  if not pnppernr[] is initial.
    if pnppernr-high is initial.
      write: /2 'Personal Number :'(007), pnppernr-low,
             219 'User           :'(021), sy-uname.
    else.
      write: /2 'Personal No.From:'(008),  pnppernr-low,
                                'To:'(006), pnppernr-high,
             219 'User           :'(021), sy-uname.
    endif.
  else.
    write: /219 'User           :'(021), sy-uname.
  endif.
  write: /219 'Page No        :'(022), sy-pagno.
  format color col_heading.
  write /1(252) sy-uline.
  write:/1 sy-vline, 10 sy-vline,
        41 sy-vline,
        67 sy-vline, 68(167) 'Overtime Payments(Dirhams)'(013) centered,
       235 sy-vline,252 sy-vline.
  format color col_heading.
  write:/1 sy-vline,  2(8)  'Emp #'(019) centered,
        10 sy-vline, 11(30) 'Employee Name'(012) centered,
        41 sy-vline, 42(25) 'Position'(014) centered,
        67 sy-vline, 68(167)  sy-uline,
       235 sy-vline,236(16)  'Total'(017) centered,
       252 sy-vline.
  write:/1 sy-vline, 10 sy-vline,
        41 sy-vline,
        67 sy-vline, 68(13)  'JANUARY'(024) centered,
        81 sy-vline, 82(13)  'FEBRUARY'(025) centered,
        95 sy-vline, 96(13)  'MARCH'(026) centered,
       109 sy-vline,110(13)  'APRIL'(027) centered,
       123 sy-vline,124(13)  'MAY'(028) centered,
       137 sy-vline,138(13)  'JUNE'(029) centered,
       151 sy-vline,152(13)  'JULY'(030) centered,
       165 sy-vline,166(13)  'AUGUST'(031) centered,
       179 sy-vline,180(13)  'SEPTEMBER'(032) centered,
       193 sy-vline,194(13)  'OCTOBER'(033) centered,
       207 sy-vline,208(13)  'NOVEMBER'(034) centered,
       221 sy-vline,222(13)  'DECEMBER'(035) centered,
       235 sy-vline,252 sy-vline.
  format color off.
  write /1(252) sy-uline.
endform.            "top_of_page
*&      Form  Display_report
Write the Report Output
form display_report.
  clear v_no.
  describe table rep_tab lines v_no.
  if v_no = 0.
    message i999 with
     'No Data found for the entered Selection'(015).
  endif.
  loop at rep_tab.
    format color 3.
    at new kostl.
      read table rep_tab index sy-tabix.
      write:/1 sy-vline, 2(12) 'Cost Center:'(009),
             14(10) rep_tab-kostl,
             25(30) rep_tab-ctext,
            252 sy-vline.
      format color off.
      write /1(252) sy-uline.
    endat.
    format color col_normal.
    write: /1 sy-vline, 2(8)   rep_tab-pernr,
          10 sy-vline, 11(30)  rep_tab-ename,
          41 sy-vline, 42(25)  rep_tab-ptext,
          67 sy-vline, 68(13)  rep_tab-ot1 no-zero,
          81 sy-vline, 82(13)  rep_tab-ot2 no-zero,
          95 sy-vline, 96(13)  rep_tab-ot3 no-zero,
         109 sy-vline,110(13)  rep_tab-ot4 no-zero,
         123 sy-vline,124(13)  rep_tab-ot5 no-zero,
         137 sy-vline,138(13)  rep_tab-ot6 no-zero,
         151 sy-vline,152(13)  rep_tab-ot7 no-zero,
         165 sy-vline,166(13)  rep_tab-ot8 no-zero,
         179 sy-vline,180(13)  rep_tab-ot9 no-zero,
         193 sy-vline,194(13)  rep_tab-ot10 no-zero,
         207 sy-vline,208(13)  rep_tab-ot11 no-zero,
         221 sy-vline,222(13)  rep_tab-ot12 no-zero,
         235 sy-vline,236(16)  rep_tab-ott no-zero,
         252 sy-vline.
    at end of kostl.
      write /1(252) sy-uline.
    endat.
    format color off.
    at last.
      sum.
      format color 1.
      write: /1 sy-vline,
            10 sy-vline, 11(30) 'Total'(017) centered,
            41 sy-vline,
            67 sy-vline, 68(13)  rep_tab-ot1 no-zero,
            81 sy-vline, 82(13)  rep_tab-ot2 no-zero,
            95 sy-vline, 96(13)  rep_tab-ot3 no-zero,
           109 sy-vline,110(13)  rep_tab-ot4 no-zero,
           123 sy-vline,124(13)  rep_tab-ot5 no-zero,
           137 sy-vline,138(13)  rep_tab-ot6 no-zero,
           151 sy-vline,152(13)  rep_tab-ot7 no-zero,
           165 sy-vline,166(13)  rep_tab-ot8 no-zero,
           179 sy-vline,180(13)  rep_tab-ot9 no-zero,
           193 sy-vline,194(13)  rep_tab-ot10 no-zero,
           207 sy-vline,208(13)  rep_tab-ot11 no-zero,
           221 sy-vline,222(13)  rep_tab-ot12 no-zero,
           235 sy-vline,236(16)  rep_tab-ott no-zero,
           252 sy-vline.
      write /1(252) sy-uline.
    endat.
    format color off.
  endloop.
endform.          "display_report
Reward points if useful
Regards
Anji

Similar Messages

  • Get data from PNPCE LDB in ABAP hr

    Hi all,
    I am workng on ABAP Hr.In it I am using PNPCE LDB, when I
    use GET PERNR statement  it don't give any syntax problem but the selection screen does not generate due to GET PERNR statement.
    Is there any Other statement to find the PERNR.
    Points will be sured for valuable answers.
    Thanks
    Sanket sethi

    A report that wants to use the PNPCE must enter this in its report attributes under Logical database.
    In addition, the PERNR structure must be declared in the report using the 'TABLES PERNR' statement. You can only use the PERNR structure again in certain circumstances. The use of the 'GET PERNR' event is therefore forbidden. Instead, use the 'GET PERAS' event. Except for the PERNR-PERNR component, all other components of the PERNR structure are no longer filled and have initial values. This kind of programming (with the exception of PERNR-PERNR) therefore not permitted.
    In addition to the 'GET PERAS' event, you can also use the GET PERSON' and 'GET GROUP' events. To be able to use these events, you must declare them using the NODES statement (NODES PERSON', 'NODES GROUP', or. NODES PERAS'.LdB's for HR are as follows:
    PA----
    PNP
    Payroll----
    PNPCE
    Recruitment -
    PAP
    Orgmanagement -
    PCH
    PA report Example in attrubutes u have to add LDB is PNPCE
    REPORT ZHR_TEST.
    Type-Pools *
    TYPE-POOLS : slis.
    Nodes *
    NODES: person,group,peras.
    Tables *
    TABLES: pernr,t512w,tfkbt,pa0022,pa0016,bkpf.
    Infotypes *
    INFOTYPES : 0000, "Actions
                         0001, "Org Details
                         0022, "Education Details
                         0041, "Date Specification
                         0002, "Personal Details
                         0016.
    Internal Tables *
    DATA :BEGIN OF t_output OCCURS 0,
               pernr TYPE pernr_d, " Personnel No.
               ename TYPE emnam, " Employee Name
               btrtl TYPE btrtl, "Personnel Subarea
               btext TYPE btext, "Personnel Subarea Text
               persk TYPE persk, "Grade
               ptext TYPE pktxt, "gradeText
    END OF t_output.
    DATA: t_fcat TYPE slis_t_fieldcat_alv.
    ALV Variable
    DATA : w_fieldcat TYPE slis_t_fieldcat_alv,
                wa_fieldcat TYPE slis_fieldcat_alv.
    Event : GET Pernr *
    GET peras.
    PERFORM read_data. "Data Selection
    Event : End-Of-Selection *
    END-OF-SELECTION.
    PERFORM f_addcat. "Field Cat
    PERFORM f_display. "Display
    *& Form read_data
    FORM read_data.
    *Organizational Assignment
    rp_provide_from_last p0001 space pn-begda pn-endda.
    IF pnp-sw-found EQ 1.
    t_output-pernr = p0001-pernr.
    t_output-ename = p0001-ename.
    t_output-btrtl = p0001-btrtl.
    t_output-persk = p0001-persk.
    *Personal sub area text
    SELECT SINGLE btext FROM t001p
    INTO t_output-btext
    WHERE btrtl = t_output-btrtl.
    *Grade text
    SELECT SINGLE ptext FROM t503t
    INTO t_output-ptext
    WHERE persk = t_output-persk AND
    sprsl = 'EN'.
    ENDIF.
    APPEND t_output.
    CLEAR t_output.
    ENDFORM. "
    *& Form f_addcat
    FORM f_addcat .
    *************Filling field catelog here.**************
    *& Form f_display
    FORM f_display.
    *Local Variable
    DATA : lv_repid LIKE sy-repid,
    ls_layout TYPE slis_layout_alv.
    lv_repid = sy-repid.
    ls_layout-zebra = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = lv_repid
    is_layout = ls_layout
    it_fieldcat = t_fcat
    i_save = 'A'
    TABLES
    t_outtab = t_output
    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. " f_display

  • How to use FTI_TR_CASH_FLOWS ldb in abap programming.

    I want to use FTI_TR_CASH_FLOWS  logical database in existing ABAP program but i am not able to use this logical data base in the program.Please suggest how to use this logical database in the program.

    I have developed a customized report and i want to use  logical database "FTI_TR_CASH_FLOWS" into my program . i don't know how to use SAPDBFTI_TR_CASH_FLOWS  into my report. how i pass data from my report to this LDB report. plz suggest.

  • Problem with ABAP QUERY LDB

    Hi to all,
    I am using LDB for ABAP Query. For this I given selection fields. I don't want selection screen as like standard one. Ex. For QM11 transaction what ever screen appering like that my query smae appering . Please give solution for this. I want my selection fields only in my selection screen while using LDB.
    Thanks.

    Resolved

  • Need example report program using PNPCE LDB in SAP HR

    Need example report program using PNPCE LDB in SAP HR.
    and how to create a report category in sap hr for using it as cutomised selection screen.

    Hi,
    Go through the following links, i hope it will help you.....
    /people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
    http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/893908#
    A sample prog with LDB PNP
    *& Report ZH_REPT_PAYMENT *
    report zh_rept_payment line-size 80 no standard page
    heading.
    tables: pernr, " Standard Selections for HR Master Data Reporting
    pcl1, " HR Cluster 1
    pcl2, " HR Cluster 2
    pa0009,
    PA9001,
    PA9006,
    pa0002,
    pc260 , " Cluster Directory for Payroll Results
    bnka .
    Infotypes
    infotypes: 0001. " Organizational Assignment
    Declaration of Internal Tables
    data : bnka1 like bnka occurs 0 with header line .
    data: begin of t_int_rep occurs 100,
    bankl like pc209-bankl, " Bank Number
    zlsch like pc209-zlsch, " Payment method
    pernr like pernr-pernr, " Employee Number
    ename like pernr-ename, " Employee Name
    bankn like pc209-bankn, " Bank Account Number
    betrg like pc209-betrg, " Amount to be transfered
    zweck like pa0009-zweck, " Purpose
    end of t_int_rep.
    data: begin of int_rep occurs 100,
    bankl like pc209-bankl, " Bank Number
    zlsch like pc209-zlsch, " Payment method
    pernr like pernr-pernr, " Employee Number
    ename like pernr-ename, " Employee Name
    bankn like pc209-bankn, " Bank Account Number
    betrg like pc209-betrg, " Amount to be transfered
    zweck like pa0009-zweck, " Purpose
    begda like pa0009-begda, "Begin date
    end of int_rep.
    Declaration of Data Variables
    data: ws_betrg like pc209-betrg, " BT Amount
    w_val like spell occurs 0 with header line,
    int_rep1(6), " TYPE I, " Employee Number
    cnt type i value 0, " Counter
    calcmolga like t500l-molga value '40', " Country Grouping
    v_id(15),
    calc_currency like t001-waers value 'INR'. " Currency
    data : ctr type i,
    dt_merge like pa0009-begda.
    data: ws_totemp(6) type c,
    ws_totamt(20) type c,
    r_mth(9) type c,
    ws_fpbeg(6) type c,
    ws_fpend(6) type c,
    ws_mthyr(6) type c,
    ws_mthyr_r(14) type c,
    r_mth_t(3) type c,
    ws_amt(8) type c,
    ws_bankl(14) type c,
    ws_date(6) type c,
    amount_word(500),
    total_page type i,
    pages type i,
    remain type i.
    data begin of i_spell.
    include structure spell .
    data end of i_spell .
    data : c_molga type t500l-molga value '40',
    c_banks type bnka-banks value 'IN'.
    Standard Includes
    include rpc2cd09. "Cluster CD data definition
    include pc2rxin0.
    include rpc2rx09.
    include rpppxd00. " Data Definition buffer PCL1/PCL2
    include rpppxd10. " Common Part buffer PCL1/PCL2
    include rpppxm00. " Buffer Handling RoutinePCL1/PCL2
    include zrpc2rox2. " Data Definition POCLSTERS (not J,K,U)
    Selection Screen
    selection-screen begin of block b1 with frame title text-001.
    parameter: pa_mth(2) type c default sy-datum+4(2) obligatory,
    pa_year(4) type c default sy-datum(4) obligatory,
    p_bankl like pc209-bankl, " Bank Number
    p_zlsch like pc209-zlsch. " Payment method
    selection-screen end of block b1.
    save_calc_currency = calc_currency.
    count_top = 0.
    get_pernr_flag = 0.
    Top-Of-Page
    top-of-page.
    perform convert_month using pa_mth(2) r_mth.
    ws_mthyr_r = r_mth.
    concatenate ws_mthyr_r pa_year into ws_mthyr_r separated by space.
    SKIP 5.
    skip 1.
    skip 4.
    if int_rep-bankl eq ' '.
    if int_rep-zlsch eq 'C' or int_rep-zlsch eq 'E' or
    int_rep-zlsch eq ' '.
    write: /1(85) 'CHEQUE PAYMENT STATEMENT'(047) centered.
    elseif int_rep-zlsch eq 'L'.
    write: /1(85) 'DEMAND DRAFT STATEMENT'(047) centered.
    endif.
    else.
    write: /1(85) 'BANK TRANSFER STATEMENT'(002) centered.
    endif.
    skip.
    write: /34 ws_mthyr_r,
    62 'Page :'(008),69(2) sy-pagno intensified off,
    ' Of ',78(2) pages intensified off.
    clear pages.
    read table bnka1 with key bankl = int_rep-bankl .
    if sy-subrc = 0.
    if int_rep-zlsch eq 'T'.
    write:/03(10) 'Bank Name : ', bnka1-banka.
    write:/03(10) 'Branch : ', bnka1-brnch.
    write:/03(10) 'Address : ', bnka1-stras.
    endif.
    endif.
    skip.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 2(5) 'Sl.No'(002),
    7 sy-vline, 8(8) 'Emp.No.'(003),
    16 sy-vline,17(35) 'Employee Name'(004).
    *--added for Demand Draft
    if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
    write : 47 sy-vline, 48(15) 'Payable at'(005).
    else.
    write : 47 sy-vline,48(15) 'Account No.'(005).
    endif.
    write: 63 sy-vline,64(16) 'Amount'(006),
    80 sy-vline.
    write:/1(80) sy-uline.
    end-of-page.
    write:/1(80) sy-uline.
    write:/2 'Printed on ', sy-datum.
    Start-of-selection.
    start-of-selection.
    *perform h_headr.
    ctr = 0.
    set margin 5.
    call function 'RP_GET_CURRENCY'
    exporting
    molga = calcmolga
    importing
    waers = calc_currency
    exceptions
    others.
    if sy-subrc ne 0.
    calc_currency = 'DEM'.
    calc_currency = save_calc_currency.
    endif.
    get pernr.
    cd-key-pernr = pernr-pernr.
    perform import_cluster.
    get_pernr_flag = 1.
    check : ocd-version-molga eq calcmolga.
    The table 'tabpernr' is filled with the personnel numbers
    and is used after selection is finished.
    move-corresponding pernr to tabpernr.
    append tabpernr.
    The table 'tab_rgdir' is filled
    loop at rgdir.
    rx-key-pernr = pernr-pernr.
    unpack rgdir-seqnr to rx-key-seqno.
    perform int_tab. "fill tab_rgdir
    perform import_bt.
    perform validate.
    endloop.
    End of Selection
    end-of-selection.
    *perform h_headr.
    perform convert_date_a using pa_mth r_mth_t.
    sort int_rep by bankl zlsch pernr betrg descending.
    delete adjacent duplicates from int_rep
    comparing bankl zlsch pernr .
    sort int_rep by bankl zlsch bankn . "PERNR.
    loop at int_rep.
    at new bankl.
    select single * into bnka1 from bnka
    where banks = c_banks and
    bankl = int_rep-bankl .
    append bnka1.
    clear bnka1.
    endat.
    endloop.
    for Demand Draft - purpose added
    loop at int_rep.
    concatenate pa_year(4) pa_mth(2) '01' into dt_merge.
    select single * "zweck into int_rep-zweck
    from pa0009 where
    pernr = int_rep-pernr and
    bankl = int_rep-bankl and
    zlsch = int_rep-zlsch
    and begda <= dt_merge and
    endda >= dt_merge .
    if sy-subrc = 0.
    int_rep-zweck = pa0009-zweck.
    modify int_rep.
    endif.
    endloop.
    *-for DD and Chq sorted by PAyable at and EMPNO wise
    if p_zlsch = 'T' .
    sort int_rep by bankl zlsch bankn . "PERNR.
    else. "added for "payable at" for DD/Chq
    else.
    sort int_rep by zweck pernr . "PERNR.
    endif.
    *delete adjacent duplicates from int_rep.
    t_int_rep] = int_rep[.
    loop at int_rep.
    *-for page of page no.
    total_page = 0.
    loop at t_int_rep where bankl = int_rep-bankl
    and zlsch = int_rep-zlsch.
    total_page = total_page + 1.
    endloop.
    pages = total_page div 25.
    remain = total_page mod 25.
    comment bcoz its adding one extra page no.
    done as on 29/11/2004
    if remain > 0.
    pages = pages + 1.
    endif.
    **-end
    at new bankl.
    ctr = 0 .
    new-page.
    endat.
    at new zlsch.
    ctr = 0 .
    new-page.
    endat.
    clear v_id.
    select single natio
    into pa0002-natio
    from pa0002
    where pernr eq int_rep-pernr.
    *-testing......for soma
    if ctr > 24.
    ctr = 0 .
    write:/1(80) sy-uline.
    new-page .
    endif.
    ctr = ctr + 1 .
    cnt = cnt + 1.
    pack int_rep-pernr to int_rep1.
    write:/1 sy-vline, 2(3) cnt intensified off,
    7 sy-vline, 9(6) int_rep1 intensified off,
    16 sy-vline,17(35) int_rep-ename intensified off .
    if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
    write : 47 sy-vline,48(15) int_rep-zweck intensified off.
    else.
    write:
    47 sy-vline,48(15) int_rep-bankn intensified off .
    endif.
    write: 63 sy-vline,64(16) int_rep-betrg
    intensified off currency 'INR',
    80 sy-vline.
    ws_betrg = ws_betrg + int_rep-betrg.
    *-testing......for soma
    skip.
    write :
    /1 sy-vline, 7 sy-vline ,16 sy-vline ,47 sy-vline,63 sy-vline,80
    sy-vline .
    *-end testing......for soma
    at end of zlsch.
    if int_rep-bankl = ' '.
    call function 'HR_IN_CHG_INR_WRDS'
    exporting
    amt_in_num = ws_betrg
    importing
    amt_in_words = amount_word
    EXCEPTIONS
    DATA_TYPE_MISMATCH = 1
    OTHERS = 2
    w_val-word = amount_word.
    concatenate 'INR.' w_val-word into w_val-word
    separated by space.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 7 'Total transfer:'(009),
    64(16) ws_betrg intensified off currency 'INR',
    80 sy-vline.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
    80 sy-vline.
    write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
    80 sy-vline.
    write:/1(80) sy-uline.
    clear: ws_betrg,cnt.
    skip 2.
    write: /2 'Prepared by :'(010), '_______________'(013),
    45 'Checked by :'(011),'_______________'(013).
    skip 2.
    write: /2 'Printed On ', sy-datum,
    45 'Approved by :'(012),'_______________'(013).
    clear sy-pagno.
    endif.
    endat.
    at end of bankl.
    if int_rep-bankl ' '.
    call function 'HR_IN_CHG_INR_WRDS'
    exporting
    amt_in_num = ws_betrg
    importing
    amt_in_words = amount_word
    EXCEPTIONS
    DATA_TYPE_MISMATCH = 1
    OTHERS = 2
    w_val-word = amount_word.
    concatenate 'INR.' w_val-word into w_val-word
    separated by space.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 7 'Total transfer:'(009),
    64(16) ws_betrg intensified off currency 'INR',
    80 sy-vline.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
    80 sy-vline.
    write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
    80 sy-vline.
    write:/1(80) sy-uline.
    clear: ws_betrg,cnt.
    skip 2.
    write: /2 'Prepared by :'(010), '_______________'(013),
    45 'Checked by :'(011),'_______________'(013).
    skip 2.
    write: /2 'Printed on ', sy-datum,
    45 'Approved by :'(012),'_______________'(013).
    clear sy-pagno.
    NEW-PAGE.
    endif.
    endat.
    endloop.
    End of Page
    end-of-page.
    write: /2 'Prepared by :'(010), '_______________',
    45 'Checked by :'(011),'_______________'.
    *& Form IMPORT_CLUSTER
    Importing Data from Cluster *
    form import_cluster.
    sy-subrc = 0.
    rp-imp-c2-cd.
    if sy-subrc eq 0.
    if cd-version-number ne ocd-version-number.
    endif.
    endif. " SY-SUBRC EQ 0
    endform. " IMPORT_CLUSTER
    *& Form INT_TAB
    Filling internal table tab_rgdir form int_tab.
    *Fill internal table tab_rgdir.
    move-corresponding rgdir to tab_rgdir.
    tab_rgdir-pernr = pernr-pernr.
    append tab_rgdir.
    endform. " INT_TAB
    *& Form IMPORT_bt
    Import Values from Bank Transactions Table (BT) form import_bt.
    rp-init-buffer.
    RP-IMP-C2-RX.
    rp-imp-c2-in.
    if rp-imp-in-subrc eq 0.
    if in-version-number ne oin-version-number.
    write: / 'Schlüssel des Clusters RX:'(015),
    rx-key-pernr, rx-key-seqno.
    write: / 'The imported version of the cluster'(016), 'RX',
    'is not current'(017).
    write: / 'Imported version :'(018),
    oin-version-number.
    write: / 'Current version of cluster :'(019),
    in-version-number.
    stop.
    else.
    sy-subrc = 0.
    endif.
    else.
    sy-subrc = 8.
    write: /
    'Inconsistencies between cluster directory and directory for'(020).
    write: /
    'No payroll results found for data in cluster directory'(021).
    write : /
    'Please contact hotline to solve the current problem'(022).
    endif.
    ws_fpbeg(2) = versc-fpbeg+4(2).
    ws_fpbeg+2(4) = versc-fpbeg(4).
    ws_fpend(2) = versc-fpend+4(2).
    ws_fpend+2(4) = versc-fpend(4).
    ws_mthyr(2) = pa_mth.
    ws_mthyr+2(4) = pa_year.
    check ws_mthyr = ws_fpbeg.
    check ws_mthyr = ws_fpend.
    loop at bt. "from pc209
    int_rep-pernr = pernr-pernr.
    int_rep-ename = pernr-ename.
    int_rep-bankl = bt-bankl.
    int_rep-bankn = bt-bankn.
    int_rep-betrg = bt-betrg.
    int_rep-zlsch = bt-zlsch.
    append int_rep.
    endloop.
    IF P_BANKL ' ' AND P_ZLSCH ' '.
    DELETE INT_REP WHERE BANKL P_BANKL.
    ELSEIF P_BANKL = ' ' AND P_ZLSCH ' '.
    DELETE INT_REP WHERE ZLSCH P_ZLSCH.
    ELSEIF P_BANKL ' ' AND P_ZLSCH = ' '.
    DELETE INT_REP WHERE BANKL P_BANKL.
    ENDIF.
    endform. " IMPORT_BT
    *& Form CONVERT_MONTH
    Fetching Month Text form convert_month using mth t_mth.
    case mth.
    when '01'.
    t_mth = 'January'(023).
    when '02'.
    t_mth = 'February'(024).
    when '03'.
    t_mth = 'March'(025).
    when '04'.
    t_mth = 'April'(026).
    when '05'.
    t_mth = 'May'(027).
    when '06'.
    t_mth = 'June'(028).
    when '07'.
    t_mth = 'July'(029).
    when '08'.
    t_mth = 'August'(030).
    when '09'.
    t_mth = 'September'(031).
    when '10'.
    t_mth = 'October'(032).
    when '11'.
    t_mth = 'November'(033).
    when '12'.
    t_mth = 'December'(034).
    endcase.
    endform. " CONVERT_MONTH
    *& Form CONVERT_DATE_A
    Fetching Month Text * form convert_date_a using mth_t t_mth_t.
    case mth_t.
    when '01'.
    t_mth_t = 'Jan.'(035).
    when '02'.
    t_mth_t = 'Feb.'(036).
    when '03'.
    t_mth_t = 'Mar.'(037).
    when '04'.
    t_mth_t = 'Apr.'(038).
    when '05'.
    t_mth_t = 'May.'(039).
    when '06'.
    t_mth_t = 'Jun.'(040).
    when '07'.
    t_mth_t = 'Jul.'(041).
    when '08'.
    t_mth_t = 'Aug.'(042).
    when '09'.
    t_mth_t = 'Sep.'(043).
    when '10'.
    t_mth_t = 'Oct.'(044).
    when '11'.
    t_mth_t = 'Nov.'(045).
    when '12'.
    t_mth_t = 'Dec.'(046).
    endcase.
    endform. " CONVERT_DATE_A
    *& Form VALIDATE
    text
    --> p1 text
    <-- p2 text form validate .
    if p_bankl <> ' ' and p_zlsch ' '.
    delete int_rep where bankl p_bankl.
    elseif p_bankl = ' ' and p_zlsch ' '.
    delete int_rep where zlsch p_zlsch.
    elseif p_bankl ' ' and p_zlsch = ' '.
    delete int_rep where bankl p_bankl.
    endif.
    endform. " VALIDATE
    check this weblog.....
    /people/dj.adams/blog/2003/11/13/food-for-thought-ldbs-and-abap-objects
    Also , check the following link too.
    http://www.datamanagementgroup.com/Resources/Articles/Article_1005_2.asp
    Regards,
    Harish

  • Logical Database of SAP Example Program

    Hi all,
    I need an example ABAP program using standard Logical Database ( LDB ) .
    Help me.
    Regards,
    Peachi.

    Hi,
    Some links to refer..
    /people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
    http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/893908#
    A sample prog with LDB PNP
    *& Report ZH_REPT_PAYMENT *
    report zh_rept_payment line-size 80 no standard page
    heading.
    tables: pernr, " Standard Selections for HR Master Data Reporting
    pcl1, " HR Cluster 1
    pcl2, " HR Cluster 2
    pa0009,
    PA9001,
    PA9006,
    pa0002,
    pc260 , " Cluster Directory for Payroll Results
    bnka .
    Infotypes
    infotypes: 0001. " Organizational Assignment
    Declaration of Internal Tables
    data : bnka1 like bnka occurs 0 with header line .
    data: begin of t_int_rep occurs 100,
    bankl like pc209-bankl, " Bank Number
    zlsch like pc209-zlsch, " Payment method
    pernr like pernr-pernr, " Employee Number
    ename like pernr-ename, " Employee Name
    bankn like pc209-bankn, " Bank Account Number
    betrg like pc209-betrg, " Amount to be transfered
    zweck like pa0009-zweck, " Purpose
    end of t_int_rep.
    data: begin of int_rep occurs 100,
    bankl like pc209-bankl, " Bank Number
    zlsch like pc209-zlsch, " Payment method
    pernr like pernr-pernr, " Employee Number
    ename like pernr-ename, " Employee Name
    bankn like pc209-bankn, " Bank Account Number
    betrg like pc209-betrg, " Amount to be transfered
    zweck like pa0009-zweck, " Purpose
    begda like pa0009-begda, "Begin date
    end of int_rep.
    Declaration of Data Variables
    data: ws_betrg like pc209-betrg, " BT Amount
    w_val like spell occurs 0 with header line,
    int_rep1(6), " TYPE I, " Employee Number
    cnt type i value 0, " Counter
    calcmolga like t500l-molga value '40', " Country Grouping
    v_id(15),
    calc_currency like t001-waers value 'INR'. " Currency
    data : ctr type i,
    dt_merge like pa0009-begda.
    data: ws_totemp(6) type c,
    ws_totamt(20) type c,
    r_mth(9) type c,
    ws_fpbeg(6) type c,
    ws_fpend(6) type c,
    ws_mthyr(6) type c,
    ws_mthyr_r(14) type c,
    r_mth_t(3) type c,
    ws_amt(8) type c,
    ws_bankl(14) type c,
    ws_date(6) type c,
    amount_word(500),
    total_page type i,
    pages type i,
    remain type i.
    data begin of i_spell.
    include structure spell .
    data end of i_spell .
    data : c_molga type t500l-molga value '40',
    c_banks type bnka-banks value 'IN'.
    Standard Includes
    include rpc2cd09. "Cluster CD data definition
    include pc2rxin0.
    include rpc2rx09.
    include rpppxd00. " Data Definition buffer PCL1/PCL2
    include rpppxd10. " Common Part buffer PCL1/PCL2
    include rpppxm00. " Buffer Handling RoutinePCL1/PCL2
    include zrpc2rox2. " Data Definition POCLSTERS (not J,K,U)
    Selection Screen
    selection-screen begin of block b1 with frame title text-001.
    parameter: pa_mth(2) type c default sy-datum+4(2) obligatory,
    pa_year(4) type c default sy-datum(4) obligatory,
    p_bankl like pc209-bankl, " Bank Number
    p_zlsch like pc209-zlsch. " Payment method
    selection-screen end of block b1.
    save_calc_currency = calc_currency.
    count_top = 0.
    get_pernr_flag = 0.
    Top-Of-Page
    top-of-page.
    perform convert_month using pa_mth(2) r_mth.
    ws_mthyr_r = r_mth.
    concatenate ws_mthyr_r pa_year into ws_mthyr_r separated by space.
    SKIP 5.
    skip 1.
    skip 4.
    if int_rep-bankl eq ' '.
    if int_rep-zlsch eq 'C' or int_rep-zlsch eq 'E' or
    int_rep-zlsch eq ' '.
    write: /1(85) 'CHEQUE PAYMENT STATEMENT'(047) centered.
    elseif int_rep-zlsch eq 'L'.
    write: /1(85) 'DEMAND DRAFT STATEMENT'(047) centered.
    endif.
    else.
    write: /1(85) 'BANK TRANSFER STATEMENT'(002) centered.
    endif.
    skip.
    write: /34 ws_mthyr_r,
    62 'Page :'(008),69(2) sy-pagno intensified off,
    ' Of ',78(2) pages intensified off.
    clear pages.
    read table bnka1 with key bankl = int_rep-bankl .
    if sy-subrc = 0.
    if int_rep-zlsch eq 'T'.
    write:/03(10) 'Bank Name : ', bnka1-banka.
    write:/03(10) 'Branch : ', bnka1-brnch.
    write:/03(10) 'Address : ', bnka1-stras.
    endif.
    endif.
    skip.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 2(5) 'Sl.No'(002),
    7 sy-vline, 8(8) 'Emp.No.'(003),
    16 sy-vline,17(35) 'Employee Name'(004).
    *--added for Demand Draft
    if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
    write : 47 sy-vline, 48(15) 'Payable at'(005).
    else.
    write : 47 sy-vline,48(15) 'Account No.'(005).
    endif.
    write: 63 sy-vline,64(16) 'Amount'(006),
    80 sy-vline.
    write:/1(80) sy-uline.
    end-of-page.
    write:/1(80) sy-uline.
    write:/2 'Printed on ', sy-datum.
    Start-of-selection.
    start-of-selection.
    *perform h_headr.
    ctr = 0.
    set margin 5.
    call function 'RP_GET_CURRENCY'
    exporting
    molga = calcmolga
    importing
    waers = calc_currency
    exceptions
    others.
    if sy-subrc ne 0.
    calc_currency = 'DEM'.
    calc_currency = save_calc_currency.
    endif.
    get pernr.
    cd-key-pernr = pernr-pernr.
    perform import_cluster.
    get_pernr_flag = 1.
    check : ocd-version-molga eq calcmolga.
    The table 'tabpernr' is filled with the personnel numbers
    and is used after selection is finished.
    move-corresponding pernr to tabpernr.
    append tabpernr.
    The table 'tab_rgdir' is filled
    loop at rgdir.
    rx-key-pernr = pernr-pernr.
    unpack rgdir-seqnr to rx-key-seqno.
    perform int_tab. "fill tab_rgdir
    perform import_bt.
    perform validate.
    endloop.
    End of Selection
    end-of-selection.
    *perform h_headr.
    perform convert_date_a using pa_mth r_mth_t.
    sort int_rep by bankl zlsch pernr betrg descending.
    delete adjacent duplicates from int_rep
    comparing bankl zlsch pernr .
    sort int_rep by bankl zlsch bankn . "PERNR.
    loop at int_rep.
    at new bankl.
    select single * into bnka1 from bnka
    where banks = c_banks and
    bankl = int_rep-bankl .
    append bnka1.
    clear bnka1.
    endat.
    endloop.
    for Demand Draft - purpose added
    loop at int_rep.
    concatenate pa_year(4) pa_mth(2) '01' into dt_merge.
    select single * "zweck into int_rep-zweck
    from pa0009 where
    pernr = int_rep-pernr and
    bankl = int_rep-bankl and
    zlsch = int_rep-zlsch
    and begda <= dt_merge and
    endda >= dt_merge .
    if sy-subrc = 0.
    int_rep-zweck = pa0009-zweck.
    modify int_rep.
    endif.
    endloop.
    *-for DD and Chq sorted by PAyable at and EMPNO wise
    if p_zlsch = 'T' .
    sort int_rep by bankl zlsch bankn . "PERNR.
    else. "added for "payable at" for DD/Chq
    else.
    sort int_rep by zweck pernr . "PERNR.
    endif.
    *delete adjacent duplicates from int_rep.
    t_int_rep] = int_rep[.
    loop at int_rep.
    *-for page of page no.
    total_page = 0.
    loop at t_int_rep where bankl = int_rep-bankl
    and zlsch = int_rep-zlsch.
    total_page = total_page + 1.
    endloop.
    pages = total_page div 25.
    remain = total_page mod 25.
    comment bcoz its adding one extra page no.
    done as on 29/11/2004
    if remain > 0.
    pages = pages + 1.
    endif.
    **-end
    at new bankl.
    ctr = 0 .
    new-page.
    endat.
    at new zlsch.
    ctr = 0 .
    new-page.
    endat.
    clear v_id.
    select single natio
    into pa0002-natio
    from pa0002
    where pernr eq int_rep-pernr.
    *-testing......for soma
    if ctr > 24.
    ctr = 0 .
    write:/1(80) sy-uline.
    new-page .
    endif.
    ctr = ctr + 1 .
    cnt = cnt + 1.
    pack int_rep-pernr to int_rep1.
    write:/1 sy-vline, 2(3) cnt intensified off,
    7 sy-vline, 9(6) int_rep1 intensified off,
    16 sy-vline,17(35) int_rep-ename intensified off .
    if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
    write : 47 sy-vline,48(15) int_rep-zweck intensified off.
    else.
    write:
    47 sy-vline,48(15) int_rep-bankn intensified off .
    endif.
    write: 63 sy-vline,64(16) int_rep-betrg
    intensified off currency 'INR',
    80 sy-vline.
    ws_betrg = ws_betrg + int_rep-betrg.
    *-testing......for soma
    skip.
    write :
    /1 sy-vline, 7 sy-vline ,16 sy-vline ,47 sy-vline,63 sy-vline,80
    sy-vline .
    *-end testing......for soma
    at end of zlsch.
    if int_rep-bankl = ' '.
    call function 'HR_IN_CHG_INR_WRDS'
    exporting
    amt_in_num = ws_betrg
    importing
    amt_in_words = amount_word
    EXCEPTIONS
    DATA_TYPE_MISMATCH = 1
    OTHERS = 2
    w_val-word = amount_word.
    concatenate 'INR.' w_val-word into w_val-word
    separated by space.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 7 'Total transfer:'(009),
    64(16) ws_betrg intensified off currency 'INR',
    80 sy-vline.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
    80 sy-vline.
    write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
    80 sy-vline.
    write:/1(80) sy-uline.
    clear: ws_betrg,cnt.
    skip 2.
    write: /2 'Prepared by :'(010), '_______________'(013),
    45 'Checked by :'(011),'_______________'(013).
    skip 2.
    write: /2 'Printed On ', sy-datum,
    45 'Approved by :'(012),'_______________'(013).
    clear sy-pagno.
    endif.
    endat.
    at end of bankl.
    if int_rep-bankl ' '.
    call function 'HR_IN_CHG_INR_WRDS'
    exporting
    amt_in_num = ws_betrg
    importing
    amt_in_words = amount_word
    EXCEPTIONS
    DATA_TYPE_MISMATCH = 1
    OTHERS = 2
    w_val-word = amount_word.
    concatenate 'INR.' w_val-word into w_val-word
    separated by space.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 7 'Total transfer:'(009),
    64(16) ws_betrg intensified off currency 'INR',
    80 sy-vline.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
    80 sy-vline.
    write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
    80 sy-vline.
    write:/1(80) sy-uline.
    clear: ws_betrg,cnt.
    skip 2.
    write: /2 'Prepared by :'(010), '_______________'(013),
    45 'Checked by :'(011),'_______________'(013).
    skip 2.
    write: /2 'Printed on ', sy-datum,
    45 'Approved by :'(012),'_______________'(013).
    clear sy-pagno.
    NEW-PAGE.
    endif.
    endat.
    endloop.
    End of Page
    end-of-page.
    write: /2 'Prepared by :'(010), '_______________',
    45 'Checked by :'(011),'_______________'.
    *& Form IMPORT_CLUSTER
    Importing Data from Cluster *
    form import_cluster.
    sy-subrc = 0.
    rp-imp-c2-cd.
    if sy-subrc eq 0.
    if cd-version-number ne ocd-version-number.
    endif.
    endif. " SY-SUBRC EQ 0
    endform. " IMPORT_CLUSTER
    *& Form INT_TAB
    Filling internal table tab_rgdir
    form int_tab.
    *Fill internal table tab_rgdir.
    move-corresponding rgdir to tab_rgdir.
    tab_rgdir-pernr = pernr-pernr.
    append tab_rgdir.
    endform. " INT_TAB
    *& Form IMPORT_bt
    Import Values from Bank Transactions Table (BT)
    form import_bt.
    rp-init-buffer.
    RP-IMP-C2-RX.
    rp-imp-c2-in.
    if rp-imp-in-subrc eq 0.
    if in-version-number ne oin-version-number.
    write: / 'Schlüssel des Clusters RX:'(015),
    rx-key-pernr, rx-key-seqno.
    write: / 'The imported version of the cluster'(016), 'RX',
    'is not current'(017).
    write: / 'Imported version :'(018),
    oin-version-number.
    write: / 'Current version of cluster :'(019),
    in-version-number.
    stop.
    else.
    sy-subrc = 0.
    endif.
    else.
    sy-subrc = 8.
    write: /
    'Inconsistencies between cluster directory and directory for'(020).
    write: /
    'No payroll results found for data in cluster directory'(021).
    write : /
    'Please contact hotline to solve the current problem'(022).
    endif.
    ws_fpbeg(2) = versc-fpbeg+4(2).
    ws_fpbeg+2(4) = versc-fpbeg(4).
    ws_fpend(2) = versc-fpend+4(2).
    ws_fpend+2(4) = versc-fpend(4).
    ws_mthyr(2) = pa_mth.
    ws_mthyr+2(4) = pa_year.
    check ws_mthyr = ws_fpbeg.
    check ws_mthyr = ws_fpend.
    loop at bt. "from pc209
    int_rep-pernr = pernr-pernr.
    int_rep-ename = pernr-ename.
    int_rep-bankl = bt-bankl.
    int_rep-bankn = bt-bankn.
    int_rep-betrg = bt-betrg.
    int_rep-zlsch = bt-zlsch.
    append int_rep.
    endloop.
    IF P_BANKL ' ' AND P_ZLSCH ' '.
    DELETE INT_REP WHERE BANKL P_BANKL.
    ELSEIF P_BANKL = ' ' AND P_ZLSCH ' '.
    DELETE INT_REP WHERE ZLSCH P_ZLSCH.
    ELSEIF P_BANKL ' ' AND P_ZLSCH = ' '.
    DELETE INT_REP WHERE BANKL P_BANKL.
    ENDIF.
    endform. " IMPORT_BT
    *& Form CONVERT_MONTH
    Fetching Month Text
    form convert_month using mth t_mth.
    case mth.
    when '01'.
    t_mth = 'January'(023).
    when '02'.
    t_mth = 'February'(024).
    when '03'.
    t_mth = 'March'(025).
    when '04'.
    t_mth = 'April'(026).
    when '05'.
    t_mth = 'May'(027).
    when '06'.
    t_mth = 'June'(028).
    when '07'.
    t_mth = 'July'(029).
    when '08'.
    t_mth = 'August'(030).
    when '09'.
    t_mth = 'September'(031).
    when '10'.
    t_mth = 'October'(032).
    when '11'.
    t_mth = 'November'(033).
    when '12'.
    t_mth = 'December'(034).
    endcase.
    endform. " CONVERT_MONTH
    *& Form CONVERT_DATE_A
    Fetching Month Text *
    form convert_date_a using mth_t t_mth_t.
    case mth_t.
    when '01'.
    t_mth_t = 'Jan.'(035).
    when '02'.
    t_mth_t = 'Feb.'(036).
    when '03'.
    t_mth_t = 'Mar.'(037).
    when '04'.
    t_mth_t = 'Apr.'(038).
    when '05'.
    t_mth_t = 'May.'(039).
    when '06'.
    t_mth_t = 'Jun.'(040).
    when '07'.
    t_mth_t = 'Jul.'(041).
    when '08'.
    t_mth_t = 'Aug.'(042).
    when '09'.
    t_mth_t = 'Sep.'(043).
    when '10'.
    t_mth_t = 'Oct.'(044).
    when '11'.
    t_mth_t = 'Nov.'(045).
    when '12'.
    t_mth_t = 'Dec.'(046).
    endcase.
    endform. " CONVERT_DATE_A
    *& Form VALIDATE
    text
    --> p1 text
    <-- p2 text
    form validate .
    if p_bankl <> ' ' and p_zlsch ' '.
    delete int_rep where bankl p_bankl.
    elseif p_bankl = ' ' and p_zlsch ' '.
    delete int_rep where zlsch p_zlsch.
    elseif p_bankl ' ' and p_zlsch = ' '.
    delete int_rep where bankl p_bankl.
    endif.
    endform. " VALIDATE
    check this weblog.....
    /people/dj.adams/blog/2003/11/13/food-for-thought-ldbs-and-abap-objects
    Also , check the following link too.
    http://www.datamanagementgroup.com/Resources/Articles/Article_1005_2.asp
    Regards,
    Satish

  • Calling logical database

    Hi,
    I have created one logical database using BSAK & BSEG named as "ZVENLDB".
    While iam calling this LDB into abap program...it is showing error that "BSAK is not a node of the logical database".
    Could any one tell me where might be the problem?
    ...this is abap program...
    report Z_SAMPLE.
    NODES: BSAK,BSEG.
    GET BSAK.
    SKIP.
    WRITE:/BSAK.
    GET BSEG.
    SKIP.
    WRITE:/BSEG.
    Reward guaranteed...
    Kaki

    Here is the link for help for more details:
    http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
    Hope this will be helpful.

  • How to use LDB PNP with ABAP objects in a program

    Hello,
    I am wondering if anybody has used the HR logical database(LDB) PNP with user defined ABAP objects in a program? I am using the FM- <b>LDB_PROCESS</b> but its not working. Also assigning PNP in the attributes section of the program -- so that I can use predefined fields from the LDB and then invoking the FM doesn't work -- throwing 'Logical database already active' error.
    I suppose even with the ABAP objects and the new FM -- I should still be able to utilize the pre-defined fields of the PNP database -- and also the built in authorizations. I cannot use GET PERNR and REJECT as they give errors. I understand that the use of HR-macros (RP-PROVIDE-FROM-LAST and et al.) are not allowed as they use the table work area -- which is not allowed in ABAP-OOPS.
    I would really appreciate if anyone could show me some insight regarding this. Thank you.
    Kshitij R. Devre

    Hi Kshitij
    It would be really good if we could use both together. But as I know, it is not possible. "GET pernr." is an event-like loop statement and so cannot be used in OO context. And I guess, the same restriction holds for the "LDB_PROCESS" since it uses LDB-specific processing.
    What I suggest you is to use standard and BAPI functions.
    Sorry for giving bad news...
    *--Serdar

  • Want to have own selection screen  in HR-ABAP report using LDB

    Hi experts,
            I am working on HR-ABAP report using LDB pnp and infotypes..But, here we get the built in selection criterion..but I want my own selection screen to be displayed..whats the solution for this??? Is it possible to create my own selection screen instead of default one..and how???
    Please help me..its very urgent..

    Hi,
    chk this out:
    Create Report Categories                                                                               
    In this step, you define the report categories and determine the layout
       of the standard selection screen for these report categories. You can 
       create report categories for programs or queries that are based on the
       PNP or PNPCE logical databases.                                                                               
    The definition of report categories is divided into two sections:                                                                               
    o   In the Change Report Category view, you define general attributes 
           such as sort order, input fields for date, and so on.                                                                               
    o   In the Change Selection Criteria view, you define which selection 
           fields of the logical database should be avaliable on the selection
           screen.                                                                               
    Example                                                                               
    You want to set up your system so that your employees can only start  
       evaluation reports for Payroll if they use a payroll area. Within a   
       payroll area, you should be able to select according to personnel     
       number. Additional selection criteria should not be possible and you  
       should not be allowed to enter a sort sequence.                       
    Standard settings                                                                               
    The standard system already contains report categories. You can find the 
    attributes of the report categories in the table.                                                                               
    Note the following five report categories in particular:                                                                               
    o   Report category ' ' is the SAP default report category for     
        programs that are based on the PNP logical database.                                                                               
    o   Report category PNPCE is the SAP default category for programs that  
        are based on the PNPCE logical database.                                                                               
    o   Report category '00000000' is the customer-specific default category 
        for programs that are based on the PNP logical database.                                                                               
    o   Report category '0PNPCE' is the customer-specific default category   
        for programs that are based on the PNPCE logical database.                                                                               
    o   Report category __X2001 is the default category for Queries  that    
        are based on an InfoSet of the PNP LDB.                                                                               
    o   Report category QUEPNPCE is the default category for queries that    
        are based on an InfoSet of the PNPCE LDB.                                                                               
    The default report categories are used when a report is called if    
        the report has not been assigned a report category.                  
    Parameters and Options for Report Categories of the LDB PNP and PNPCE  
    Parameters and Options in Screen Area General Data                     
       If you activate this parameter, you can only enter data on the data
       selection period if you use reports that have been assigned. The   
       same date entries are then used for the person selection as for the
       date selection.                                                                               
    o   Matchcode allowed                                                  
       If you activate this parameter, you have use of a Matchcode        
       pushbutton (search help) if you use reports that have been assigned.
       This pushbutton enables you to perform the person selection.                                                                               
    o   Sort allowed                                                       
       If you activate this parameter, you have use of a Sort pushbutton if
       you use report that have been assigned. This pushbutton enables you
       to define a sort order before you execute the report.                                                                               
    o   Organizational structure allowed                                   
       If you activate this parameter, you have use of an Org.Structure   
       pushbutton if you use reports that have been assigned. This        
       pushbutton enables you to perform the person selection.            
       Note:                                                              
       For more information about these options, see the online           
       documentation under this path:                                     
       SAP Library -> Human Resources -> Reporting in Human Resources     
       Management -> Standard HR Reports -> Report Selection Screen in    
       Human Resources Management.                                                                               
    Parameters and Options in Screen Areas Data Selection Period/Person    
    Selection Period/Payroll Area/Period/Year                                                                               
    o   Options for data selection period and person selection period (key 
        date and so on)                                                    
        Here you define which options for date and person selection are    
        available for reports that have been assigned.                                                                               
    o   Options for payroll area/period/year                               
        Here you define which options for selection using payroll          
        area/period/year are available for reports that have been assigned.                                                                               
    Parameters and Options in Screen Area Selection View                                                                               
    o   Type/Name                                                          
        This parameter enables you to use selection views to define report 
        categories. You use the selection view selected here to determine  
        which fields are available in the Dynamic Selectionsy.                                                                               
    Note:                                                              
        You create selection views for the PNP and PNPCE logical databases 
        in the Object Navigator (SE80):                                    
        1. Start the Object Navigator (SE80)                               
        2. Choose Workbench -> Edit Object.                                
        3. Choose the More... tab page and the Selection view on this tab  
        page.                                                              
        4. Choose Create.                                                  
        5. In the Create Selection View dialog box, choose the For any     
        tables option.                                                     
        6. In the Name of view field, enter a name for your selection view.
        7. In the Tables dialog box, enter the name of the table from which
        you want to use fields.                                            
        Note:                                                              
        When you enter the table name, observe the naming convention in    
        Personnel Administration:                                          
        Infotype number: nnnn -> table name: PAnnnn                        
        8. Choose Continue.                                                
        9. In the Functional groups area, define functional groups by      
        assigning a name and a number.                                     
        10. Assign fields from the selected tables to the functional groups
        by entering the number of the desired functional group in front of 
        each field.                                                        
        11. Save your entries.                                                                               
    For more information about adjusting the dynamic selections using 
    your own selection views, see the online documentation under the  
    following menu path:                                              
    SAP Library -> Human Resources -> Reporting in Human Resources    
    Management -> HR Standard Reports -> Report Selection Screen in   
    Human Resources Management -> Enhancing the Selection Screen -    
    Dynamic Selections.                                                                               
    If you do not want to offer dynamic selections, make the following
    settings:                                                                               
    -   LDB PNP: In the Selection view field, enter PNP_NO_FREE_SEL.  
    -   LDB PNPCE: Leave the Selection view field empty.                                                                               
    Parameters and Options in Screen Area Data Selection Period/Person   
    Selection Period/Payroll Area/Period/Year                                                                               
    o   Available input parameters, date or period entry (today, key date,
       all, and so on), and standard value.                             
       Using the Standard value option, you define which of the selected
       options is shown.                                                                               
    Parameters and Options in Screen Area CE Selection Fields                                                                               
    o   CE selection fields (external person ID, grouping reason, grouping
       value)                                                           
       Using the options in this area, you define whether the external  
       person Id, grouping reason, or grouping value are available on the
       selection screen.                                                
       Note:                                                            
       These parameters are only relevant for you if you implement      
       Concurrent Employment (see also note 517071).                                                                               
    Parameters and Options in Screen Area Selection view                                                                               
    o   Dynamic selections as dialog box                                  
        If this switch is set, you can call the dynamic selections as a   
        dialog box.                                                                               
    o   Dynamic selections active                                         
        If this switch is set, the dynamic selections of the logical      
        database are active at the start of the report.                                                                               
    Note that the following combinations are possible for the last two
        options mentioned:                                                                               
    Dyn.Sel. as dialog box/Dyn.Sel. active: inactive/inactive         
        Dyn.Sel. as dialog box/Dyn.Sel. active: inactive/active           
        Dyn.Sel. as dialog box/Dyn.Sel. active: active/inactive                                                                               
    Activities                                                                               
    1.  Choose Edit -> New entries.                                                                               
    2.  Enter an abbreviation and a long text for the report category.         
        The customer name range for report categories is 0-9.                                                                               
    3.  Select the For the PNPCE logical database checkbox, if you want to     
        create a report category for a program or for queries of the PNPCE     
        logical database.                                                                               
    4.  In the General Data screen area, choose the desired options.           
        If you want to use selection IDs, you must have first created and      
        grouped selection Ids. The IMG path to do this is given in the         
        parameter description section.                                                                               
    5.  In the Data selection period/person selection period or Selection      
        period screen area, choose the desired options.                                                                               
    6.  In the Selection view screen area, choose the desired options.                                                                               
    7.  In the CE selection fields screen area, choose the desired (only       
        possible for report categories of the LDB PNPCE).                                                                               
    8.  Save your entries.                                                                               
    9.  Choose the subactivity Permitted selection criteria.                                                                               
    10. Choose Edit -> New entries.                                                                               
    11. In the Select option field, use the input help to select each field    
        that should be available on the selection screen.                                                                               
    12. Select the checkbox in the 1.page column, if you want this selection   
        field to be available directly when you call the selection screen.                                                                               
    Further notes                                                                               
    13. If you want to copy entries, you still have to enter the selection     
        parameters again in the subsequent screen.                                                                               
    o   If you create the report category '000000000', a selection screen is   
        generated according to report category '00000000'for all reports for   
        which a report category has not explicitly been assigned.                                                                               
    Assign Report Categories                                                                               
    In this step, you assign a report category to your reports.                                                                               
    Example                                                                               
    You have created your own report, for example ZPCTEST1, and would like
        it to have the selection screen that corresponds to that of the       
        evaluation report for Payroll, which is assigned to report category   
        '__M00001'.                                                           
        Assign report category '__M00001' to the report.                                                                               
    Requirements                                                                               
    You must have defined the Report Categories.                                                                               
    Standard settings                                                                               
    SAP Standard Reports:                                                                               
    In the standard system, reports are assigned a report category. If you
        want to override these assignments, perform the activities described  
        here. If you want to assign report categories to standard reports using
        SE38, this represents a modification.                                                                               
    Customer-Specific Reports:                                                                               
    For reports you have developed yourself, you can either assign report 
        categories by performing the activities described here or directly in SE38.
    Recommendation                                                                               
    Only assign a report category if you have created your own reports or if  
    the selection screens in the standard system do not meet your             
    requirements.                                                                               
    Activities                                                                               
    1.  Choose Edit -> New entries.                                                                               
    2.  Perform the required assignment using the Program name and Report     
       category fields.                                                                               
    3.  Save your entries.                   
    reward if helpful
    regards,
    madhumitha

  • HR ABAP- concurrent employment  ( LDB :PNPCE)

    Hi
         I am working on concurrent employment in HR. I have to write ABAP report I don’t know where to start. Do you guys give me some idea? How I’ll start. I know that we use LDB PNPCE for concurrent employment. Do you guys know any standard reports for concurrent employment?
    Waiting

    In the program attributes declare the LDB as PNPCE and look at the sample code.
    REPORT  z_pnpce MESSAGE-ID pn LINE-SIZE 130.
    tables: pernr.
    Nodes : Person, peras.
    INFOTYPES: 0006.
    DATA: BEGIN OF gt_0006 OCCURS 0,
           pernr LIKE pernr-pernr,
           stras LIKE p0006-stras,
           ort01 LIKE p0006-ort01,
           ort02 LIKE p0006-ort02,
           pstlz LIKE p0006-pstlz,
          END OF gt_0006.
    START-OF-SELECTION.
    GET person.
    GET peras.
      rp_provide_from_last p0006 '1' pn-begda pn-endda.
      gt_0006-pernr = p0006-pernr.
      gt_0006-stras = p0006-stras.
      gt_0006-ort01 = p0006-ort01.
      gt_0006-ort02 = p0006-ort02.
      gt_0006-pstlz = p0006-pstlz.
      APPEND gt_0006.
      CLEAR  gt_0006.
    END-OF-SELECTION.
      LOOP AT gt_0006.
        WRITE:/ gt_0006-pernr,
                gt_0006-stras,
                gt_0006-ort01,
                gt_0006-ort02,
                gt_0006-pstlz.
      ENDLOOP.
    Good luck.
    Venu

  • LDBS IN HR ABAP

    Hi All,
    why we are using LDB'S  in HR ABAP PRG..
    and use of END-OF-SELECTION.
    reply soon plz.........
    regards,
    vijay.

    It is a matter of choice.. using LDB will give you the option of  in-built Authn Checks & a host Std Selection screens.. you can also easily buil;d a custom sele screen too.
    the END-OF-SELECTION is similar to an ENDSELECT.. it closes the GET PERNR loop.. ie The Infotype records of each person are available between the GET PERNR & END-OF-SELECTION statements.
    ~Suresh

  • LDB sample program (Hr abap)

    Hi,
      iam learning HR Abap i want to write a program in ldb's..for example i want to fetch the following
    data P0001-WERKS,P0105-USRID,P0002-CNAME,P0000-STAT2,PA0001-PERNR into one internal table
    in ldb PNP.how to write the code.please send me the sample coding..
    Thx..

    Hi Swetha Rishi,
    TABLES : PERNR.
    * Infpotypes Declartion
    INFOTYPES : 0000,0001,0002,0105.
    * Structure Declartion
    TYPES : BEGIN OF TY_ITAB,
              PERNR TYPE P0001-PERNR ,
              WERKS TYPE P0001-WERKS ,
              CNAME TYPE P0002-CNAME ,
              STAT2 TYPE P0000-STAT2 ,
              USRID TYPE P0105-USRID ,
             END OF TY_ITAB.
    DATA : ITAB TYPE TABLE OF TY_ITAB,
           WA TYPE TY_ITAB .
    START-OF-SELECTION.
    GET PERNR.
    * macro definition
    RP-PROVIDE-FROM-LAST P0001 SPACE PN-BEGDA PN-ENDDA.
    RP-PROVIDE-FROM-LAST P0002 SPACE PN-BEGDA PN-ENDDA.
    RP-PROVIDE-FROM-LAST P0105 SPACE PN-BEGDA PN-ENDDA.
    RP-PROVIDE-FROM-LAST P0000 SPACE PN-BEGDA PN-ENDDA.
    MOVE-CORRESPONDING P0001 TO WA.
    MOVE-CORRESPONDING P0002 TO WA.
    MOVE-CORRESPONDING P0105 TO WA.
    MOVE-CORRESPONDING P0000 TO WA.
    APPEND WA TO ITAB.
    CLEAR WA.
    END-OF-SELECTION.
    SORT ITAB BY PERNR.
    PERFORM TOP-OF-PAGE.
    LOOP AT ITAB INTO WA.
       SHIFT WA-PERNR LEFT DELETING LEADING '0'.
       WRITE : /5 WA-PERNR,
                16 WA-WERKS,
                25 WA-CNAME,
                35 WA-STAT2,
                45 WA-USRID.
    ENDLOOP.
    *&      Form  TOP-OF-PAGE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM TOP-OF-PAGE .
       FORMAT COLOR COL_HEADING ON.
       WRITE : /5 'PERNR',
                16 'WERKS',
                25 'CNAME',
                35 'STAT2',
                45 'USRID'.
       FORMAT COLOR OFF.
    ENDFORM.                    " TOP-OF-PAGE

  • ABAP HR  LDB

    Hi Friends,
    I am supposed to develop an ABAP-HR report using WebDynpro ABAP concepts.
    Has anyone of you worked with such requirement.
    I want to know how to use features of LDBs (selection-screens,authorization checks, macros) with WebDynpro ABAP.
    thanks in advance,
    Nilesh

    Hi Nilesh,
    LDB has a various advantages over noraml reporting.
    1. Selection screen: It gives standard selection screen, no need of creating the screen in program.
    For HR you can use PNP or PNPCE LDB. PNP has two screens 000- normal master data processing, 900- for payroll processing. You can change the screen according to u also. Go to report attribute assign PNP as LDB then press enter you ll see report catagory. There we change the screen.
    2. Data retirval. PNP helps in easy data retrival from all the PA and OM infotypes. You can check below exampls.
    EX.1
    TABLES: PERNR
    INFOTYPES: 0000, 0001, 0002.
    GET PERNR.
    LOOP AT P0002 WHERE ENDDA GE PN-ENDDA
                             AND      BEGDA LE PN-ENDDA.
    WRITE....(UR CODE)
    ENDLOOP.
    EX 2.
    TABLES: PERNR
    INFOTYPES: 0000, 0001, 0002.
    GET PERNR.
    PROVIDE * FROM P0002
    BETWEEN PN-BEGDA AND PN-ENDDA.
    WRITE....(UR CODE)
    ENDPROVIDE.
    EX 3. Use of Macro
    TABLES: PERNR
    INFOTYPES: 0000, 0001, 0002.
    GET PERNR.
    RP-PROVIDE-FROM-LAST 0000 SPACE PN-BEGDA PN-ENDDA.
    Gives the last record from infotype 0000.
    RP-PROVIDE-FROM-FRST 0000 SPACE PN-BEGDA PN-ENDDA.
    Gives the first record from infotype 0000.
    IF PNP-SW-FOUND = '1'. Like sy-subrc check
    ENDIF.
    3. PNP does the default authorization checks according to the structural  authorization.
    You can use PNPCE LDB for concurrant employement.
    For more details refer HR350
    Br/Manas

  • Coding ABAP using LDB PNP and authorizations problems

    This post requires a blend of ABAP and HCM skills.
    When coding my own ABAP using LDB PNP, the LDB will provide me with the employees selected but will skip those for which I do not have access (regarding Authorizations settings) to one or more of the infotypes declared in the program.
    As a programmer I would like to receive from the LDB the information that an employee is skipped so that I can handle the exception.
    Do you know how can I get this information from the LDB?
    Thanks

    I dont know if PNP can do it but PNPCE can:
    at END-OF-SELECTION call macro PNP_GET_AUTH_SKIPPED_PERNRS
    it will provide a list of skiped PERNRs
    for further info see docu PNPCE

  • ABAP Query Using LDB

    Hello Frn's
    I need to develop a abap Query using LDB , for this a Infoset is allready created , which uses PNPCE LDB .
    Below i am Descrbing the scenerio , for which we need to develop the query ....
    Dept/Div Transfer
    Employees who transferred dept or division within specified date range:
    EmpID
    Last Name, First Name
    Date of transfer
    New department
    New division
    Current supervisor
    Old department
    Old division
    How can i fitler out the data of our requirment ... because i want to use same infoset in diffrent query .
    Please provide some solution
    Thanks and Regards..
    Priyank Dixit

    Hi Priyank,
    First you need to check whether all the required fields are available there in the LDB PNPCE(I guess you are using the same).
    I think old department, old division must not be available there. Then you need to add it in your Infoset and write custom code for these fields. Once you are done with custom coding, you can use this infoset for creating queries.
    Use trnx SQ02 to create queries, either SAP or Infoset.
    Hope it helps. Let me know if you need some more help.
    Raveesh

Maybe you are looking for

  • Plz help me solving following issues

    Hi SD experts, Plz help me solving following issues 1) What do you mean by POD(proof of delivery) what is the use of pod? What are the con figuration you done in your project? 2) When I am punching order after entering data like material No and quant

  • Report Object in Forms 6i

    Hi all, Can anybody please enlighten me about the Report object in the object navigator of Forms 6i. Why that object is present and in what way we can use it effectively. Thanks in advance Krishna

  • Executing Report in Background

    Dear All, I have a report with more than 400 characters in width. If it is executed in foreground the report is properly displayed but if the report is executed in background, the generated spool only displays upto 255 characters. Is there a way to e

  • Advantages of 'HR_INFOTYPE_OPERATION' Function Module In ABAP-HR

    HI Experts, What are the Advantages of 'HR_INFOTYPE_OPERATION' Function Module In ABAP-HR rather than BDC Both methods? Thanks in Advance. Naveen

  • Search by category, release 2

    Search by category in the custom and advanced search portlets doesn't give correct results. When searching for items in category 'A', the search results page shows files that are in category 'General' as well. How can we solve or work arround this?