Skip to Content
avatar image
Former Member

abap hr

Can anyone plz explain me how we can retrieve the data using a logical database with simple example.............Points will be rewarded.Plz give me exact flow

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Aug 21, 2007 at 10:56 AM

    Hi Manjula,

    below is the sample program

    you have to give <b>logical database name in the program attributes</b>.

    Example give PNP as logical database.

    REPORT zkk_test.

    • tables statement is must

    tables: pernr.

    • Program will create internal tables as p0000, p0001 and p0002

    *for the below infotypes. So you need not declare internal tables.

    infotypes: 0000, 0001, 0002.

    start-of-selection.

    • get event is must

    get pernr.

    loop at p0000.

    • do what ever you want

    endloop.

    loop at p0001.

    • do what ever you want

    endloop.

    loop at p0002.

    • do what ever you want

    endloop.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Manjula,

      If we use logical data base,

      1) we need not to do authority checks

      2) we need not design selection-screens.

      3) we need not declare internal tables for the infotypes.

      4) we can avoid writing select statements because GET event will do all.

  • Aug 21, 2007 at 10:57 AM

    Hi,

    PNP is the logical database used for the HR programs.

    For example check the program RPCJUDI0.

    Goto Se36, enter PNP there and use the Where-used-list to get all the programs using this logical database.

    Regards,

    Sesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:50 AM

    HR deals with the INFOTYPES which are similar to Tables in General ABAP.

    There are different ways of fetching data from these infotypes.

    There are different areas in HR LIKE Personal Admn, Orgn Management, Benefits, Time amangement, Event Management, Payroll etc

    Infotypes for these areas are different from one another area.

    storing of records data in each type of area is different

    LDBS like PNP are used in HR programing.

    Instead of Select.. we use some ROUTINES and PROVIDE..ENDPROVIDE.. etc

    and in the case of Pay roll we use Clusters and we Import and Export them for data fetching.

    On the whole Normal ABAP is different from HR abap.

    For Personal Admn the Infotypes start with PA0000 to PA1999

    Time Related Infotypes start with PA2000 to PA2999.

    Orgn related Infotypes start with HRP1000 to HRP1999.

    All custom developed infotypes stsrat with PA9000 onwards.

    In payroll processing we use Clusters like PCL1,2,3 and 4.

    Instead of Select query we use PROVIDE and ENDPROVIDE..

    You have to assign a Logical Database in the attributes PNP.

    Go through the SAp doc for HR programming and start doing.

    http://www.sapdevelopment.co.uk/hr/hrhome.htm

    See:

    http://help.sap.com/saphelp_46c/helpdata/en/4f/d5268a575e11d189270000e8322f96/content.htm

    sites regarding hr-abap:

    http://www.sapdevelopment.co.uk/hr/hrhome.htm

    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf

    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPD/PAPD.pdf

    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYINT/PYINT_BASICS.pdf

    http://www.atomhr.com/training/Technical_Topics_in_HR.htm

    http://www.planetsap.com/hr_abap_main_page.htm

    You can see some Standard Program examples in this one ...

    http://www.sapdevelopment.co.uk/programs/programshr.htm

    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?Offer=SAlgwn12604#Certification

    http://www.erpgenie.com/faq/hr.htm.

    http://www.planetsap.com/hr_abap_main_page.htm

    http://www.sapbrain.com/TUTORIALS/FUNCTIONAL/HR_tutorial.html

    These are the FAQ's that might helps you as well.

    http://www.sap-img.com/human/hr-faq.htm

    http://www.sapgenie.com/faq/hr.htm

    http://www.planetsap.com/hr_abap_main_page.htm

    http://www.atomhr.com/library_full.htm

    HR Long texts Upload

    Look at the below link

    bdc-hr-maintain-text

    Please refer to the following sample program for accessing PCH LDB.

    For concept to start with refer url:

    http://www.sap-press.de/download/dateien/860/sappress_mysap_hr_technical_principles2.pdf

    It contains info regarding PCH Reporting.

    REPORT zhsol010.

    TABLES: objec, gdstr.

    INFOTYPES: 0002, 0006, 1003.

    DATA: stabs LIKE p1003-stabs,

    name LIKE p0001-ename.

    INITIALIZATION.

    pchotype = 'O'.

    pchwegid = 'O-S-P'.

    GET objec.

    IF objec-otype = 'S'.

    CLEAR stabs.

    LOOP AT p1003 WHERE begda LE pc-endda

    AND endda GE pc-begda.

    IF p1003-stabs = 'X'.

    stabs = 'X'.

    WRITE : / objec-objid, objec-short, objec-stext.

    ENDIF.

    ENDLOOP.

    ENDIF.

    IF objec-otype = 'P' AND stabs = 'X'.

    PROVIDE vorna nachn FROM p0002

    subty telnr FROM p0006

    BETWEEN pc-begda and pc-endda

    WHERE p0006-subty = '1'.

    IF p0006_valid = 'X'.

    CONCATENATE p0002-vorna p0002-nachn INTO name

    SEPARATED BY space.

    WRITE: / name, p0006-telnr.

    SKIP.

    ENDIF.

    ENDPROVIDE.

    ENDIF.

    <b>sample code:</b>

    REPORT zpwtest .

    TABLES : t001 .

    TYPE-POOLS slis .

    DATA : t_t001 TYPE TABLE OF t001 ,

    t_abaplist TYPE TABLE OF abaplist .

    DATA : w_abaplist TYPE abaplist .

    SELECT-OPTIONS : s_bukrs FOR t001-bukrs OBLIGATORY .

    PARAMETERS : p_list TYPE c NO-DISPLAY .

    START-OF-SELECTION .

    IF sy-batch = 'X' AND p_list IS INITIAL .

    • Submit report and get list in memory

    SUBMIT zpwtest EXPORTING LIST TO MEMORY

    WITH s_bukrs IN s_bukrs

    WITH p_list = 'X'

    AND RETURN.

    • Get the list from memory.

    CALL FUNCTION 'LIST_FROM_MEMORY'

    TABLES

    listobject = t_abaplist

    EXCEPTIONS

    not_found = 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.

    • Send report to mail receipent

    PERFORM send_mail .

    ELSE.

    PERFORM select_data .

    PERFORM display_data .

    ENDIF.

    *SO_NEW_DOCUMENT_SEND_API1

    &----


    *& Form select_data

    &----


    FORM select_data.

    SELECT *

    INTO TABLE t_t001

    FROM t001

    WHERE bukrs IN s_bukrs .

    ENDFORM. " select_data

    &----


    *& Form display_data

    &----


    FORM display_data.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    i_structure_name = 'T001'

    TABLES

    t_outtab = t_t001

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    ENDFORM. " display_data

    &----


    *& Form send_mail

    &----


    FORM send_mail.

    DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,

    receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,

    packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,

    listobject LIKE abaplist OCCURS 10,

    compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,

    w_object_hd_change LIKE sood1,

    compressed_size LIKE sy-index.

    • Fot external email id

    • receiver_list-recextnam = 'XXXXXXXXXXXX@XXXXXX.COM'.

    • receiver_list-recesc = 'E'.

    • receiver_list-sndart = 'INT'.

    • receiver_list-sndpri = '1'.

    • FOr internal email id

    receiver_list-recnam = sy-uname .

    receiver_list-esc_des = 'B'.

    APPEND receiver_list.

    • General data

    w_object_hd_change-objla = sy-langu.

    w_object_hd_change-objnam = 'Object name'.

    w_object_hd_change-objsns = 'P'.

    • Mail subject

    w_object_hd_change-objdes = 'Message subject'.

    • Mail body

    APPEND 'Message content' TO message_content.

    CALL FUNCTION 'TABLE_COMPRESS'

    IMPORTING

    compressed_size = compressed_size

    TABLES

    in = t_abaplist

    out = compressed_attachment.

    DESCRIBE TABLE compressed_attachment.

    CLEAR packing_list.

    packing_list-transf_bin = 'X'.

    packing_list-head_start = 0.

    packing_list-head_num = 0.

    packing_list-body_start = 1.

    packing_list-body_num = sy-tfill.

    packing_list-objtp = 'ALI'.

    packing_list-objnam = 'Object name'.

    packing_list-objdes = 'Attachment description'.

    packing_list-objlen = compressed_size.

    APPEND packing_list.

    CALL FUNCTION 'SO_OBJECT_SEND'

    EXPORTING

    object_hd_change = w_object_hd_change

    object_type = 'RAW'

    owner = sy-uname

    TABLES

    objcont = message_content

    receivers = receiver_list

    packing_list = packing_list

    att_cont = compressed_attachment.

    ENDFORM. " send_mail

    regards,

    srinivas

    <b>*reward for useful answers*</b>

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:50 AM

    report zname.

    tables: pernr.

    infotype:0001,0002,0006.

    get pernr.

    provide * from p0001 between pnp-begda and pnp-endda.

    write: pernr-pernr.

    p0001-stell.

    p0001-bedda

    p0001-endda

    endprovide.

    2) processing specific info type records.

    .

    rp_provide_from _last pnnnn p0001 pn-begda and pn-ennda.

    rp_provide_from _last pnnnn p0002 pn-begda and pn-ennda.

    rp_provide_from _last pnnnn p0006 pn-begda and pn-ennda.

    or

    u can use many infotypes in the Report.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:53 AM
    Add comment
    10|10000 characters needed characters exceeded