2008 Aug 22 1:13 PM
Hello
I defined an internal table called tempbeh. I am able to fill the table with values.
However, I do get an error with the second select. There is a problem with the code snippet
AND beh_unique_id NOT IN tempbeh..
I am being told that the row structure of the table tempbeh is not correct.
I do NOT get any errors when I remove the code
AND beh_unique_id NOT IN tempbeh.
Any ideas........ I'd do a prayer if somebody could help, and make me understand why I get an error in the first place.
Thank you very much....Robert
Here is the code:
DATA: BEGIN OF tempbeh OCCURS 1,
beh like zwopti_bv_out-BEH_UNIQUE_ID,
END OF tempbeh.
...
SELECT beh_unique_id FROM zwopti_bv_out
INTO tempbeh
WHERE udate IN s_dat.
APPEND tempbeh.
ENDSELECT.
SELECT
zw~beh_unique_id zw~udate
zw~utime zw~longitude zw~latitude
zw~process zw~state zw~hint_nr
zw~hint_txt zw~anl_unique_id
zw~stp_unique_id zw~ordernr
zw~order_laufnr zw~aedat
zw~zztransp_nr
zw~adrkey z5~tournr
z10~abfallart
z5~rmnr
zwopti_eapos_in~sequence
equi~zzgroesse
zws09~behkennung
zws09~beschreib
FROM zwopti_bv_out AS zw
Inner JOIN zwt05 AS z5 ON zw~ordernr = z5~tourid
LEFT OUTER JOIN zwt10 AS z10
ON zw~ordernr = z10~tourid AND zw~order_laufnr = z10~tourelemnr
LEFT OUTER JOIN zwopti_eapos_in
ON zw~quell_key = zwopti_eapos_in~quell_key
INNER JOIN equi ON zw~beh_unique_id = equi~equnr
INNER JOIN zws09 ON equi~zzfatyp = zws09~behkennung
INTO TABLE lt_bv_out
WHERE beh_unique_id IN s_sernr
AND equi~zzgroesse IN s_behgr
AND zw~zztransp_nr IN s_tid
AND stp_unique_id IN s_stpl
AND zw~adrkey IN x_adrkey
AND z5~tournr IN s_tour
AND zw~hint_nr IN s_hint
AND zws09~behkennung IN s_behart
AND beh_unique_id NOT IN tempbeh.
2008 Aug 22 1:16 PM
First - get out of the habit of using tables with header-lines - it's bad programming practice. Define tempbeh as a RANGE. Then it will have components - SIGN, OPTION, LOW and HIGH. Just like select options, and then it will work with IN.
And you should give it a better name - perhaps indicating that it is a range:
DATA: r_tempbeh TYPE RANGE OF zwopti_bv_out-beh_unique_id.
DATA: lt_tempbeh TYPE STANDARD TABLE zwopti_bv_out-beh_unique_id
WITH NON-UNIQUE KEY header_line.
DATA: ls_r_tempbeh LIKE LINE OF r_tempbeh.
SELECT beh_unique_id FROM zwopti_bv_out
INTO TABLE lt_tempbeh
WHERE udate IN s_dat.
ls_r_tempbeh-sign = 'I'.
ls_r_tempbeh-option = 'EQ'.
LOOP AT lt_tempbeh INTO ls_r_tempbeh-low.
INSERT ls_r_tempbeh INTO TABLE lt_tempbeh.
ENDLOOP.
....
" Now the important bit of your WHERE clause
AND beh_unique_id NOT IN ls_r_tempbeh.
matt
2008 Aug 22 1:16 PM
First - get out of the habit of using tables with header-lines - it's bad programming practice. Define tempbeh as a RANGE. Then it will have components - SIGN, OPTION, LOW and HIGH. Just like select options, and then it will work with IN.
And you should give it a better name - perhaps indicating that it is a range:
DATA: r_tempbeh TYPE RANGE OF zwopti_bv_out-beh_unique_id.
DATA: lt_tempbeh TYPE STANDARD TABLE zwopti_bv_out-beh_unique_id
WITH NON-UNIQUE KEY header_line.
DATA: ls_r_tempbeh LIKE LINE OF r_tempbeh.
SELECT beh_unique_id FROM zwopti_bv_out
INTO TABLE lt_tempbeh
WHERE udate IN s_dat.
ls_r_tempbeh-sign = 'I'.
ls_r_tempbeh-option = 'EQ'.
LOOP AT lt_tempbeh INTO ls_r_tempbeh-low.
INSERT ls_r_tempbeh INTO TABLE lt_tempbeh.
ENDLOOP.
....
" Now the important bit of your WHERE clause
AND beh_unique_id NOT IN ls_r_tempbeh.
matt
2008 Aug 22 1:21 PM
hi,
Try this code...
SELECT
zwbeh_unique_id zwudate
zwutime zwlongitude zw~latitude
zwprocess zwstate zw~hint_nr
zwhint_txt zwanl_unique_id
zwstp_unique_id zwordernr
zworder_laufnr zwaedat
zw~zztransp_nr
zwadrkey z5tournr
z10~abfallart
z5~rmnr
zwopti_eapos_in~sequence
equi~zzgroesse
zws09~behkennung
zws09~beschreib
FROM zwopti_bv_out AS zw
Inner JOIN zwt05 AS z5 ON zwordernr = z5tourid
LEFT OUTER JOIN zwt10 AS z10
ON zwordernr = z10tourid AND zworder_laufnr = z10tourelemnr
LEFT OUTER JOIN zwopti_eapos_in
ON zwquell_key = zwopti_eapos_inquell_key
INNER JOIN equi ON zwbeh_unique_id = equiequnr
INNER JOIN zws09 ON equizzfatyp = zws09behkennung
INTO TABLE lt_bv_out
WHERE beh_unique_id IN s_sernr
AND equi~zzgroesse IN s_behgr
AND zw~zztransp_nr IN s_tid
AND stp_unique_id IN s_stpl
AND zw~adrkey IN x_adrkey
AND z5~tournr IN s_tour
AND zw~hint_nr IN s_hint
AND zws09~behkennung IN s_behart
AND beh_unique_id NOT IN tempbeh-beh_unique.
U have to declare the fieldname with the internal table, that is why it shows u error. Now copy the above code and paste it..
Success..
2008 Aug 22 1:21 PM
tempbeh it is a internal table not a Select option field, thats why u r getting error.
IN and NOT IN is ued in where clause for SELECT-OPTION fields, which has table structure with fields
SIGN
OPTION
LOW
HIGH
of any field.
2008 Aug 22 1:32 PM
Thanks for the easy and complicated solutions.
Now I am gonna dig into matts solution, because I still have to learn a lot
Thanks a lot guys
Bye
Robert
2008 Aug 22 1:34 PM
Sorry,
AND beh_unique_id <> tempbeh-beh_unique_id.
Use this..
Success...
2008 Aug 22 1:36 PM
thank you mevin, I'll check it out
but it looks kinda funny........
Edited by: Robert Steiner on Aug 22, 2008 2:36 PM
2008 Aug 22 1:37 PM
The Ranges is the right procedure.. but if u use internal tables..
use this
AND beh_unique_id NE tempbeh-beh_unique_id.
Success....
2008 Aug 22 1:38 PM
2008 Aug 22 1:37 PM
Hi,
Try like this....
ranges : r_tempbeh for <tablename>-beh_unique_id.
r_tempbeh-sign = 'I'.
r_tempbeh-option = 'EQ'.
SELECT beh_unique_id FROM zwopti_bv_out
INTO tempbeh
WHERE udate IN s_dat.
APPEND tempbeh.
r_tempbeh-LOW = beh_unique_id .
APPEND R_TEMPBEH.
ENDSELECT.
SELECT
zwbeh_unique_id zwudate
zwutime zwlongitude zw~latitude
zwprocess zwstate zw~hint_nr
zwhint_txt zwanl_unique_id
zwstp_unique_id zwordernr
zworder_laufnr zwaedat
zw~zztransp_nr
zwadrkey z5tournr
z10~abfallart
z5~rmnr
zwopti_eapos_in~sequence
equi~zzgroesse
zws09~behkennung
zws09~beschreib
FROM zwopti_bv_out AS zw
Inner JOIN zwt05 AS z5 ON zwordernr = z5tourid
LEFT OUTER JOIN zwt10 AS z10
ON zwordernr = z10tourid AND zworder_laufnr = z10tourelemnr
LEFT OUTER JOIN zwopti_eapos_in
ON zwquell_key = zwopti_eapos_inquell_key
INNER JOIN equi ON zwbeh_unique_id = equiequnr
INNER JOIN zws09 ON equizzfatyp = zws09behkennung
INTO TABLE lt_bv_out
WHERE beh_unique_id IN s_sernr
AND equi~zzgroesse IN s_behgr
AND zw~zztransp_nr IN s_tid
AND stp_unique_id IN s_stpl
AND zw~adrkey IN x_adrkey
AND z5~tournr IN s_tour
AND zw~hint_nr IN s_hint
AND zws09~behkennung IN s_behart.
DELETE LV_BV_OUT WHERE beh_unique_id NOT IN R_TEMPBEH.
Regards,
Nagaraj