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 option using NP operator

Former Member
0 Kudos

Hi all,

there is a issue with select option having NP operator.

It does not excludes all the value , instead it includes all the value.

the issue happens if we have 2 line item of NP operator.

Below is the sample code.

Kindly suggest.

DATA: lt_user1 TYPE grac_rt_user,

       ls_user1 TYPE grac_rs_user.

DATA:it_user_group TYPE grac_rt_user_group.

DATA: lt_conn_range TYPE grac_rt_connector,

       ls_conn_range TYPE grac_rs_connector.

    DATA lt_temp_user       TYPE grac_t_user.

ls_user1-sign = 'I'.  

ls_user1-option = 'NP'.

ls_user1-low = 'FF*'.

APPEND ls_user1 TO lt_user1.

ls_user1-sign = 'I'.  

ls_user1-option = 'NP'.

ls_user1-low = 'KB*'.

APPEND ls_user1 TO lt_user1.

ls_conn_range-sign = 'I'.

ls_conn_range-option = 'EQ'.

ls_conn_range-low = 'GI7CLNT600'.

APPEND ls_conn_range TO lt_conn_range.

SELECT * FROM gracuserconn

  INTO CORRESPONDING FIELDS OF TABLE lt_temp_user ##too_many_itab_fields

* FOR ALL ENTRIES IN lt_user1

  WHERE user_id in lt_user1 "it_user

  AND user_group IN it_user_group

    AND connector IN lt_conn_range.


Regards

Aravindan


6 REPLIES 6

former_member249399
Active Participant
0 Kudos

please try with

ls_user1-sign = 'E'.  

ls_user1-option = 'CP'.

ls_user1-low = 'FF*'.

APPEND ls_user1 TO lt_user1.

ls_user1-sign = 'E'.  

ls_user1-option = 'CP'.

ls_user1-low = 'KB*'.

APPEND ls_user1 TO lt_user1.

0 Kudos

Hi Ranjana,

It works if i use with SIGN E and Option CP.

I just want to know why its not working with NP , if its having 2 line items.

In case of 1 line item it works.

Or any other work around in select query.

Best Regards

Aravindan M

0 Kudos

The reason I think is you have included two values with NP in  lt_user1, which indicates an OR condition. so it selects any record which does not have pattern as FF* OR KB* with AND condition for the GI7CLNT600.



If you want to exclude all the records which have FF*/KB* then try


ls_user1-sign = 'I'.  

ls_user1-option = 'NP'.

ls_user1-low = 'FF*'.

APPEND ls_user1 TO lt_user1.

ls_user1-sign = 'I'.  

ls_user1-option = 'NP'.

ls_user1-low = 'KB*'.

APPEND ls_user1 TO lt_user2.

SELECT * FROM gracuserconn

  INTO CORRESPONDING FIELDS OF TABLE lt_temp_user ##too_many_itab_fields

* FOR ALL ENTRIES IN lt_user1

  WHERE user_id in lt_user1 "it_user

   and user_id in lt_user2

  AND user_group IN it_user_group

    AND connector IN lt_conn_range.

Hope it helps.

Regards

0 Kudos

Hi Abhijit,

Thanks for you reply.

In my case the input parameter comes dynamically.

the line item in lt_user1(select option) may be 1 , 2 or 3 .

as it depends on how user provides input.

Best Regards

Aravindan M

0 Kudos

What I am trying to put across is, if your internal table it_user1 contains multiple line conditions they are treated as OR condition rather than AND condition which possibly brings in more values.

pasumpon_karuppaiah
Participant
0 Kudos

Hi ,

I had the same issue , 

As suggested by ranju , you can use below set of code.

which solved my issue..

ls_user1-sign = 'E'

ls_user1-option = 'CP'.

ls_user1-low = 'FF*'.

APPEND ls_user1 TO lt_user1.

ls_user1-sign = 'E'

ls_user1-option = 'CP'.

ls_user1-low = 'KB*'.

APPEND ls_user1 TO lt_user1.