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.
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.
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.
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.
Kindly help me to resolve this.