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

CLIENT SPECIFIED in inner join

Former Member
0 Likes
3,047

Hai Friends,

Is it right to use CLIENT SPECIFIED in inner join. if possible explain me with an example.

I am comparing only RSEG-LFBNR with the reference key in MSEG.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,458

It is possible, but not always necessary .... I remember doing it once to tweak a little extra performance out of a complex join but I wouldn't normally bother. Below is a bit of sample code with a MANDT in the join ... I ran ST05 SQL trace across it and the "explain" for both prepares was the same... you'd have to try it with your particular select to see if it makes any difference on your system / database.

Jonathan


report zlocal_jc_client_join.

types:
  begin of gtys_data,
    bname               type usr01-bname,
    class               type usr02-class,
  end of gtys_data.


start-of-selection.
  perform select_with_client.
  perform select_without_client.

*&--------------------------------------------------------------------*
*&      Form  select_with_client
*&--------------------------------------------------------------------*
form select_with_client.

  data:
    lt_data             type table of gtys_data.

  select
    usr01~bname
    usr02~class
    into corresponding fields of table lt_data
    from usr01 as usr01
    inner join usr02 as usr02
      on  usr02~mandt = usr01~mandt
      and usr02~bname = usr01~bname
    client specified
    where usr01~mandt = sy-mandt
    and   usr01~bname like 'A%'.

endform.                    "select_with_client

*&--------------------------------------------------------------------*
*&      Form  select_without_client
*&--------------------------------------------------------------------*
form select_without_client.

  data:
    lt_data             type table of gtys_data.

  select
    usr01~bname
    usr02~class
    into corresponding fields of table lt_data
    from usr01 as usr01
    inner join usr02 as usr02
      on usr02~bname = usr01~bname
    where usr01~bname like 'A%'.

endform.                    "select_without_client

5 REPLIES 5
Read only

Former Member
0 Likes
1,458

Hi,

It all depends on the your requirement, if you use this statement the you need to pass the MANDT ffield in the Where clause of select statement.

If you not provide the MANDT field in case you use the CLIENT SPECIFIED then data is fetched from the Buffer.

Read only

0 Likes
1,458
Client Specified is used when you required to access data of different clients:
Additions:
1 ) If you use MANDT FIELD in the where clause the given clients data is fetched.
2) If no MANDT FIELD is specified Data from all the clients is fetched.

If you specifi MANDT without CLIENT SPECIFIED addition current clients data is fetched.

So if you need to fetched data from other clients in your Join use CLIENT SPECIFIED.

Regards,

Gurpreet

Read only

Former Member
0 Likes
1,458

Hi,

If you want to edit data from other clients explicitly, use the SQL command with the addition

CLIENT SPECIFIED and enter the number of the client in which the SQL operation is to be

carried out in the WHERE clause of the command.

Regards,

Nitin.

Read only

Former Member
0 Likes
1,458

Hi,

You can use the CLIENT SPECIFIED Key word in the select statement to access data from multiple clients.

But you have to take care of the performance and also security options into consideration. As accessing multiple client from other clients is not recomended.

Hope this helps.

Thanks,

Samantak.

Read only

Former Member
0 Likes
1,459

It is possible, but not always necessary .... I remember doing it once to tweak a little extra performance out of a complex join but I wouldn't normally bother. Below is a bit of sample code with a MANDT in the join ... I ran ST05 SQL trace across it and the "explain" for both prepares was the same... you'd have to try it with your particular select to see if it makes any difference on your system / database.

Jonathan


report zlocal_jc_client_join.

types:
  begin of gtys_data,
    bname               type usr01-bname,
    class               type usr02-class,
  end of gtys_data.


start-of-selection.
  perform select_with_client.
  perform select_without_client.

*&--------------------------------------------------------------------*
*&      Form  select_with_client
*&--------------------------------------------------------------------*
form select_with_client.

  data:
    lt_data             type table of gtys_data.

  select
    usr01~bname
    usr02~class
    into corresponding fields of table lt_data
    from usr01 as usr01
    inner join usr02 as usr02
      on  usr02~mandt = usr01~mandt
      and usr02~bname = usr01~bname
    client specified
    where usr01~mandt = sy-mandt
    and   usr01~bname like 'A%'.

endform.                    "select_with_client

*&--------------------------------------------------------------------*
*&      Form  select_without_client
*&--------------------------------------------------------------------*
form select_without_client.

  data:
    lt_data             type table of gtys_data.

  select
    usr01~bname
    usr02~class
    into corresponding fields of table lt_data
    from usr01 as usr01
    inner join usr02 as usr02
      on usr02~bname = usr01~bname
    where usr01~bname like 'A%'.

endform.                    "select_without_client