‎2010 Mar 10 1:06 PM
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..
‎2010 Mar 10 1:14 PM
Swetha,
Welcome to SCN!!!!!!!
Search SCN forum you will find the similar threads...
‎2010 Mar 10 1:17 PM
Hi
Refer to these 2 programs:
DEMO_SELECTION_SCREEN_LDB_1 and DEMO_SELECTION_SCREEN_LDB_2.
Regards
Raj
‎2010 Mar 10 1:20 PM
Hi,
declare PNP in the attributes of the program.
report .....
tables : pernr.
infotypes : 0105,0002,0000,0001.
*declare your internal table with all the fields you require.
start-of-selection.
get pernr.
rp-provide-from-last p0001 space pn-begda pn-endda.
if pnp-sw-found = 1.
<internal table>-field1 = P0001-PERNR.
similarly fill other fields from PA0001.
endif.
rp-provide-from-last p0105 space pn-begda pn-endda.
if pnp-sw-found = 1.
<internal table>-field3 = P0105-USRID.
endif.
rp-provide-from-last p0002 space pn-begda pn-endda.
if pnp-sw-found = 1.
*fill P0002-CNAME,P0000-STAT2 to respective fields of internal table
endif.
end-of-selection.
loop at <internal table> into wa.
*write fields ....
endloop.
Regards,
Srini.
‎2010 Mar 10 1:32 PM
‎2010 Mar 10 2:12 PM
Hi srini,
i hav done the coding as u told.but my data is not coming into internal table the data is showing for the field werks and pernr..
please help me out..
Thx.
‎2010 Mar 10 2:25 PM
Hi,
write append statement ...
start-of-selection.
get pernr.
rp-provide-from-last p0001 space pn-begda pn-endda.
if pnp-sw-found = 1.
it_str-pernr = p0001-pernr.
it_str-werks = p0001-werks.
endif.
rp-provide-from-last p0105 space pn-begda pn-endda.
if pnp-sw-found = 1.
it_str-pernr = p0105-usrid.
it_str-usrid = P0105-USRID.
endif.
rp-provide-from-last p0002 space pn-begda pn-endda.
if pnp-sw-found = 1.
*it_str-pernr = p0002-pernr.
it_str-cname = p0002-cname.
endif.
rp-provide-from-last p0000 space pn-begda pn-endda.
if pnp-sw-found = 1.
it_str-pernr = p0002-pernr.
it_str-stat2 = p0000-stat2.
endif.
append it_str.
Regards,
Srini.
‎2010 Mar 10 2:01 PM
Read some documentation like
- pdf : [Report Programming in HR|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAXX/PYINT_PROGRAMM.pdf]
- html : [Report Programming in HR|http://help.sap.com/saphelp_47x200/helpdata/en/4f/d5275f575e11d189270000e8322f96/frameset.htm] or [Programming Utilities for the Logical Databases PNP and PAP|http://help.sap.com/saphelp_47x200/helpdata/en/60/d8bad2576311d189270000e8322f96/frameset.htm]
Regards,
Raymond
‎2010 Mar 29 1:08 PM
Dear Swetha,
Just follow the same code document depicting a simple scenario of reading information posted by me on the other website. Follow
[Sample ABAP HR Report using LDB "PNP"|http://gauravpatwari.files.wordpress.com/2009/09/report-ymhcrobjonloan.pdf]
And go ahead with the one required by you. And to compare your requirement with this report just check with Infotype statement and the Infotypes you need.
<h5>Regards,
[Gaurav Patwari|http://gauravpatwari.wordpress.com]</h5>
‎2013 Jun 06 8:20 AM
‎2014 Sep 03 8:00 AM
Hi Former Member,
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