cancel
Showing results for 
Search instead for 
Did you mean: 

Logical Database ???

Former Member
0 Kudos

wat are logical database? How can i use them?

when do we use Logical database PNP.

Get PERNR.

when are we suppose to use them?

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi

Normally the most important logical datebase r PNP PAP PCH

pnp consists of ( time payroll and pa)

pap consiste of ( Recruitment)

pch consists of (TEM PD and OM)

all the data as per the related module witll be stored in their respective databases mostly it so usefull and helpfull for adhoc reports

Date which containg certain information know as logical data base in hr

Hope u Understand

rgds..........rajeshk

Former Member
0 Kudos

hi,

Get statement is the event in the abap program,

similarly the put statement,

put statement(contains select queries for database) is the event that is written the LDB program in Se36(DATABASE PROGRAM), for PNP. its a predefined one in SAP for HR.

When u r calling GET st event in the report program.

the data from the database is selected and placed in the buffer, which is linked to the Abap program.

u can use the ex program for this.

PNP will provide all the records related to the HR master data(infotypes PA)

with regards,

venkatesh.

Former Member
0 Kudos

hi balaji,

give the LDB name as PNP, in the attributes,

copy this code,

and execute this.

sample program,

&----


*& Report ZLDB_DUMMY

*&

&----


*&

*&

&----


REPORT ZLDB_DUMMY no standard page heading line-size 200.

Tables : PERNR.

Infotypes : 0000 , "Actions

0001 , "Organizational assignment

0002 , "Personnel data

0006 , "Address

0008 , "Basic Pay

0009. "Bank Details

Format color 4 .

uline.

write: 'Report for Employee master data in HR'.

format color off .

uline.

format color 1 .

write:/' Prsnl No Employee name PA ',

' EmpSt Gen Ntnlty City ',

' Annual salary Bank Account number' .

write:/.

uline.

format color off.

format color 6.

start-of-selection.

get pernr. "here the LDB data is read one by one

format color 7.

write:/ sy-vline, p0001-pernr.format color off.format color 2.write: sy-vline, "Personnel number

p0001-SNAME.format color off.format color 3.write: sy-vline, "Employee name

p0001-WERKS.format color off.format color 4.write: sy-vline, "Personnel Area

p0000-STAT2.format color off.format color 5.write: sy-vline, "Employment Status

p0002-GESCH.format color off.format color 6.write: sy-vline, "Gender

p0002-NATIO.format color off.format color 7.write: sy-vline, "Nationality

p0006-ORT01.format color off.format color 2.write: sy-vline, "City

p0008-ANSAL.format color off.format color 3.write: sy-vline, "Annual salary

p0009-BANKN.format color off.format color 4.write: sy-vline. "Bank Account number

uline.

end-of-selection.

format color off.

reward points,

Former Member
0 Kudos

to my undersatnding as of now........

LDB PNP wil select data from all HR infotype table (PA****).

But where do we mention the selection criteria?

the condition under which the data has to be filtered and selected?

Former Member
0 Kudos

You can get the specific records that you need by using rp-provide statements like this:

rp-provide-from-last p0000 space low-date high-date.

This will bring you the most recent record for infotype 0000 that is valid between low-date and high-date. In this example "space" is used where you would specify a subtype because there aren't subtypes for infotype 0000.

- April King

Former Member
0 Kudos

The logical data base creates a Selection Screen for you. It contains fields such as PERNR, Employment Status (P0000-STAT2), PERSONNEL AREA, PERSONNEL SUBAREA, BUSINESS AREA, etc. If you enter values in these fields the LDB program will use them along with your date range to filter the data sent to your program. I think most of the Selection Fields deal with IT0000 and IT0001. You may still have to further filter data in your program.

Former Member
0 Kudos

Hi,

You can use open SQL statement also instead of LDB in HR for reports.

But using LDB, we get more benefits

when we talk about LDB,

database(se11)

LDB is the separate program

which linked to the se38 Report program when we call.

THESE 3 R SEPARATE THINGS

WHEN WE WRITE REPORT CODE USING LDB, DURING EXECUTION OF THE PROGRAM IT FIRST FETCHES THE RECORDS FROM THE DATABASE(USING LDB), AND LINKS TO ABAP PROGARM. THESE IS THE PROCESS.

TRANSACTION CODE IS SLDN. TO BUILD UR SELF DEFINED LDB.

1. Bulild in Standarad selection screen

2. Automatic Data retrieval by just declaring infotypes

3. Automatic Authorization check which is very imop in HR.

PNP(PERSONNEL ADMINISTRATION)

PCH(PERSONNEL DEVELOPEMNT)

