11-28-2007 10:32 AM
hi,
i wanted to remove END SELECT instead i'm using FOR ALL ENTRIES also instead of select * i'm declearing the fields.
i have declared a headerline itab for cdhdr and kna1.
earlier no itab was used for both cdhdr and kna1.
now its showing syntax error that in for entries condition type kunnr is not matching with type OBJECTID. where as if no itab is been delared for both CDHDR and KNA1 and for all entries is not used its not showing me any error.
i have pasted code below, i wud be very thankful if any of u gud help me
regards
ram
SELECT * FROM cdhdr
WHERE tcode = gc_tcode
AND objectclas = gc_objcl AND
udate = chngdat.
SELECT objectclas objectid changenr
INTO TABLE gt_cdhdr
FROM cdhdr
WHERE tcode = gc_tcode
AND objectclas = gc_objcl AND
udate = chngdat.
IF cdhdr-objectid <> hold_cust.
MOVE cdhdr-objectid TO hold_cust.
SELECT * FROM kna1 WHERE kunnr = cdhdr-objectid
AND ktokd = gc_ktokd
AND loevm = gc_space.
SELECT kunnr name1 name2 name3 name4 stras ort01 regio land1 pstlz pstl2 erdat
FROM kna1
into table a1rec
for all entries in gt_cdhdr
WHERE kunnr = gt_cdhdr-objectid
AND ktokd = gc_ktokd
AND loevm = gc_space.
11-28-2007 12:13 PM
As <i>objectid</i> is a generic field it has not the same type and length that <i>kunnr</i> so use a syntax like :
SELECT kunnr name1 name2 name3 name4 stras ort01 regio land1 pstlz pstl2 erdat
FROM kna1
into table a1rec
for all entries in gt_cdhdr
WHERE kunnr = gt_cdhdr-objectid+0(10)
AND ktokd = gc_ktokd
AND loevm = gc_space.
Regards
11-28-2007 10:37 AM
Hi Ram,
Yes, it will throw a sytax error only, if you use a for all entries option. Here the variables used for comparing should have the same attributes. If you still want to retrive the values with for all entries, please declare an additional field in the internal table gt_cdhdr similat to object id and pass the kunnr value to it and do the selection
11-28-2007 10:37 AM
use like this...
SELECT kunnr name1 name2 name3 name4 stras ort01 regio land1 pstlz pstl2 erdat
FROM kna1
into CORRESPONDING FIELDS OF TABLE a1rec
for all entries in gt_cdhdr
WHERE kunnr = gt_cdhdr-objectid
AND ktokd = gc_ktokd
AND loevm = gc_space.
11-28-2007 10:38 AM
Hi Ram
I think You are referring to the wrong field in CDHDR. The field OBJECTID has a length of 90 and it is no where compared to KUNNR of KNA1..Please look at your specificationjs...It must be CHANGENR or some other field which needs to be compared to KUNNR.
Shakir
11-28-2007 10:40 AM
Hi,
The data element of KUNNR and OBJECTID should be same .
Regards,
prashant
11-28-2007 12:13 PM
As <i>objectid</i> is a generic field it has not the same type and length that <i>kunnr</i> so use a syntax like :
SELECT kunnr name1 name2 name3 name4 stras ort01 regio land1 pstlz pstl2 erdat
FROM kna1
into table a1rec
for all entries in gt_cdhdr
WHERE kunnr = gt_cdhdr-objectid+0(10)
AND ktokd = gc_ktokd
AND loevm = gc_space.
Regards