08-21-2015 9:07 PM
Hi Experts
I have issue with my below select query statement. Through there are multiple entries in the Database table for the below selection. But the program is not fetching any entries.
But when the same condition is being passed at table level, Values are being fetched successfully. Kindly try the same program in your Sandbox and let me know how this works.
TABLES: /sapdmc/lsoatt,/sapdmc/lsocod.
TYPES: BEGIN OF ty_tab,
project TYPE /sapdmc/ls_project,
subproj TYPE /sapdmc/ls_project,
object TYPE /sapdmc/ls_project,
posnr TYPE /sapdmc/ls_posnr,
trgstr TYPE /sapdmc/ls_trgstr,
trgfld TYPE /sapdmc/ls_trgfld,
counter TYPE /sapdmc/ls_counter,
line TYPE /sapdmc/ls_line,
uname TYPE uname,
datum TYPE datum,
END OF ty_tab.
PARAMETERS: p_proj TYPE /SAPDMC/LS_PROJECT,
p_subp type /SAPDMC/LS_PROJECT,
p_obj type /SAPDMC/LS_PROJECT.
data: lt_tab2 TYPE STANDARD TABLE OF ty_tab.
SELECT
project
subproj
object
posnr
trgstr
trgfld
counter
line
uname
datum FROM /sapdmc/lsocod INTO TABLE lt_tab2
WHERE project EQ p_proj AND
subproj EQ p_subp AND
object EQ p_obj.
if sy-subrc eq 0.
endif.
08-21-2015 10:00 PM
I tried your report and entries are fetched.
- SE16 30 entries
-Debug of your program : SELECT is fetching 30 entries
08-21-2015 10:18 PM
Hi Rufus,
Can you pls. check if your data is case sensitive ?
Thanking You All..!!
08-23-2015 1:22 PM
Hi Ankit/Chaoukri,
I have even debugged the select query and could not find any difference. The select query is still getting failed and not sure what is the issue with this.
Kindly find the snap which I took while debugging the code. The sy-subrc value is still 4 even though the table has an entry for this. And surprisingly if I replace the AND condition with OR, the select query works, But not sure why its failing for AND.
4
Kindly help me to resolve this.
Regards,
Rufus Samuel
08-23-2015 1:39 PM
08-23-2015 10:53 PM
Hello Samuel,
Your subproject field value in table is 'ASSETS' and your where condition sub project field value is different as per your screen shots.
Thanks,
Sateesh