07-03-2007 3:04 PM
please see this,
I have to select Fname and value_old from CDPOS on given conditions plus from tables ADRC and ADR2. but sometime only ADRC table might be changed and ADR2 table may not be changed and sometime vice versa and some times both tables have changed .
anyway I have to select changes happened in both tables, if change is only in one table (either ADRC or ADR2), I have to pick from that table only, if both I have to pick from both tables. Please review this code.
SELECT FNAME VALUE_OLD
INTO CORRESPONDING FIELDS OF I_CDPOS
FROM CDPOS
WHERE CDPOS~OBJECTID = I_CDPOS-OBJECTID AND
CDPOS~OBJECTCLAS = I_CDPOS-OBJECTCLAS AND
CDPOS~CHANGENR = I_CDPOS-CHANGENR AND
( CDPOSTABNAME = 'ADRC' and CDPOSTABNAME = 'ADR2' ).
Thanks & Regards
Venkat
07-03-2007 3:08 PM
try this..
SELECT FNAME VALUE_OLD
INTO CORRESPONDING FIELDS OF I_CDPOS
FROM CDPOS
WHERE CDPOS~OBJECTID = I_CDPOS-OBJECTID AND
CDPOS~OBJECTCLAS = I_CDPOS-OBJECTCLAS AND
CDPOS~CHANGENR = I_CDPOS-CHANGENR AND
CDPOS~TABNAME <b>IN ( 'ADRC' , 'ADR2' ).</b>
07-03-2007 3:08 PM
try this..
SELECT FNAME VALUE_OLD
INTO CORRESPONDING FIELDS OF I_CDPOS
FROM CDPOS
WHERE CDPOS~OBJECTID = I_CDPOS-OBJECTID AND
CDPOS~OBJECTCLAS = I_CDPOS-OBJECTCLAS AND
CDPOS~CHANGENR = I_CDPOS-CHANGENR AND
CDPOS~TABNAME <b>IN ( 'ADRC' , 'ADR2' ).</b>
07-03-2007 3:41 PM
Hi Seshu / Sekhar,
Thanks for your replies.
Sekhar, I tried your code !!!! it gives me syntax error, 'comma without preceding colon' Moreover I am using internal table i_cdpos in where clause so I think I can"t use <b>IN</b> Statement.
I guess I have to use
SELECT FNAME VALUE_OLD
INTO CORRESPONDING FIELDS OF I_CDPOS
FROM CDPOS
WHERE CDPOS~OBJECTID = I_CDPOS-OBJECTID AND
CDPOS~OBJECTCLAS = I_CDPOS-OBJECTCLAS AND
<b>CDPOS~CHANGENR = I_CDPOS-CHANGENR AND
( CDPOSTABNAME = 'ADRC' OR CDPOSTABNAME = 'ADR2' ).</b>
Seshu, Thanks for your advice, this is just a simple chang, So I would like to go with this change in code instead of using FM, I guess I have to change lot of code, If I use FM. I know that FM would be better solution.
Once again thanks for your replies.
Regards
Venkat
Message was edited by:
venkat Kumbham
07-03-2007 3:52 PM
just remove the spaces after first bracket and before second bracket
SELECT FNAME VALUE_OLD
INTO CORRESPONDING FIELDS OF I_CDPOS
FROM CDPOS
WHERE CDPOS~OBJECTID = I_CDPOS-OBJECTID AND
CDPOS~OBJECTCLAS = I_CDPOS-OBJECTCLAS AND
CDPOS~CHANGENR = I_CDPOS-CHANGENR AND
CDPOS~TABNAME <b>IN ('ADRC' , 'ADR2').</b>
07-03-2007 4:15 PM
Thanks Sekhar, I got it !!!
Closiing thread !!! Alloting points !1
Regards
Venkat
07-03-2007 3:10 PM
Hi Venkat,
Instead of writing select query on CDPOS ,use FM for Better performance
FM - CHANGEDOCUMENT_READ_POSITIONS
Thanks
Seshu