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

error while removing endselect

Former Member
0 Likes
679

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.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
642

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

5 REPLIES 5
Read only

Former Member
0 Likes
642

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

Read only

Former Member
0 Likes
642

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.

Read only

abdulazeez12
Active Contributor
0 Likes
642

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

Read only

former_member386202
Active Contributor
0 Likes
642

Hi,

The data element of KUNNR and OBJECTID should be same .

Regards,

prashant

Read only

RaymondGiuseppi
Active Contributor
0 Likes
643

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