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

Need Join ideas

Former Member
0 Likes
909

HI

i write this join ,there is a better way to write it?

Regards

SELECT agr_hier~agr_name agr_hier~object_id agr_hier~parent_id agr_hier~sort_order
           agr_hier~menu_level  agr_hier~menu_level agr_hier~report agr_hiert~text
      INTO CORRESPONDING FIELDS OF TABLE it_h
      FROM ( ( agr_hier
      INNER JOIN agr_hiert
      ON agr_hier~agr_name = agr_hiert~agr_name
      AND agr_hier~object_id = agr_hiert~object_id ) )
      FOR ALL ENTRIES IN ct_agr_user
      WHERE agr_hier~agr_name = ct_agr_user-agr_name
      AND ( report = '_APPATION' OR report = 'APPION'22 ).

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
760

Also include AGR_HIERT-SPRAS in the ON- or WHERE-conditions (probably selecting SY-LANGU) to avoid duplicates due to possible multiple translations.

> report = 'APPION'22

Is this a typo?

Thomas

4 REPLIES 4
Read only

ThomasZloch
Active Contributor
0 Likes
761

Also include AGR_HIERT-SPRAS in the ON- or WHERE-conditions (probably selecting SY-LANGU) to avoid duplicates due to possible multiple translations.

> report = 'APPION'22

Is this a typo?

Thomas

Read only

Former Member
0 Likes
760

Hi,

One suggestion.

SELECT agr_hieragr_name agr_hierobject_id agr_hierparent_id agr_hiersort_order

agr_hiermenu_level agr_hiermenu_level agr_hierreport agr_hierttext

INTO CORRESPONDING FIELDS OF TABLE it_h

FROM agr_hier

INNER JOIN agr_hiert

ON agr_hieragr_name = agr_hiertagr_name

AND agr_hierobject_id = agr_hiertobject_id

FOR ALL ENTRIES IN ct_agr_user

WHERE agr_hier~agr_name = ct_agr_user-agr_name

AND agr_hier~report IN ('_APPATION' , 'APPION22u2019 ).

Regards,

Jisha.

Read only

Former Member
0 Likes
760

Hi,

1. don't used INTO CORRESPONDING FIELDS OF TABLE it_h.

2. FROM agr_hier as 'TABLE NAME'

3. INNER JOIN agr_hiert as 'TABLE NAME'

Regards:

Mahesh

Read only

Former Member
0 Likes
760

hi

use the following code:

SELECT agr_hier~agr_name

agr_hier~object_id

agr_hier~parent_id

agr_hier~sort_order

agr_hier~menu_level

agr_hier~menu_level

agr_hier~report

agr_hiert~text

INTO CORRESPONDING FIELDS OF TABLE it_h

FROM ( ( agr_hier as agr_hier

INNER JOIN agr_hiert as agr_hiert

ON agr_hieragr_name = agr_hiertagr_name

AND agr_hierobject_id = agr_hiertobject_id ) )

FOR ALL ENTRIES IN ct_agr_user

WHERE agr_hier~agr_name = ct_agr_user-agr_name

AND ( report = '_APPATION' OR report = 'APPION'22 ).

one more thing u can try u can cut the code in two selection

1- for innerjoin of two tables

2- for where condion on it_h and ct_agr_user