‎2010 Oct 20 6:05 AM
Hi
below select statement's sy-subrc is 4.But entry is in table.
i think something wrong in AND ( OBJCT = LC_REL_STRATEGY and OBJCT = LC_COM_CODE ).
how to rectify this.
SELECT PROFN
AUTH
INTO TABLE I_AUTH
FROM UST10S
FOR ALL ENTRIES IN I_PROFILES
WHERE PROFN = I_PROFILES-PROFILE
AND AKTPS = LC_A
AND ( OBJCT = LC_REL_STRATEGY and OBJCT = LC_COM_CODE ).
‎2010 Oct 20 6:11 AM
Hi,
if LC_REL_STRATEGY and LC_COM_CODE have different contents you will never get data. Maybe you want an OR for either LC_REL_STRATEGY or LC_COM_CODE for OBJCT here.
Regards,
Klaus
‎2010 Oct 20 6:11 AM
Hi,
if LC_REL_STRATEGY and LC_COM_CODE have different contents you will never get data. Maybe you want an OR for either LC_REL_STRATEGY or LC_COM_CODE for OBJCT here.
Regards,
Klaus
‎2010 Oct 20 6:18 AM
Hi Kumar,
Use the IN operator in the select statement.
SELECT PROFN
AUTH
INTO TABLE I_AUTH
FROM UST10S
FOR ALL ENTRIES IN I_PROFILES
WHERE PROFN = I_PROFILES-PROFILE
AND AKTPS = LC_A
AND OBJCT IN ( LC_REL_STRATEGY , LC_COM_CODE ).
IF Either of one value matches with the field value in the table. the record is fetched and sy-subrc will be 0.
Hope it shall be useful .
Regards
Santosh
‎2010 Oct 20 6:20 AM
HI Kumar
I think your query is correct but want to ask some questions.
-does your table I_AUTH containes only two fields ( PROFN and AUTH)?
-what is LC_A? Is it a constant defined with initial value.
some points
-Before using FOR ALL ENTRIES always check whether your table which you are using for all entires is empty or not?
-sort it.
you need to add all the primary keys in your where condition. Like, if you have 5 prim keys and don't want them in your selection, then you need to define constants for those 5 prim keys with their initial values.
like
Constants: C_KEY1 type PRIM_KEY1 value is intial,
C_KEY2 type PRIM_KEY2 value is intial,
C_KEY3 type PRIM_KEY3 value is intial,
C_KEY4 type PRIM_KEY4 value is intial,
C_KEY5 type PRIM_KEY5 value is intial.
Now your query will be like:
SELECT PROFN
AUTH
INTO TABLE I_AUTH
FROM UST10S
FOR ALL ENTRIES IN I_PROFILES
WHERE PROFN = I_PROFILES-PROFILE AND
AKTPS = LC_A AND
OBJCT = LC_REL_STRATEGY and
OBJCT = LC_COM_CODE
prim_key1 GT c_key1
prim_key2 GT c_key2
prim_key3 GT c_key3
prim_key4 GT c_key4
prim_key5 GT c_key5.
Try this and I hope it will resolve your query.
Thanks
Lalit Gupta