Saturday, March 29, 2014

We use logical database(s) for most of the SAP HR Programs. Available ldb are PNP/PNPCE. PCH, PAP. Find the features of LDB here.

How To Create SAP ABAP HR Reports Using A Logical Database (LDB).

Step 1: Create an executable program.

  • Go to SE38 transaction code.
  • Create program ZTEST_LDB_PRORGRAM. (1) Provide meaningful report Title (2) select Type as Executable Program (3) provide Logical Database as PNP and SAVE. Save as local / transportable.

Step 2: Assign the Report category. 

  • Report Category specify which master data fields to be displayed on selection-screen. When you assign logical database PNP to the program,  default report category is assigned. The selection-screen of the default report category. 
  • Creation of the new Report Category
  • Steps to change default Report category to other category.




Step 3: ABAP Source code in the LDB program: 

  • Simple ABAP program with pnp logical database.
    REPORT ztest_ldb_program.
    
    NODES: pernr.
    
    INFOTYPES:
          0001,0002,0006.
    
    START-OF-SELECTION.
    
    GET pernr.
    
      rp-provide-from-last p0002 space pn-begda pn-endda.
      IF pnp-sw-found = '1'.
        WRITE: p0002-pernr, p0002-vorna, p0002-nachn.
      ENDIF.
    
    END-OF-SELECTION.
    
  • NODES pernr:  We have to know about NODES statement. NODES statement is to pass data from logical databases to executable programs. Basically it defines an interface work area(In this case PERNR is workarea) and is allowed only in the global declaration section of executable programs that are associated with a logical database.
  • PERNR structure at SE11* .
  • INFOTYPES statement: It is used to define an internal table for HR Infotypes. When you define INFOTYPES 0001, An internal table P0001 is created with the structure of the info type P0001 and a header.

  • Standard LDB Selection Screen: When you use logical database selection screen, ldb PNP program filters employees based on selection input. 
  • When you use custom Selection fields along with logical database selection, filtering needs to be taken in our custom program .
  • GET pernr event: This event has to be used when program is associated with logical data base. When you run the program, When GET pernr event is triggered,  the interface workarea(PERNR) defined with NODES statement is populated and also all the tables defined using INFOTYPES statement also populated with data for one employee. One employee information is available until END-OF-SELECTION event. GET pernr event is triggered for each employee selected based on the selection screen input. 
  • Macro are used in HR LDB programs. All macro definitions are found in Include DBPNPMAC. RP-PROVIDE-FROM-LAST macro is used to get latest record in the given period(PN-BEGDA and PN-ENNDA). Find all useful Macros in HR ABAP.

Step 4. Activate and Test the program

  • Selection Screen data
  • Output

1 comment:

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.