10-17-2008 1:49 PM
Hi ,
i have to take 2 fielcd vorna and nachn from from pa0002 table according to emp id which is in our ondeveloped table and on that table we having one field in which there are multiple empid with comma
i want each emp id saperated and according to that i have to write select quarri. please help me
10-17-2008 2:11 PM
data: it_tmp_ees type table of string, "temporary table for EEs
it_ees type table of string. "your EEs table
data: begin of it_ee_name occurs 0, "table where you get EE +name (result table)
pernr type pa0002-pernr,
vorna type pa0002-vorna,
nachn type pa0002-nachn,
end of it_ee_name.
LOOP AT it. "suppose your internal table is IT
REFRESH it_tmp_ees.
SPLIT it-empid AT ',' INTO TABLE it_tmp_ees. "empid is your field where you have your EE ids
APPEND LINES OF it_tmp_ees TO it_ees. "append your EEs to destination table
ENDLOOP.
"now when you already have your EEs' ids in it_ees get PA0002 for them
SELECT pernr vorna nachn FROM PA0002 INTO CORRESPONDIG FIELDS OF TABLE it_ee_name
FOR ALL ENTRIES IN it_ees WHERE pernr = it_ees.
That's it.
10-17-2008 2:02 PM
First select all the employee into one internal table .
Then based on that internal table you can get data into your main table .
any common field is there between these tables .
10-17-2008 2:04 PM
lt_emp = 3243,23545343,345345,34534745,87978.
data: lv_emp type emp,
lv_temp type string,
do.
if not lt_emp is intial.
split lt_emp at ',' into LV_emp lt_emp.
move lv_emp to itab-emp.
append itab-emp.
clear: itab, LV_emp.
else.
exit.
endif.
enddo.
"vorna and nachn from from pa0002
select pernr vorna nachn
into itab_final
for all entries in itab
where emp/(or)pernr = itab-emp/(or)pernr.
Edited by: Jay Sadaram on Oct 17, 2008 9:05 AM
10-17-2008 2:41 PM
hi
thanks for you rply
can you please tell me what is it_ees
and when i am giving it in select quarri it is showinh an error message
it_ees can not be a table a reference a string or contain any of these objects
and also i want to gaive it in field catalog how can i give it.
abd i am doing in alv
Edited by: ankita khare on Oct 17, 2008 3:52 PM
10-17-2008 2:11 PM
data: it_tmp_ees type table of string, "temporary table for EEs
it_ees type table of string. "your EEs table
data: begin of it_ee_name occurs 0, "table where you get EE +name (result table)
pernr type pa0002-pernr,
vorna type pa0002-vorna,
nachn type pa0002-nachn,
end of it_ee_name.
LOOP AT it. "suppose your internal table is IT
REFRESH it_tmp_ees.
SPLIT it-empid AT ',' INTO TABLE it_tmp_ees. "empid is your field where you have your EE ids
APPEND LINES OF it_tmp_ees TO it_ees. "append your EEs to destination table
ENDLOOP.
"now when you already have your EEs' ids in it_ees get PA0002 for them
SELECT pernr vorna nachn FROM PA0002 INTO CORRESPONDIG FIELDS OF TABLE it_ee_name
FOR ALL ENTRIES IN it_ees WHERE pernr = it_ees.
That's it.