‎2007 Apr 04 10:59 PM
The req is that records from one infotype need to be populated, then records from another infotype need to be populated into the same internal table based on the records retrieved from the first infotype. The second infotype has some subtypes also that need to be selected. Can someone suggest a solution with an example?
‎2007 Apr 04 11:03 PM
You can read infotypes like reading standard tables...like PA0001 or PA0003.
You can also use <b>HR_READ_INFOTYPE</b> FM.
Greetings,
Blag.
‎2007 Apr 04 11:03 PM
You can read infotypes like reading standard tables...like PA0001 or PA0003.
You can also use <b>HR_READ_INFOTYPE</b> FM.
Greetings,
Blag.
‎2007 Apr 04 11:26 PM
Hello Sandeep
Have a look at my Code snippet where I have described a
<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/UnifiedAccesstoAllHR+Infotypes">Unified Access to All HR Infotypes</a>
Regards
Uwe
‎2007 Apr 04 11:41 PM
hey uwe,
thanx for ur response, but could you please give me an example using select statements? also for info types with sub types.
Thank you
‎2007 Apr 04 11:46 PM
yeah the thing is.. i have an internal table and i populated some fields taking values from IT 0002. now for all the values that i took from 0002 i have to populate the corresponding values(ie for all the pernr s) from another infotype 0105. how do u go about doing this. some fields that i need to populate from 0105 have subtypes too.
‎2007 Apr 05 12:21 AM
Do something like this...
SELECT ENDDA BEGDA BUKRS WERKS
INTO TABLE T_PA002_0105
FROM ( PA002 INNER JOIN PA0105
ON PA002~PERNR EQ PA0105~PERNR )
WHERE PERNR EQ P_PERNR.
Greetings,
Blag.
‎2007 Apr 05 4:34 AM
Hi Sandeep,
Programming in HR module is something different, the best is that you use the logical database PNP. Set this value in the Program attribute. Using select statement in HR programming is not advicable. Proper HR programming should be as below:
REPORT yhr_program
NO STANDARD PAGE HEADING
LINE-COUNT 60 LINE-SIZE 600.
*----------------------------------------------------------------------*
* tables
*----------------------------------------------------------------------*
TABLES: pernr.
*----------------------------------------------------------------------*
* infotypes.
*----------------------------------------------------------------------*
INFOTYPES: 0000, "Personal Actions
0001, "Org. Assignment
0002, "Personal Data
0105. "Communication Infotype
*----------------------------------------------------------------------*
* data declaration.
*----------------------------------------------------------------------*
Data: Begin of I_TAB occurs 0,
PERNR type persno, "employee number
NACHN type PAD_NACHN, "employee's last name
USRID_LONG type COMM_ID_LONG, "IT0105 user id
end of I_TAB.
*-----------------------------------------------------------------------
* START-OF-SELECTION.
*-----------------------------------------------------------------------
START-OF-SELECTION.
*-----------------------------------------------------------------------
* GET FROM LOGICAL DB PNP
*-----------------------------------------------------------------------
GET pernr.
* rp-provide-from-last is an macro used in HR programming can be found in
* table trmac.
*
* p0002 is the infotype structure
* space is for subtype <-- in this case there is no subtype
* pn-begda is for begin date
* pn-endda is for end date
* getting employee infty 0002 record
rp-provide-from-last p0002 space pn-begda pn-endda.
* p0105 is the infotype structure
* '0001' is for IT0105 subtype for communication
* pn-begda is for begin date
* pn-endda is for end date
* getting employee infty 0105 record
rp-provide-from-last p0105 '0001' pn-begda pn-endda.
i_tab-pernr = pernr-pernr.
i_tab-nachn = p0002-nachn.
i_tab-USRID_LONG = p0105-USRID_LONG.
append i_tab. clear i_tab.
*----------------------------------------------------------------------*
* END-OF-SELECTION
*----------------------------------------------------------------------*
END-OF-SELECTION.
perform print_report.
...... more codes....
Hope it helps.
Benefits:
1) You have all the auth issue settled.
2) Macros shorthen your code
‎2008 Jul 18 10:38 PM