‎2008 Oct 28 4:24 PM
Hi experts, it's the first time that i do a small BW project,
I have a table like
table 1:
name________________departement
jean.pierre_____________VBB
table 2:
mail________________________________ logon
jean.pierre @ entrprise.com_____________PierreJ
I want to do a join with 2 tables above
in order to match the name with the mail. I need do some treatment with the 'mail ' in deleteing le @entreprise .com to do this join.
so I want to know some one has done this and how to do this , and if you have some code exemple that's better
thanks a lot
Edited by: kai zhang on Oct 28, 2008 4:06 PM
‎2008 Oct 29 8:27 AM
Hi
first you have to split the email...and you have to take one extra field in itab2 where you will store the name..
loop at <itab2>.
split mail at '@' into str1 str2.
<new-field> = str1.
modify <itab2>.
endloop.
loop at <itab1>.
read table <itab2> with key <new-field> = <itab1>-name.
write you own code. "This is the join
endloop.
Arunima
‎2008 Oct 28 4:40 PM
no common fields, so no DB join... I would suggest select from both tables into two internal tables and do the following (pseudo code):
LOOP AT itab2. "this is the with the email (second one in your question
SPLIT itab2-mail INTO field1 field2 AT '@'.
READ TABLE itab1 WITH KEY name = field1.
==> Now you have both records and you can whatever you want
ENDLOOP.(itab1 has to be a sorted table, or sort it before the LOOP and add BINARY SEARCH to the READ TABLE)
‎2008 Oct 28 5:24 PM
A second option could be having a unique common fields in both the table.
table 1:
Userid / PersonlNum / Globalid ( Unique for a person )
name
departement
Table 2:
Userid / PersonlNum / Globalid
logon
‎2008 Oct 29 8:27 AM
Hi
first you have to split the email...and you have to take one extra field in itab2 where you will store the name..
loop at <itab2>.
split mail at '@' into str1 str2.
<new-field> = str1.
modify <itab2>.
endloop.
loop at <itab1>.
read table <itab2> with key <new-field> = <itab1>-name.
write you own code. "This is the join
endloop.
Arunima