‎2006 Jun 26 9:39 AM
Hi,
I've query like this:
SELECT * FROM /sapsll/adrcon INTO TABLE lt_adrcon_tmp
FOR ALL ENTRIES IN lt_leglrgi
WHERE adrnr EQ lt_leglrgi-adrnr
AND lgreg EQ lt_leglrgi-lgreg.
Now, instead of all entries in lt_leglrgi, i want to select specific entries only. lt_leglrgi has a field SCRVT. I want the above query to work on only those lt_leglrgi entries for which SCRVT is set.
Deleting entries from lt_leglrgi is not a option.
I want to avoid a extra loop.
Is there any way i can restructure this database query for my requirement?
Thanks,
Rohit.
‎2006 Jun 26 10:03 AM
This seems to be the only option left:
IT_TEMP[] = LT_LEGLRGI[].
DELETE FROM IT_TEMP WHERE NOT SCRVT IS INITIAL.
and now,
SELECT * FROM /sapsll/adrcon INTO TABLE lt_adrcon_tmp
FOR ALL ENTRIES IN <b>IT_TEMP</b>
WHERE adrnr EQ lt_leglrgi-adrnr
AND lgreg EQ lt_leglrgi-lgreg.
Hope this helps.
Sudha
‎2006 Jun 26 9:48 AM
Hi rohit,
1. only those lt_leglrgi entries for which SCRVT is set
SELECT * FROM /sapsll/adrcon INTO TABLE lt_adrcon_tmp
FOR ALL ENTRIES IN lt_leglrgi
WHERE adrnr EQ lt_leglrgi-adrnr
AND lgreg EQ lt_leglrgi-lgreg
<b>AND LT_LEGLRGI-SCRVT IS NOT INITIAL.</b>
regards,
amit m.
‎2006 Jun 26 9:49 AM
Hi,
Fill the internal table lt_leglrgi with the required entries only and then use FOR ALL ENTRIES.
i.e. while filling the records into lt_leglrgi, aply the condition of SCRVT.
Regards,
Shashank
‎2006 Jun 26 9:50 AM
Hai Rohit
Check the Following Code
sort lt_leglrgi by adrnr lgreg.
if not lt_leglrgi[] is initial.
SELECT * FROM /sapsll/adrcon INTO TABLE lt_adrcon_tmp
FOR ALL ENTRIES IN lt_leglrgi
WHERE adrnr EQ lt_leglrgi-adrnr
AND lgreg EQ lt_leglrgi-lgreg
AND LT_LEGLRGI-SCRVT IS NOT INITIAL.
endif.
Thanks & regards
Sreenivasulu P
‎2006 Jun 26 9:51 AM
Hi Rohit,
Use this
If lt_leglrgi-SCRvt = 'X'.
SELECT * FROM /sapsll/adrcon INTO TABLE lt_adrcon_tmp
WHERE adrnr EQ lt_leglrgi-adrnr
AND lgreg EQ lt_leglrgi-lgreg.
and lt_leglrgi-scrvt is not initial
endif.
‎2006 Jun 26 9:56 AM
Hi,
@Shanshank: The table lt_leglri has to be filled by all the entries.
@Sreenivasulu / amit : That is a syntax error. Please check again.
@mukesh : lt_leglrgi is a internal table, not a structure.
Regards,
Rohit.
‎2006 Jun 26 10:03 AM
This seems to be the only option left:
IT_TEMP[] = LT_LEGLRGI[].
DELETE FROM IT_TEMP WHERE NOT SCRVT IS INITIAL.
and now,
SELECT * FROM /sapsll/adrcon INTO TABLE lt_adrcon_tmp
FOR ALL ENTRIES IN <b>IT_TEMP</b>
WHERE adrnr EQ lt_leglrgi-adrnr
AND lgreg EQ lt_leglrgi-lgreg.
Hope this helps.
Sudha