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

HELP WITH JOIN

Former Member
0 Likes
951

HI,

i new with join and i have this code and i wont to separate it to 2 select

how i can do that ?

i reward

SELECT /bic/pybproject~/bic/ybproject

/bic/tybproject~txtmd

FROM /bic/pybproject

LEFT OUTER JOIN /bic/tybproject ON /bic/tybproject/bic/ybproject EQ /bic/pybproject/bic/ybproject

AND /bic/tybproject~langu EQ sy-langu

INTO CORRESPONDING FIELDS OF TABLE projects

WHERE /bic/pybproject~changed NE 'D'

AND /bic/pybproject~/bic/zps_pr_rs EQ /bic/zps_pr_rs

and /bic/pybproject~/BIC/ZPS_SY_ST not like 'CLSD%'.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
936

Hi ricardo,

Check it.

SELECT /bic/ybproject

FROM /bic/pybproject

INTO CORRESPONDING FIELDS OF TABLE projects

WHERE changed NE 'D'

AND /bic/zps_pr_rs EQ /bic/zps_pr_rs

AND /BIC/ZPS_SY_ST not like 'CLSD%'.

if not projects[] is initial.

SELECT txtmd

FROM /bic/tybproject

INTO CORRESPONDING FIELDS OF TABLE projects

FOR ALL ENTRIES IN projects

WHERE /bic/ybproject EQ projects-bic/ybproject

langu EQ sy-langu.

ENDIF.

I have modified it please check

Edited by: mukesh kumar on Dec 24, 2007 11:49 AM

8 REPLIES 8
Read only

Former Member
0 Likes
937

Hi ricardo,

Check it.

SELECT /bic/ybproject

FROM /bic/pybproject

INTO CORRESPONDING FIELDS OF TABLE projects

WHERE changed NE 'D'

AND /bic/zps_pr_rs EQ /bic/zps_pr_rs

AND /BIC/ZPS_SY_ST not like 'CLSD%'.

if not projects[] is initial.

SELECT txtmd

FROM /bic/tybproject

INTO CORRESPONDING FIELDS OF TABLE projects

FOR ALL ENTRIES IN projects

WHERE /bic/ybproject EQ projects-bic/ybproject

langu EQ sy-langu.

ENDIF.

I have modified it please check

Edited by: mukesh kumar on Dec 24, 2007 11:49 AM

Read only

0 Likes
936

hi mukesh

i try your soltion but i have error in the second select

this is the eroor:

Wrong table name or table alias name table alias name "PROJECTS". table

IF NOT projects[] IS INITIAL.

SELECT txtmd

FROM /bic/tybproject

INTO CORRESPONDING FIELDS OF TABLE b_proj

FOR ALL ENTRIES IN projects

WHERE /bic/ybproject EQ projects~/bic/ybproject

LANGU EQ sy-langu.

ENDIF.

Regards

Read only

0 Likes
936

Replace ~ with - in where condition in projects-bic/ybproject

IF NOT projects[] IS INITIAL.

SELECT txtmd

FROM /bic/tybproject

INTO CORRESPONDING FIELDS OF TABLE projects

FOR ALL ENTRIES IN projects

WHERE /bic/ybproject EQ projects-bic/ybproject

LANGU EQ sy-langu.

ENDIF.

check it

Read only

0 Likes
936

hi mukesh

thanks now its working but the problem is when i do the second select it delete the first data (projects num) from table projects

Regards

Read only

0 Likes
936

Hi Ricardo,

Better use two internal table for both the select and create a final internal table it_final.

After both the selects are done use

Move-corresponding it_first_select to it_final.

Move-corresponding it_select_select to it_final.

Use this below sample code for demonstration of the use of move-corresponding statment

DATA: BEGIN OF INT_TABLE OCCURS 10,

WORD(10),

NUMBER TYPE I,

INDEX LIKE SY-INDEX,

END OF INT_TABLE,

BEGIN OF RECORD,

NAME(10) VALUE 'not WORD',

NUMBER TYPE I,

INDEX(20),

END OF RECORD.

...

MOVE-CORRESPONDING INT_TABLE TO RECORD.

SELECT /bic/ybproject

FROM /bic/pybproject

INTO CORRESPONDING FIELDS OF TABLE it_first_select

WHERE changed NE 'D'

AND /bic/zps_pr_rs EQ /bic/zps_pr_rs

AND /BIC/ZPS_SY_ST not like 'CLSD%'.

if not it_first_select[] is initial.

SELECT txtmd

FROM /bic/tybproject

INTO CORRESPONDING FIELDS OF TABLE it_second_select

FOR ALL ENTRIES IN it_first_select

WHERE /bic/ybproject EQ it_first_select-bic/ybproject

langu EQ sy-langu.

ENDIF.

Move-corresponding it_first_select to it_final.

Move-corresponding it_second_select to it_final.

Regards,

Mukesh

Edited by: mukesh kumar on Dec 24, 2007 12:02 PM

Read only

0 Likes
936

thanks kumar

u help me with that .

Best Regards

Read only

Former Member
0 Likes
936

hi frindes

any idea?

Regards

Read only

jayakummar
Active Participant
0 Likes
936

hai,

i give a smple and easy to understandable join code compare this with your code and split up what you want....

select afield1 bfield2 into table intable from dbtab1 as a left outer join dbtab2 as b where cont..........

reward points if useful.

regards,

jai.m