Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Code ABAP joins

Former Member
0 Likes
725

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
613

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

3 REPLIES 3
Read only

JozsefSzikszai
Active Contributor
0 Likes
613

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)

Read only

Former Member
0 Likes
613

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

mail

logon

Read only

Former Member
0 Likes
614

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