2007 Mar 27 8:55 AM
This is my simple source code.
TABLES: stpo.
DATA: t_stpo LIKE stpo OCCURS 0 WITH HEADER LINE,
t_stpo_itm LIKE stpo OCCURS 0 WITH HEADER LINE,
t_stpo-stlnr = '00000058'.
t_stpo-stlkn = '00000003'.
append t_stpo.
t_stpo-stlnr = '00000058'.
t_stpo-stlkn = '00000007'.
append t_stpo.
SELECT * FROM stpo INTO TABLE t_stpo_itm
FOR ALL ENTRIES IN t_stpo
WHERE stlnr = t_stpo-stlnr " BOM No.
AND stlkn <> t_stpo-stlkn. " BOM item node number
-
The output from this source including BOM item node number 00000003, 00000007 but at SQL stlkn <> t_stpo-stlkn doesn't effected.
Could Anyone please tell me why?
Are there something wrong?
Thank you in advance.
2007 Mar 27 9:35 AM
Hi Tiwa,
I think the result is good.
At the first loop you got 00000058 / 00000003 in your 'stpo' table so you retrieve ( following your 'where clause' ) the 0000000058 / 000000007 record .
At the 2nd loop you got 00000058 / 00000007 in your 'stpo' table so you retrieve the 0000000058 / 000000003 record .
The result is correct.
Regards,
Erwan
2007 Mar 27 9:06 AM
Why dont you try just ;
t_stpo-stlnr = '00000058'.
append t_stpo.
t_stpo-stlnr = '00000058'.
append t_stpo.
SELECT * FROM stpo INTO TABLE t_stpo_itm
FOR ALL ENTRIES IN t_stpo
WHERE stlnr = t_stpo-stlnr " BOM No.
AND stlkn <> '00000003'
and stlkn <> '00000007' .
2007 Mar 27 9:28 AM
Thanks for your answer, I know that I can use the code like your.
I just wonder why FOR ALL ENTRIES IN can't give me an output that should be.
2007 Mar 27 9:08 AM
Hi,
You can also Use ranges for Stlnr and Stlkn fields, instead of int table.
TABLES: stpo.
DATA: begin of t_stpo OCCURS 0.
stlnr like stpo-stlnr,
stlkn like stpo-stlkn,
end of t_stpo.
data t_stpo_itm LIKE stpo OCCURS 0 WITH HEADER LINE.
t_stpo-stlnr = '00000058'.
t_stpo-stlkn = '00000003'.
append t_stpo.
clear t_stpo.
t_stpo-stlnr = '00000058'.
t_stpo-stlkn = '00000007'.
append t_stpo.
clear t_stpo.
if not t_stpo[] is initial.
SELECT * FROM stpo INTO TABLE t_stpo_itm
FOR ALL ENTRIES IN t_stpo
WHERE stlnr = t_stpo-stlnr " BOM No.
AND stlkn <> t_stpo-stlkn. " BOM item node number
endif.
or you can simply write a select for STPO like this:
SELECT * FROM stpo INTO TABLE t_stpo_itm
WHERE stlnr = '00000058' " BOM No.
AND ( stlkn <> '00000007' or stlkn <> '00000003' ). " BOM item node number
regards,
Anji
2007 Mar 27 9:16 AM
SELECT * FROM stpo INTO TABLE t_stpo_itm
FOR ALL ENTRIES IN t_stpo
WHERE stlnr = t_stpo-stlnr " BOM No.
AND NOT stlkn = t_stpo-stlkn. " BOM item node number
TRY THIS IT MAY HELP YOU...
REGARDS
SHIBA DUTTA
2007 Mar 27 9:21 AM
PARAMETERS p_city TYPE spfli-cityfrom.
TYPES: BEGIN OF entry_tab_type,
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
END OF entry_tab_type.
DATA: entry_tab TYPE TABLE OF entry_tab_type,
sflight_tab TYPE SORTED TABLE OF sflight
WITH UNIQUE KEY carrid connid fldate.
SELECT carrid connid
FROM spfli
INTO CORRESPONDING FIELDS OF TABLE entry_tab
WHERE cityfrom = p_city.
SELECT carrid connid fldate
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE sflight_tab
FOR ALL ENTRIES IN entry_tab
WHERE carrid = entry_tab-carrid AND
connid ne '005'.
write 'sunil'.
see this is working if u have any more call me
2007 Mar 27 9:22 AM
hI..
IF YOU DON'T HAVE ANY DTA FROM THE 1ST SELECT...
THEN IT WILL FETCJH ALL THE RECORDS INT THE SECOND SELECT...
IT WILL IGNORE THE WHERE CONDITIONS...
SO MAKE SURE THAT THE 1ST QUERY IS GETTING SOME DATA...THEN ONLY IT WORKS..
FOR ALL ENTRIES..WILL NOT WORK WELL FOR INITIAL TABLE
2007 Mar 27 9:24 AM
Conditions with <> penalize the performance.
Better do this code:
SELECT * FROM stpo INTO TABLE t_stpo_itm
FOR ALL ENTRIES IN t_stpo
WHERE stlnr = t_stpo-stlnr
DELETE t_stpo_itm WHERE stlkn = 00000003 AND stlkn = 00000007
2007 Mar 27 9:35 AM
Hi Tiwa,
I think the result is good.
At the first loop you got 00000058 / 00000003 in your 'stpo' table so you retrieve ( following your 'where clause' ) the 0000000058 / 000000007 record .
At the 2nd loop you got 00000058 / 00000007 in your 'stpo' table so you retrieve the 0000000058 / 000000003 record .
The result is correct.
Regards,
Erwan
2007 Mar 27 10:07 AM
hi,
Before using the for all entries,first check the internal to be used in for all entries is having entries or not.if it is not having entries...it will satisfy the condition.
thanks & regards,
sangeetha.a