Retrive data from HR tables
Hi Experts,
How to retrive data from HR tables for custom screen & store in custom table? I need Employee number, employee name, department, their location & mail id. When employee number is given, all other details must be fetched. Can you give a solution for this problem?
Thanks,
Kavitha
Hi Kavitha,
in HR you could get data from different tables based on infotypes. lets say if any data need to get from infotype 0001 (Org assignment), add "PA" before the infotype number so it would be PA0001.
you could get the Employee no, name, department, location(i guess personal area or personal subarea) from PA0001 table and email id from PA105 infotype.
Regards
Raju
Similar Messages
-
Retrive data from 4 tables without using joins
hi ,
i have to retrive data from 4 tables........but i donot want to use joins because of performance issues.
please guide me how to proceed further ?
thankshi manish,
CONSTANTS: c_act_plan(2) TYPE c VALUE 'U1' ,
c_person(1) TYPE c VALUE 'P' ,
p1_betid(8) TYPE c VALUE '50005316',
c_topdown(1) TYPE c VALUE 'A' ,
c_admnby(3) TYPE c VALUE '032' ,
c_bet_type(1) TYPE c VALUE 'Q' ,
c_firmed(1) TYPE c VALUE '1' ,
c_subtyp_mail(4) TYPE c VALUE '0001' .
TYPES: BEGIN OF ty_hrp1001,
objid TYPE hrp1001-objid,
END OF ty_hrp1001,
BEGIN OF ty_pa0001,
pernr TYPE pa0001-pernr,
subty TYPE pa0001-subty,
objps TYPE pa0001-objps,
sprps TYPE pa0001-sprps,
endda TYPE pa0001-endda,
begda TYPE pa0001-begda,
seqnr TYPE pa0001-seqnr,
werks TYPE pa0001-werks,
gsber TYPE pa0001-gsber,
btrtl TYPE pa0001-btrtl,
END OF ty_pa0001,
BEGIN OF ty_t500p,
persa TYPE t500p-persa,
name1 TYPE t500p-name1,
END OF ty_t500p,
BEGIN OF ty_t001p,
werks TYPE t001p-werks,
btrtl TYPE t001p-btrtl,
btext TYPE t001p-btext,
END OF ty_t001p,
BEGIN OF ty_pa0002,
pernr TYPE pa0002-pernr,
subty TYPE pa0002-subty,
objps TYPE pa0002-objps,
sprps TYPE pa0002-sprps,
endda TYPE pa0002-endda,
begda TYPE pa0002-begda,
seqnr TYPE pa0002-seqnr,
nachn TYPE pa0002-nachn,
vorna TYPE pa0002-vorna,
END OF ty_pa0002,
BEGIN OF ty_pa0105,
pernr TYPE pa0105-pernr ,
subty TYPE pa0105-subty ,
objps TYPE pa0105-objps ,
sprps TYPE pa0105-sprps ,
endda TYPE pa0105-endda ,
begda TYPE pa0105-begda ,
seqnr TYPE pa0105-seqnr ,
usrid_long TYPE pa0105-usrid_long,
END OF ty_pa0105,
BEGIN OF ty_output,
pernr TYPE pa0002-pernr ,
werks TYPE pa0001-werks ,
gsber TYPE pa0001-gsber ,
btrtl TYPE pa0001-btrtl ,
name1 TYPE t500p-name1 ,
btext TYPE t001p-btext ,
nachn TYPE pa0002-nachn ,
vorna TYPE pa0002-vorna ,
usrid_long TYPE pa0105-usrid_long,
END OF ty_output.
DATA: w_hrp1001 TYPE ty_hrp1001,
t_hrp1001 TYPE TABLE OF ty_hrp1001,
t_hrp1001_tmp TYPE TABLE OF ty_hrp1001,
w_pa0001 TYPE ty_pa0001 ,
t_pa0001 TYPE SORTED TABLE OF ty_pa0001
WITH NON-UNIQUE KEY pernr ,
t_pa0001_tmp TYPE TABLE OF ty_pa0001 ,
w_t500p TYPE ty_t500p ,
t_t500p TYPE HASHED TABLE OF ty_t500p
WITH UNIQUE KEY persa ,
w_t001p TYPE ty_t001p ,
t_t001p TYPE HASHED TABLE OF ty_t001p
WITH UNIQUE KEY werks btrtl ,
w_pa0002 TYPE ty_pa0002 ,
t_pa0002 TYPE SORTED TABLE OF ty_pa0002
WITH NON-UNIQUE KEY pernr ,
t_pa0002_tmp TYPE TABLE OF ty_pa0002 ,
w_pa0105 TYPE ty_pa0105 ,
t_pa0105 TYPE SORTED TABLE OF ty_pa0105
WITH NON-UNIQUE KEY pernr ,
w_output TYPE ty_output ,
t_output TYPE TABLE OF ty_output .
SELECT objid
FROM hrp1001
INTO TABLE t_hrp1001
WHERE otype EQ c_person
AND plvar EQ c_act_plan
AND rsign EQ c_topdown
AND relat EQ c_admnby
AND istat EQ c_firmed
AND begda LE sy-datum
AND endda GT sy-datum
AND sclas EQ c_bet_type
AND sobid EQ p1_betid.
IF sy-subrc EQ 0.
SORT t_hrp1001 BY objid.
ENDIF.
IF NOT t_hrp1001[] IS INITIAL.
t_hrp1001_tmp[] = t_hrp1001[].
DELETE ADJACENT DUPLICATES FROM t_hrp1001_tmp
COMPARING objid.
SELECT pernr
subty
objps
sprps
endda
begda
seqnr
werks
gsber
btrtl
FROM pa0001
INTO TABLE t_pa0001
FOR ALL ENTRIES IN t_hrp1001_tmp
WHERE pernr EQ t_hrp1001_tmp-objid
AND endda GT sy-datum
AND begda LE sy-datum.
SELECT pernr
subty
objps
sprps
endda
begda
seqnr
nachn
vorna
FROM pa0002
INTO TABLE t_pa0002
FOR ALL ENTRIES IN t_hrp1001_tmp
WHERE pernr EQ t_hrp1001_tmp-objid
AND endda GT sy-datum
AND begda LE sy-datum.
ENDIF.
IF NOT t_pa0001[] IS INITIAL.
t_pa0001_tmp[] = t_pa0001[].
SORT t_pa0001_tmp BY werks btrtl.
DELETE ADJACENT DUPLICATES FROM t_pa0001_tmp COMPARING werks btrtl.
SELECT werks
btrtl
btext
FROM t001p
INTO TABLE t_t001p
FOR ALL ENTRIES IN t_pa0001_tmp
WHERE werks EQ t_pa0001_tmp-werks
AND btrtl EQ t_pa0001_tmp-btrtl.
DELETE ADJACENT DUPLICATES FROM t_pa0001_tmp COMPARING werks.
SELECT persa
name1
FROM t500p
INTO TABLE t_t500p
FOR ALL ENTRIES IN t_pa0001_tmp
WHERE persa EQ t_pa0001_tmp-werks.
ENDIF.
IF NOT t_pa0002[] IS INITIAL.
t_pa0002_tmp[] = t_pa0002[].
DELETE ADJACENT DUPLICATES FROM t_pa0002_tmp COMPARING pernr.
SELECT pernr
subty
objps
sprps
endda
begda
seqnr
usrid_long
FROM pa0105
INTO TABLE t_pa0105
FOR ALL ENTRIES IN t_pa0002_tmp
WHERE pernr EQ t_pa0002_tmp-pernr
AND subty EQ c_subtyp_mail
AND endda GT sy-datum
AND begda LE sy-datum
AND usrty EQ c_subtyp_mail.
ENDIF.
REFRESH t_output.
LOOP AT t_hrp1001 INTO w_hrp1001.
LOOP AT t_pa0001 INTO w_pa0001
WHERE pernr EQ w_hrp1001-objid.
READ TABLE t_t500p INTO w_t500p WITH KEY persa = w_pa0001-werks
TRANSPORTING
name1.
CHECK sy-subrc EQ 0.
READ TABLE t_t001p INTO w_t001p WITH KEY werks = w_pa0001-werks
btrtl = w_pa0001-btrtl
TRANSPORTING
btext.
LOOP AT t_pa0002 INTO w_pa0002
WHERE pernr EQ w_hrp1001-objid.
LOOP AT t_pa0105 INTO w_pa0105
WHERE pernr EQ w_pa0002-pernr.
w_output-pernr = w_pa0002-pernr .
w_output-werks = w_pa0001-werks .
w_output-gsber = w_pa0001-gsber .
w_output-btrtl = w_pa0001-btrtl .
w_output-name1 = w_t500p-name1 .
w_output-btext = w_t001p-btext .
w_output-nachn = w_pa0002-nachn .
w_output-vorna = w_pa0002-vorna .
w_output-usrid_long = w_pa0105-usrid_long.
APPEND w_output TO t_output.
CLEAR w_output.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDLOOP.
Reward if usful,
Thanks,
Srikanth.A -
Retrive data from two tables into one internal table.
Hi SDN,
I am downloading the Assets data from two tables ANLA,ANLZ.
there is a common field ANL1in both tables and i have to retrive the data by using anl1 into the internal table.
can you please send me the SELECT Syntax for this probl.....
Thank you & Regards,
ManojHi manoj,
Please see the following sample code. But kindly don't use join as it may hamper ur performance. No trouble in using two select query.
data: begin of itab occurs 0,
BUKRS like anla-BUKRS,
ANLN1 like anla-ANLN1,
BDATU like anlz-BDATU,
end of itab.
select anlabukrs anlaANLN1 anlzBDATU into corresponding fields of table itab from anla inner join anlz on anlaanl1 eq anlz~anl1 where (logexp).
Please come back for any clarification.
Thanks and Regards,
saurabh -
Retriving data from backend tables
Hi All,
I have one requirement to retrive the data from backend tables.
Is there any code to retrive only the first row of table from backend.
Please provide me any solution for this.
Thanks in Advance!
Thanks & Regards,
Sreelakshmi.Hi,
create a remote enabled rfc with export parameter IT_RESULT TYPE ZSSHDR(transp. table).
use code :
DATA: itab type table of ZSSHDR .
select * from ZSSHDR into table itab .
Read table itab into it_result index 1.
in RFC.
use this rfc in ur DC.
Amit -
Hi ,
I have two tables, we want to retrive data from both the tables please see example below
Table 1
A B X Y Z
1 2
Table B
A B C
1 2 5
1 2 6
1 2 7
I want output like
A B C
1 2 5
Null Null 6
Null Null 7
Regards
Message was edited by:
rajib.sarkarCould you explain the logic behind that?
-
Retriving data from two tables at a time.
Please use this forum to provide feedback about OTN content/services. All other posts will be DELETED.
hi all,
Am using win98 and Oracle 7.
I have splitted a table into two tables having 10 and 9 fields respectively and records of 2000.Now in form builder I have put both tables in same block and on same canvas.
Now when I execute a query I retrieve records of 1st table and can navigate through records of 1st table only .To retrive records of 2nd table I have to put curser in 2nd table and query again for data retrival from 2nd table.This is bothering me to match coulmn of both tables.
Is there any way to execute the records of both tables at a time, so that matching coulmns of both tables would become easy to reach.
Thanks and Regardsheeeey mohammad
you have first to make master/detail block not one block only
then jion between them as pk and fk -
Unable to retrive data from two tables using multiple joins
Hi,
Table: EMP mgr
eid name
eid mgrid
1
A 1
null
2
B 2
3
3
C 3
3
i need to get result as:
eid ename mgrname
thanks
AVSSai,
It would be very helpful if you could mention your table structures a bit more clearly. Would allow for effective replies from fellow users as well. :)
However, assuming that your structure would be as follows presenting the query as below:
DECLARE @Emp TABLE(Eid Int, ename Varchar(50))
DECLARE @Emp_Mgr TABLE(Eid int, mgrid int null )
INSERT INTO @Emp select 1,'Ram'
INSERT INTO @Emp select 2,'Shyam'
INSERT INTO @Emp_Mgr select 1,NULL
INSERT INTO @Emp_Mgr select 2,1
SELECT * FROM @Emp
SELECT * FROM @Emp_Mgr
Query to print results as EID, ENAME, MGRNAME
SELECT em.eid,e1.ename as ENAME,e2.ename as MGRNAME
FROM @Emp_Mgr em
JOIN @Emp e1 ON em.eid=e1.eid
JOIN @Emp e2 ON em.mgrid=e2.eid
However, as you see this approach of maintaining two tables for preserving the employee-manager data is redundant and makes the queries unnecessarily complex. So, you could opt for the widely used single table format as mentioned by Praveen as well. Check
if this helps you..
Recommended Structure
*Avoidance of redundant storage of data
*Lesser Joins in queries
DECLARE @Emp TABLE(Eid Int , Ename Varchar(50) , mgrid int null )
INSERT INTO @Emp(Eid , ename , mgrid) values(1 , 'Ram' , null) , (2 , 'Shyam' , 1)
SELECT * FROM @Emp
Query to print results as EID, ENAME, MGRNAME
SELECT e.Eid , e.Ename , m.Ename as MgrName
FROM @Emp e
JOIN @Emp m On a.mgrid = b.eid
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'> -
I want to retrive data from KNVP table but it shows records in miss order.
Hello all,
I have written following query.
SELECT KPKUNNR KPKUNN2
INTO corresponding fields of table I_KUNZJ
FROM KNVP AS KP
WHERE KP~PARVW = 'ZJ'
AND KP~KUNN2 = 'C0100' .
KNVP table having following customers for my condition:-
Kunnr
100510
1150010
1166835
But it shows records in following order:-
Kunnr
1150010
100510
1166835
So it shows 1st record = 1150010 instead of 100510. I want to show 1st record as 100510. Can any one please tell me why it shows such miss order.customers::Kunnr
100510
1150010
1166835
Actually I want to select 1st record only and insted of 100510 it shows 1150010 kunnr.
SELECT KUNNR KUNN2
INTO corresponding fields of table I_KUNZJ
FROM KNVP
up to 1 rows
WHERE PARVW = 'ZJ'
AND KUNN2 = 'C0100' .
Becoz
In KNVP table customers are in following order:-
Kunnr
100510
1150010
1166835
But after selection it shows records in following order:-
Kunnr
1150010
100510
1166835
Edited by: megha waykar on Jan 11, 2008 8:38 AM -
Database.LoadDataSet() method is throwing error during retriving data from empty table of IBM DB2 database. It is giving error code "SQL0100W".
“Error Message: 0NO_DATA [02000] [IBM] [DB2 / NT] SQL0100W FETCH, whether there is a line to be UPDATE or DELETE, or of the query result is an empty table .
SQLSTATE = 02000”Hello SharayuPandit,
For issues regarding DB2, i suggest that you could post it to DB2 related forum:
https://www.ibm.com/developerworks/community/forums/html/forum?id=11111111-0000-0000-0000-000000000842
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi,
I am working on a report where I have to retrieve data from 3 tables(marc,mara,makt).For this I have used 3 select statements for retriving data from 3 tables.There r some fields which r not present in marc table where as present in mara and makt tables.So added thos fields in marc internal table t_marc.I have looped at marc table and used the read statement to read the data from mara table using the key field matnr from both the tables.This read statement is giving the sy-subrc value as 4.Could u pls tell me why this is happening?I am sending my code.
SELECT matnr
werks
pstat
lvorm
FROM marc
INTO TABLE t_marc
PACKAGE SIZE 500
WHERE matnr IN s_matnr
AND werks IN s_werks.
IF NOT t_marc[] IS INITIAL.
SELECT matnr
ersda
laeda
meins
FROM mara
INTO TABLE t_mara
FOR ALL ENTRIES IN t_marc
WHERE matnr = t_marc-matnr
AND ersda IN s_ersda
AND laeda IN s_laeda.
IF NOT t_mara[] IS INITIAL.
SELECT matnr
maktx
FROM makt
INTO TABLE t_makt
FOR ALL ENTRIES IN t_mara
WHERE matnr = t_mara-matnr.
LOOP AT t_marc INTO wa_marc.
READ TABLE t_mara INTO wa_mara WITH KEY matnr = t_marc-matnr.
IF sy-subrc IS INITIAL.
wa_marc-meins = wa_mara-meins.
MODIFY t_marc.
APPEND wa_marc TO t_output.
ENDIF.
READ TABLE t_makt INTO wa_makt WITH KEY matnr = t_marc-matnr.
IF sy-subrc IS INITIAL.
wa_marc-maktx = wa_makt-maktx.
MODIFY t_marc.
APPEND wa_marc TO t_output.
ENDIF.
ENDLOOP.hi hema,
Dont use three select stements for this scenario.
Just use innerjoin and join all the three tables.
Three tables should contain MATNR (material number).
By using that retrieve data from 3 tables by using a single select statement.
Eg:
SELECT DISTINCT a~matnr "MATERIAL NUMBER
a~ersda "CREATED ON
a~mtart "MATERIAL TYPE
a~meins "BASE UNIT OF MEASURE
a~bstme "ORDER UNIT
b~maktx "MATERIAL DESCRIPTION
c~bwkey "VALUATION AREA
c~lbkum "TOTAL VALUED STOCK
c~salk3 "VALUE OF TOTAL VALUED STOCK
c~stprs "STANDARD PRICE
c~peinh "PRICE UNIT
c~bklas "VALUATION CLASS
INTO TABLE it_matdetails
FROM mara AS a INNER JOIN makt AS b ON a~matnr = b~matnr
INNER JOIN mbew AS c ON a~matnr = c~matnr
INNER JOIN marc AS d ON a~matnr = d~matnr
INNER JOIN mard AS e ON a~matnr = e~matnr
WHERE b~spras = sy-langu AND a~matnr IN matnr AND d~werks IN werks AND e~lgort IN lgort.
pls reward if helpful. -
How to fetch data from 2 tables
Hi Experts,
I am using 2 Ztables.Let us assume that there are 2 fields in Table1 as a and b and 2nd Table contain c as field.I want to retrive data from these tables by combining the fields of Table1 with that of 2.
Eg: I want to compare a+b with c and fetch records.
Is there any logic to combine 2 fields and compare with 3rd field using a single select statement?
Regds,
Sam.Hi Sam,
if the tables have one or more common key fields, you can use a JOIN condition for the tables, i.e.
data:
begin of ls_target,
a like ztable1-a,
b like ztable1-b,
c like ztable2-c,
end of ls_target,
lt_target like table of ls_target.
select ztable1~a ztable1~b ztable2~c
into corresponding fields of table lt_target
from ztable1
join ztable2 ON ztable2~key = ztable1~key
where <your condition>.
Note ahead:
1) some people say select into corresponding fields is not good for performance. I think it is good to avoid errors and nobody ever gave a perfomance proof.
2) Most developers always use an alias such as ztable1AS a, ztable2 AS b. This is due to the fact that after table joins were introduced with release 3.1, the ABAP sample programs an documentation always used the ALIAS clause although it is not necessary nor does it establish transparency.
Kind regards
Clemens -
HOW to retrive data from SAP Tabel
Hi Friends,
1)Can you please explain how to retrive data from SAP table(example AFRU).
2) we had requriment based on the qunatity , Product name and date we need to display KPI's .KPI is based no products manfactured per day with some conditions
Regards
SrikanthHi Udayan,
I want to retrive SAP Table data from xMII.can you please explain elabarately how to call "RFC_READ_TABLE" from xMII.
please do the needful
Thanks
Srikanth -
Retriving of data from different tables
retriving of data from different tables depening of the primary key this key field is there in all tables if it is there in one v table it should continue to other tables otherwise it should get exit from that it should display information message or otherwise success message if it is there in all tables .
Im writing the concept, just check it.
SELECT * from kna1 into lt_kna1.
if sy-subrc eq 0.
selest * from lfa1 into lt_lfa1
for all entries in lt_kna1.
endif. -
How to retrive data from this inernal table
hi,
could u please explain clearly how to retrive the records from this structure
data: begin of itab.
include structure sflite.
data:end of itab.
how to retrive data from this structure could u plz give me a code with example.Hi,
TYPES: BEGIN OF struc1,
val1 TYPE c,
val2 TYPE c,
END OF struc1,
BEGIN OF struc2,
val type struc1,
val3 TYPE c,
val4 TYPE c,
END OF struc2.
DATA: l_f_str1 type struc1,
l_f_str2 type struc2.
START-OF-SELECTION.
l_f_str2-val-val2 = 'a'.
write : / l_f_str2-val-val2.
END-OF-SELECTION. -
How to get the data from AUSP TABLE
Hi Experts,
Select * from AUSP where atinn = w_attin
And klart = 001
And atwrt between w_low and w_high.
Endselect.
Here I am using this select to retrive data from ausp where atwrt in between 00000[w_low] and 09999[w_high].
In EPC it displays an error like data types incompatability..
Because atwrt is character field of length 30 and w_low and w_high are integer fields.
How to rectify this problem.<b>Hi
Code like this
data: v_low type AUSP-ATWRT,
v_high type AUSP-ATWRT.
v_low = w_low .
v_high = w_high.
Select * from AUSP into corresponding fields of table itab where atinn = w_attin
And klart = 001
And atwrt between v_low and v_high.
DONT USE SELECT...ENDSELECT as performance issues is there rather use into table.
Mark points if helpful.
Regs
Manas Ranjan Panda</b>
Maybe you are looking for
-
How to convert a logo in truetype font?
Is there a freeware or shareware program which can convert a logo in truetype font? I saw Fontographer, but it's very expensive...
-
Popup with 1 entry field?
hi guys im looking for a FM with 1 entry field with text and numbers. this pop up must exist but i cant find it. tks in advance.
-
Connecting laptop to the internet through the iphone
Do they have an app out for this?
-
I love Firefox, but this problem is frustrating me. I want to go to a favorite site and have bookmarked it. When I click on that bookmark, the site opens in a sidebar! How do I make it open in the full tab window?
-
Hi All, Can any body let me know the Excise accounting Entry of Vendor Return (Movt. 122/161)? In my case it is displaying; Credit ---> BED, ECS & HEC Debit ---> PLA on hold and Which ETT system will use? With Reagrds Manoj Singh