‎2008 Jul 14 10:38 AM
HI
I have selected the objid, sobid from hrp1001 into one internal table itab where relat = '008'.
Now im looping another internal table .This table contains objid. Inside this table i want to read the table itab with key objid = itab1-objid. And
if sy-subrc = 0.
wa_users-sobid = wa_hrp1001-sobid.
APPEND wa_users to it_users.
Endif.
Here im facing one problem like inside itab i have the values like 5000314 Anirban
5000314 Fahad
In this case im getting only one user. I need both the users.
How can i write the read statement. Can i write read table statement with both index & with key.
Please help me.
‎2008 Jul 14 10:42 AM
hiii
yes you can write READ statement with more then one keys like below
READ TABLE i_bom INTO wa_bom WITH KEY ebeln = wa_ekpo-ebeln
matnr = wa_ekpo-matnr
bmtnr = wa_quantity-idnrk
BINARY SEARCH.regards
twinkal
‎2008 Jul 14 10:51 AM
Hi
I have already written read statement inside the loop like this
loop at it_obj into wa_obj.
Read table it_hrp1001 into wa_hrp1001 with key objid = wa_obj-objid.
if sy-subrc eq 0.
wa_users-sobid = wa_hrp1001-sobid.
APPEND wa_users to it_users.
endif.
endloop.
My question is here inside it_hrp1001 table im having two records like
objid sobid
-
-
5000314 Jesmila
5000314 fahad
here after read statement im getting only one record..
how to read both the statement
‎2008 Jul 14 10:43 AM
Hi,
Check this:
loop at itab into wa_user.
if wa_users-sobid = wa_hrp1001-sobid.
APPEND wa_users to it_users.
endif.
endloop.Regards
Adil
‎2008 Jul 14 10:44 AM
Instead of READ use loop statement as READ only fetches the 1st records that is matching the criteria at a time..
loop at itab1.
loop at itab where objid = itab1-objid.
wa_users-sobid = wa_hrp1001-sobid.
APPEND wa_users to it_users.
endloop.
endloop.
Regards,
Joy.
‎2008 Jul 14 10:45 AM
Hi,
Try this...
Data: ITAB (Your own internal goes here with 2 fields),
ITAB2 LIKE ITAB1 OCCURS 0,
ITAB3 LIKE ITAB1 OCCURS 0.
ITAB2[] = ITAB[].
sort itab2 by objid.
Delete Adjacent duplicates from ITAB2 comparing objid.
Loop at ITAB2.
Refresh ITAB3.
Insert TABLE ITAB3 Where KEY EBELN = ITAB2-objid.
IF sy-subrc = 0.
Loop at ITAB3.
..........
..........
EndLoop.
EndIf.
EndLoop.
Hope this would help you.
Murthy
‎2008 Jul 14 10:45 AM
Hima,
sort i_bom by matnr bmtnr."sorting is must
READ TABLE i_bom INTO wa_bom WITH KEY ebeln = wa_ekpo-ebeln
matnr = wa_ekpo-matnr
bmtnr = wa_quantity-idnrk
BINARY SEARCH.Amit.
‎2008 Jul 14 10:47 AM
Hi Hima,
you can try sumthing like;
loop itab into wa1.
loop itab into wa where objid = wa1-objid.
wa_users-sobid = wa_hrp1001-sobid.
APPEND wa_users to it_users.
delete itab from wa.
endloop.
endloop.With luck,
Pritam
‎2008 Jul 14 10:47 AM
try this
loop at itab into wa.
if wa-sobid = wa_hrp1001-sobid.
APPEND wa_ to it_users.
endif.
endloop.
‎2008 Jul 14 10:48 AM
loop at itab1.
loop at itab2 where sobid = itab1-sobid..
final-... = itab2-...
final-....= itab1-....
APPEND final.
endloop.
Above code satisfies ur requirement.
rwrd points if helpful
Bhupal
‎2008 Jul 14 10:49 AM
Hi Hima,
sort the internal table itab by key field.
Describe itab lines <var>
do <var> times.
read table itab with key objid = itab1-sobid.
enddo.
regards
padma
‎2008 Jul 14 10:53 AM
Hello Hima,
you can use the loop.. endloop
Or if you want to use only the READ TABLE.. statement, try this..
describe table itab lines w_line.
loop at itab2
read table itab1 into wa_itab1 with key <condition>
append....
endloop.
Indu.