PNPCE(FOR CONCURRENT EMPLOYMENT)

PAP(APPLICANTS)

LDB - is a SET of programs which provide u its own selection screen and commands to deal with HR data.

Hence for HR u can prefer LDB instead of SQL..

u can acheive the same thing via SQL but LDB is more easier as u need not write much code.

u have to specify in the attributes of the program ,LDb name..

like PNP,PCH etc..

check this link.

http://help.sap.com/saphelp_erp2004/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm

Also check this link for programmming in LDB in HR

http://help.sap.com/saphelp_erp2004/helpdata/en/4f/d5275f575e11d189270000e83

22f96/frameset.htm

here is a sample program using LDB -

REPORT ZPPL_PREVEMPLOYERS message-id rp

line-size 250

line-count 65.

*Program logic :- This Report is used to Download all the Previous

  • Employer (IT0023) records of the employees

  • **********************************************************************

*eject

&----


*& Tables and Infotypes *

*& *

&----


tables: pernr.

infotypes: 0000,

0001,

0002,

0023.

*eject

&----


*& Constants *

*& *

&----


constants: c_1(1) type c value '1' ,

c_3(1) type c value '3' ,

c_i(1) type c value 'I' ,

c_x(1) type c value 'X' ,

c_eq(2) type c value 'EQ' ,

c_pl03 like p0001-werks value 'PL03'.

*eject

&----


*& Selection-Screen *

*& *

&----


parameters: p_file like rlgrap-filename default 'C:\Temp\ABC.xls',

p_test as checkbox default c_x .

*eject

&----


*& Internal tables *

*& *

&----


  • Internal Table for Output

data: begin of t_output occurs 0 ,

pernr like pernr-pernr ,

nachn like p0002-nachn ,

vorna like p0002-vorna ,

orgeh_stext like p1000-stext ,

plans_stext like p1000-stext ,

begda like p0023-begda ,

endda like p0023-endda ,

land1 like p0023-land1 ,

arbgb like p0023-arbgb ,

ort01 like p0023-ort01 .

data: end of t_output .

*eject

&----


*& Variables *

*& *

&----


data: o_stext like p1000-stext,

p_stext like p1000-stext.

*eject

&----


*& Initialization *

*& *

&----


Initialization.

  • Initialize Selection-Screen values

perform init_selction_screen.

*eject

&----


*& AT Selection-screen *

*& *

&----


at selection-screen .

  • Check if Test run selected, download file name should be entered

if p_test is initial. "

if p_file is initial.

message e016 with 'Please enter file name'

'specifying complete path'.

endif.

endif.

*eject

&----


*& Start-of Selection *

*& *

&----


Start-of-selection.

get pernr.

clear t_output.

  • Read Infotype 0

rp-provide-from-last p0000 space pn-begda pn-endda.

check pnp-sw-found eq c_1.

  • Check if employee is active

check p0000-stat2 in pnpstat2. "pernr Active

  • Read Infotype 1

rp-provide-from-last p0001 space pn-begda pn-endda.

check pnp-sw-found eq c_1.

  • check if employee belongs to PL03

check p0001-werks in pnpwerks. "belongs to PL03

  • Check if emp belongs to Active Group

check p0001-persg in pnppersg.

  • Read Infotype 2

rp-provide-from-last p0002 space pn-begda pn-endda.

check pnp-sw-found eq c_1.

  • Read Org Unit Text.

CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'

EXPORTING

OTYPE = 'O'

objid = p0001-orgeh

begda = p0001-begda

endda = p0001-endda

reference_date = p0001-begda

IMPORTING

object_text = o_stext

EXCEPTIONS

nothing_found = 1

wrong_objecttype = 2

missing_costcenter_data = 3

missing_object_id = 4

OTHERS = 5.

*Read Position Text.

CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'

EXPORTING

OTYPE = 'S'

objid = p0001-plans

begda = p0001-begda

endda = p0001-endda

reference_date = p0001-begda

IMPORTING

object_text = p_stext

EXCEPTIONS

nothing_found = 1

wrong_objecttype = 2

missing_costcenter_data = 3

missing_object_id = 4

OTHERS = 5.

  • Gather all the required information related to the emp

move: pernr-pernr to t_output-pernr,

o_stext to t_output-orgeh_stext,

p_stext to t_output-plans_stext,

p0002-nachn to t_output-nachn,

p0002-vorna to t_output-vorna.

  • Gather previous Employee details

loop at p0023.

move-corresponding p0023 to t_output.

append t_output.

endloop.

*eject

&----


*& End-of Selection *

*& *

&----


end-of-selection.

