Application Development and Automation 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: 
Read only

Maintaining range

Former Member
0 Likes
952

Hi,

in my requiremnet

i have to write the below logic

use table view ZV_MAST_STKO to perform initial select for BoM materials to be exploded using supplied selection criteria. Use a select similar to that below. Create a range r_lkenz to assign value NE u2018Xu2019 if u2018Exclude deleted BOMsu2019 checked(check box)

SELECT * FROM zv_mast_stko

INTO CORRESPONDING FIELDS OF TABLE gt_mast

WHERE matnr IN s_matnr

AND werks IN s_werks

AND stlal EQ p_stlal

AND stlst EQ p_stlst

AND lkenz IN r_lkenz.

could u please guide me little elaborately how to achieve this??

Please help

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
920

Hi,

I think so range is not required, try using this code...

SELECT * FROM zv_mast_stko

INTO CORRESPONDING FIELDS OF TABLE gt_mast

WHERE matnr IN s_matnr

AND werks IN s_werks

AND stlal EQ p_stlal

AND stlst EQ p_stlst

AND lkenz = ' '.

Hope it helps you,

Regards,

Abhijit G. Borkar

9 REPLIES 9
Read only

former_member770378
Active Participant
0 Likes
920

I don't understand

can you explain ?

Read only

0 Likes
920

Hi,

How to write range??means how to maintain NE x.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
920

data:r_lkenz type range of zv_mast_stko-lkenz.

data:wa like line of r_lkenz.

wa-option = 'EQ'.

wa-sign = 'E'.

wa-low = 'X'.

append wa to r_lkenz.

SELECT * FROM zv_mast_stko

INTO CORRESPONDING FIELDS OF TABLE gt_mast

WHERE matnr IN s_matnr

AND werks IN s_werks

AND stlal EQ p_stlal

AND stlst EQ p_stlst

AND lkenz IN r_lkenz.

Read only

0 Likes
920

Thanks very much.

one more doubt.In my view there is one record with lkenz value is "X".

but i dont know why in this case also select statement fetching record.because i maintained in range that r_lkenz ne 'X'.

Please help..

Read only

0 Likes
920

Some tips:

Sign is always I (for Include) or E (for Exclude)

Option can be a whole range, which includes:

EQ (Equal)

BT (Between))

CP (Contain Pattern)

So let's say you want to have the range check for all company codes not starting with AB, you will set your code as follow:

ranges: bukrs for zstock-bukrs. 
  
bukrs-sign = 'E'.             "Exclude 
bukrs-option = 'CP'.        "Pattern 
bukrs-low = 'AB*'.            "Low Value 
bukrs-high = ''.                "High Value 
append bukrs. 

Always remember to APPEND your range when you fill it, as the WHERE clause checks against the lines of the range table, not against the header line.

Hope this explains it well enough.

Read only

0 Likes
920

instaed of range

just pass

AND lkenz = space.

Read only

0 Likes
920

Last doubt.

i am writting like this

wr_lkenz-sign = 'I'.

*wr_lkenz-option = 'NE'

.* wr_lkenz-low = 'X'.

APPEND wr_lkenz TO r_lkenz.

CLEAR wr_lkenz.

But till the record is fetching in my where condition.

please answer me . awaiting for ur reply

Read only

0 Likes
920

Hi asis,

In that case range is not required.

Use SPACE instead of 'X'.

AND lkenz = ' '.

Manas M.

Edited by: Kumar Manas Mishra on Jan 29, 2010 12:53 PM

Edited by: Kumar Manas Mishra on Jan 29, 2010 12:53 PM

Read only

Former Member
0 Likes
921

Hi,

I think so range is not required, try using this code...

SELECT * FROM zv_mast_stko

INTO CORRESPONDING FIELDS OF TABLE gt_mast

WHERE matnr IN s_matnr

AND werks IN s_werks

AND stlal EQ p_stlal

AND stlst EQ p_stlst

AND lkenz = ' '.

Hope it helps you,

Regards,

Abhijit G. Borkar