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

Using substring in table joins.

aneel_munawar
Participant
0 Likes
1,479

Looking for the help about using substring option in the join columns.

Like

Table1.Filed = substring (Table2.Field,1,10)

Thanks

Aneel

1 ACCEPTED SOLUTION
Read only

former_member228804
Participant
0 Likes
1,142

Hello Aneel,

     Can you please elaborate what exactly is your requirement?

Regards,

Dnyanesh.

5 REPLIES 5
Read only

former_member228804
Participant
0 Likes
1,143

Hello Aneel,

     Can you please elaborate what exactly is your requirement?

Regards,

Dnyanesh.

Read only

0 Likes
1,142

Hi Dnyanesh,

Actually I want to compare the two tables columns in the join condition.

First table's column data matches second table's column data with first 10 characters of column.

One column has 20 length  and 2nd table column has 10 characters length.

1000000006BM22BMC2 =   one column value

1000000006  =  second column value.

i want to compare in the join only first 10 charecters.

Read only

0 Likes
1,142

Hi Aneel,

     In that case you can follow the below approach.

Create an internal table of the same TYPE as your first internal table. Call it i_itab_dummy.

Data: lv_colval TYPE char10.

LOOP AT i_itab1 into w_itab1.

     lv_colval = w_itab1-colvalue+0(10).

     w_itab_dummy-colvallue = lv_colval.

     APPEND w_itab_dummy TO i_itab_dummy.

ENDLOOP.

Populate all the data into the dummy internal table in the above fashion. Now you will have the required values, i.e. first 10 characters of the field you want in the dummy internal table.

Now you can use this dummy internal table in your query for INNER JOIN.

Regards,

Dnyanesh.

Read only

0 Likes
1,142

Hi,

It solved my problem. Thanks Dnyanesh.

Read only

former_member228804
Participant
0 Likes
1,142

     Please mark the answers that solve your problems as correct.