‎2008 Aug 26 6:52 AM
Hi all,
see the code.
data: itab type cdhdr occurs 0,
wa type cdhdr.
data: begin of itab1 occurs 0,
lifnr like lfa1-lifnr,
ktokk like lfa1-ktokk,
end of itab1.
select * from cdhdr into table itab.
select lifnr ktokk from lfa1 into table itab1
for all entries in itab
where lifnr = itab-objectid.
when i go for Syntax check i am getting Error like " when using the addition for all entries in itab " the fields LIFNR and ITAB-OBJECTID must have the same type and lengh.
so, i have done the following correction in WHERE clause.
select lifnr ktokk from lfa1 into table itab1
for all entries in itab
where lifnr = itab-objectid(10).
But this time i am geting warning in German language.
my correction is correct or not ?
Pls guide me ..
Thanks
Krupali.
‎2008 Aug 26 7:06 AM
hi,
for all entries, comparision fields (lifnr and itab-OBJECTID) should be the same type and length. other wise, system will give you syntax error.
better to define types (structure (program) with the structure CDHDR.
types: begin of type_CDHDR,
OBJECTID type LIFNR,
....
end of type_cdhdr.
data: table_cdhdr type standard table of type_cdhdr.
it should work fine now
I had the same problem erlier, and solved with this solution.
‎2008 Aug 26 6:55 AM
HI,
The simplest way is to create a itab explicitly . i.e.
types : BEGIN OF t_cdpos,
objectclas TYPE cdpos-objectclas,
objectid(10) TYPE c,
changenr TYPE cdpos-changenr,
fname TYPE cdpos-fname,
value_new TYPE cdpos-value_new,
END OF t_cdpos.
data : itab type table of t_cdpos,
wa like line of itab.
Now use this in your select query.
‎2008 Aug 26 6:55 AM
Hi,
I think you better go on and check the content of both of your internal tables. If they are okey, then you may ignore the warning message.
Regards,
Anirban
‎2008 Aug 26 6:58 AM
Hi,
CDHDR-OBJECTID is of length 90.
You can move above value to a char10 field and compare the same.
Regards,
Anversha
‎2008 Aug 26 6:58 AM
select lifnr ktokk from lfa1 into table itab1
for all entries in itab
where lifnr = itab-objectid(10).
But this time i am geting warning in German language.
my correction is correct or not ?Answer is your correction is not correct.
we cannot use offset with for all entries.
you can do this way first take the itab-objectid(10) in some other field like temp than fire for all entries on temp.
like below.
select lifnr ktokk from lfa1 into table itab1
for all entries in itab
where lifnr = itab-temp."<-- see hereAmit.
Edited by: Amit Gujargoud on Aug 26, 2008 8:00 AM
‎2008 Aug 26 7:00 AM
Hi,
Take some common key in both the internal tables and then put for all entries.
lifnr u got from lfai table and objectid field from cdhdr table, both are having different data elements assigned to them.
What u wrote is wrong.
Try to find out some common key betwwen those two table, if u don't find u can not use for all entries statement.
Regards,
Kusuma.
‎2008 Aug 26 7:01 AM
Hi,
Take some common key in both the internal tables and then put for all entries.
lifnr u got from lfai table and objectid field from cdhdr table, both are having different data elements assigned to them.
What u wrote is wrong.
Try to find out some common key betwwen those two table, if u don't find u can not use for all entries statement.
Regards,
Kusuma.
‎2008 Aug 26 7:02 AM
Hi KR,
Declare internal table with CDHDR table fields but instead of OBJECTID this declare with char10 as like lifnr.
or
Ignore warining message your query should work.
Regards
Jana
‎2008 Aug 26 7:06 AM
hi,
for all entries, comparision fields (lifnr and itab-OBJECTID) should be the same type and length. other wise, system will give you syntax error.
better to define types (structure (program) with the structure CDHDR.
types: begin of type_CDHDR,
OBJECTID type LIFNR,
....
end of type_cdhdr.
data: table_cdhdr type standard table of type_cdhdr.
it should work fine now
I had the same problem erlier, and solved with this solution.
‎2008 Aug 26 7:37 AM
Hello
Try this code:
data: itab type cdhdr occurs 0,
wa type cdhdr.
data: begin of itab2 occurs 0,
objectid like lfa1-lifnr,
end of itab2.
data: begin of itab1 occurs 0,
lifnr like lfa1-lifnr,
ktokk like lfa1-ktokk,
end of itab1.
data: begin of itab2 occurs 0,
objectid like lfa1-lifnr,
end of itab2.
select * from cdhdr into table itab.
loop at itab.
itab2-objectid = itab-objectid(10).
append itab2.
endloop.
select lifnr ktokk from lfa1 into table itab1
for all entries in itab2
where lifnr = itab2-objectid.
‎2008 Aug 26 7:56 AM
Hi KR,
DATA: ITAB TYPE CDHDR OCCURS 0,
WA TYPE CDHDR.
DATA: BEGIN OF ITAB1 OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
KTOKK LIKE LFA1-KTOKK,
END OF ITAB1.
SELECT * FROM CDHDR INTO TABLE ITAB.
SELECT LIFNR KTOKK FROM LFA1 INTO TABLE ITAB1
FOR ALL ENTRIES IN ITAB
WHERE LIFNR = ITAB-OBJECTID+0(10).
IF SY-SUBRC = 0.
WRITE : 'dATA fOUND'.
ENDIF.Try above code it's working fine... Change the where condition as above and ignore the warnings...
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7