perform print_report.

  • Downlaod the file

if not t_output[] is initial.

if p_test eq space.

perform download_file.

endif.

else.

write: 'No records selected' color col_negative.

endif.

*eject

&----


*& Top-of-page *

*& *

&----


Top-of-page.

  • Print Header

perform print_header.

*eject

&----


*& Form download_file

&----


  • Description :

----


FORM download_file .

DATA: full_file_name TYPE string,

z_akt_filesize TYPE i .

full_file_name = p_file.

  • download table into file on presentation server

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

filename = full_file_name

filetype = 'DAT'

NO_AUTH_CHECK = c_x

codepage = '1160'

IMPORTING

FILELENGTH = z_akt_filesize

CHANGING

data_tab = t_output[]

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

not_supported_by_gui = 22

error_no_gui = 23

OTHERS = 24.

*

IF sy-subrc NE 0.

MESSAGE e016 WITH 'Download-Error; RC:' sy-subrc.

ENDIF.

ENDFORM. " download_file

*eject

&----


*& Form print_report

&----


*Description:

----


FORM print_report .

data: i type i,

w_count type i.

sort t_output.

  • Print the report

loop at t_output.

i = sy-tabix mod 2.

if i eq 0.

format color col_normal intensified on.

else.

format color col_normal intensified off.

endif.

write:/1 t_output-pernr ,

10 t_output-vorna(25) ,

35 t_output-nachn(25) ,

61 t_output-orgeh_stext ,

102 t_output-plans_stext ,

143 t_output-begda ,

154 t_output-endda ,

168 t_output-land1 ,

178 t_output-arbgb(40) ,

219 t_output-ort01 ,

249 space .

endloop.

uline.

Describe table t_output lines w_count.

Skip 2.

Write:/ 'Total No of Records Downloaded: ' color col_total,

w_count.

ENDFORM. " print_report

*eject

&----


*& Form print_header

&----


*Description:

----


FORM print_header .

skip 1.

Uline.

format Intensified on color col_heading.

write:/1 'Pers. #' ,

10 'Last Name' ,

35 'First Name' ,

61 'Org Unit' ,

102 'Position' ,

143 'Beg Date' ,

154 'End Date' ,

168 'Cntry Key' ,

178 'Prev Employer' ,

219 'City' ,

249 space .

format intensified off color off.

uline.

ENDFORM. " print_header

*eject

&----


*& Form init_selction_screen

&----


*Description:

----


FORM init_selction_screen .

refresh: pnpwerks,

pnppersg,

pnpstat2.

clear: pnpwerks,

pnppersg,

pnpstat2.

pnpwerks-sign = c_i.

pnpwerks-option = c_EQ.

pnpwerks-low = c_pl03.

append pnpwerks.

pnppersg-sign = c_i.

pnppersg-option = c_EQ.

pnppersg-low = c_1.

append pnppersg.

pnpstat2-sign = c_i.

pnpstat2-option = c_EQ.

pnpstat2-low = c_3.

append pnpstat2.

ENDFORM. " init_selction_screen

USAGE::::::::::

ALL THE STANDARD REPORT PROGRAMS IN hr ARE COMPOSED OF LDB'S

IF WANT SOME CUSTOMIZED REPORTS, WE USE LDB.

ALL THE NECESSARY TABLES AND FIELDS ARE PREDEFINED.

WE CAN USE EASILY IN ABAP PROGRAMS:(REPORT PROGRAMS)

GOTO SE38,

GIVE NAME OF THE PROGRAM,

SPECIFY IN THE ATTRIBUTES(LDB AS PNP)

ENTER THE CODE.

COMPILE IT

EXECUTE IT.

I HAVE GIVEN ATMOST INFORMATION ABOUT LDB,

GIVE POINTS.

with regards,

venkatesh

Former Member
0 Kudos

Please see this thread:

- April King

Former Member
0 Kudos

i hav to select data from the following tables in HR,

PA0001

PA0002

PA0006

PA0041

PA0000

T530T

Q0002

T513S

T527X

Can i use the LDB PNP? If so, how to use it?

Former Member
0 Kudos

hai

logical data bases store data as you know

they are

PAP---> it stores applicant master data

PNP---> it stores HR master data

PCH----> it storespersonnel planning data

PTRVP---> travel data

these are mainly HR logical databases.

yes you can retrive pernr from logical data base PNP.

IN SHORT VARIOUS TABLES ARE LOGICALLY LINKED

regards

nalla

Former Member
0 Kudos

Hi,

Check this link:

http://help.sap.com/saphelp_46c/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm

Hope this helps,

Reward points if helpful,

Thank You,