‎2007 Dec 24 10:22 AM
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%'.
‎2007 Dec 24 10:34 AM
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
‎2007 Dec 24 10:34 AM
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
‎2007 Dec 24 10:46 AM
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
‎2007 Dec 24 10:50 AM
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
‎2007 Dec 24 10:57 AM
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
‎2007 Dec 24 11:02 AM
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
‎2007 Dec 24 12:32 PM
‎2007 Dec 24 10:34 AM
‎2007 Dec 24 10:40 AM
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