Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue With Select Query

former_member462348
Participant
0 Kudos

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.

5 REPLIES 5

chaouki_akir
Contributor
0 Kudos

I tried your report and entries are fetched.

- SE16 30 entries

-Debug of your program : SELECT is fetching 30 entries

Former Member
0 Kudos

Hi Rufus,

Can you pls. check if your data is case sensitive ?

Thanking You All..!!

0 Kudos

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

JL23
Active Contributor
0 Kudos

´What is ASSESTS? Do you think this is equal to ASSETS?

0 Kudos

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