‎2008 Jun 27 9:48 PM
Hi Experts,
My loop statement doesn't kindly suggest what am missing here.
Thanks, will appreciate your response.
TYPES: BEGIN OF lty_matnr,
matnr TYPE /sapapo/matnr,
END OF lty_matnr.
DATA: lt_matnr TYPE STANDARD TABLE OF lty_matnr WITH HEADER LINE,
ls_matnr TYPE lty_matnr.
Loop at lt_matnr[]. " THIS DOESN'T WORK"
ls_content_query-matnr_rng-high = lt_matnr-high.
ls_content_query-matnr_rng-low = lt_matnr-low.
ls_content_query-matnr_rng-sign = lt_matnr-sign.
ls_content_query-matnr_rng-option = lt_matnr-option.
append ls_content_query-matnr_rng.
Clear ls_content_query-matnr_rng.
Endloop.
‎2008 Jun 27 9:52 PM
‎2008 Jun 27 9:55 PM
if i use lt_matnr instead of lt_matnr[] it gives me an error.
Error: lt_matnr doesn;t have a component high
‎2008 Jun 27 9:58 PM
loop at table without the [] is the right way to do it.
Loop at lt_matnr[]. " THIS DOESN'T WORK"
ls_content_query-matnr_rng-high = lt_matnr-high. < your code is erroring here
ls_content_query-matnr_rng-low = lt_matnr-low.
ls_content_query-matnr_rng-sign = lt_matnr-sign.
ls_content_query-matnr_rng-option = lt_matnr-option.
You are already inside the loop. Does the table have a column named high?
‎2008 Jun 27 10:00 PM
it gives me an error at loop it_matnr[] . It says i need to use an assign ,transportation or into wa statement along with it
‎2008 Jun 27 10:03 PM
doh, made a mistake in my last post. I forgot to remove the []. The code should be:
Loop at lt_matnr.
ls_content_query-matnr_rng-high = lt_matnr-high. < your code is erroring here
ls_content_query-matnr_rng-low = lt_matnr-low.
ls_content_query-matnr_rng-sign = lt_matnr-sign.
ls_content_query-matnr_rng-option = lt_matnr-option.
append ls_content_query-matnr_rng.
Clear ls_content_query-matnr_rng.
Endloop.
Can you post the definition for the table lt_matnr?
‎2008 Jun 27 10:06 PM
Kevin is correct. You do not need the Brackets at yout LOOP it_matnr. You do get inside the loop and you error is at the next line of code. Check your struture for it_matnr, does it include a component named HIGH, as well as the other fields?
‎2008 Jun 27 11:50 PM
Hi,
*TYPES: BEGIN OF lty_matnr,
*matnr TYPE /sapapo/matnr,
*END OF lty_matnr.
DATA: lt_matnr TYPE range of matnr,
ls_matnr like line of lt_matnr.
Loop at lt_matnr into ls_matnr.
ls_content_query-matnr_rng-high = ls_matnr-high.
ls_content_query-matnr_rng-low = ls_matnr-low.
ls_content_query-matnr_rng-sign = ls_matnr-sign.
ls_content_query-matnr_rng-option = ls_matnr-option.
append lt_content_query-matnr_rng from ls_content_query. "Declare an internal table of structure ls_content-query.
Clear ls_content_query-matnr_rng.
Endloop.
Regards,
Subramanian
Edited by: Subramanian PL on Jun 27, 2008 3:50 PM
‎2008 Jun 28 12:09 AM
‎2008 Jun 28 4:41 AM
Hi,
When you declare an object as select-options and ranges
then only HIGH and LOW values are possible.
Declare your object type of ranges.
Regards,
Rajitha.
‎2008 Jun 28 5:17 AM
TYPES: BEGIN OF lty_matnr,
matnr TYPE /sapapo/matnr,
END OF lty_matnr.
DATA: lt_matnr TYPE STANDARD TABLE OF lty_matnr ,
ls_matnr TYPE lty_matnr.
Loop at lt_matnr[] into ls_matnr. " THIS DOESN'T WORK"
ls_content_query-matnr_rng-high = lt_matnr-high.
ls_content_query-matnr_rng-low = lt_matnr-low.
ls_content_query-matnr_rng-sign = lt_matnr-sign.
ls_content_query-matnr_rng-option = lt_matnr-option.
append ls_content_query-matnr_rng.
Clear ls_content_query-matnr_rng.
Endloop.
‎2008 Jun 28 5:23 AM
TYPES: BEGIN OF lty_matnr,
matnr TYPE /sapapo/matnr,
END OF lty_matnr.
DATA: lt_matnr TYPE STANDARD TABLE OF lty_matnr WITH HEADER LINE,
ls_matnr TYPE lty_matnr.
Loop at lt_matnr.
ls_content_query-matnr_rng-high = lt_matnr-high.
ls_content_query-matnr_rng-low = lt_matnr-low.
ls_content_query-matnr_rng-sign = lt_matnr-sign.
ls_content_query-matnr_rng-option = lt_matnr-option.
append ls_content_query-matnr_rng.
Clear ls_content_query-matnr_rng.
‎2008 Jun 28 5:32 AM
Hi,
you are looping the body of your internal without any header, so the basic of internal table is that to read a internal table you always req a header line or work area so you have to specify a work area.
say
loop at itab. instead of loop at itab[].
with luck,
pritam.
‎2008 Jun 28 5:32 AM
hi
u r Using
loop at i_iatab[] which signifies whole body of the table not the header line.
PLz use
loop at i_itab.
<statements>
endloop.
This will definately work.
Reward if helpful.
Sumit Agarwal
‎2008 Jun 28 5:37 AM
HI ,
declare your structure as below
TYPES: BEGIN OF lty_matnr,
Sign type c,
option(2) type c,
low TYPE /sapapo/matnr,
high TYPE /sapapo/matnr,
END OF lty_matnr.
or declare
data : lt_matnr type range of matnr.
and check it will work.
Regards
Raj
‎2008 Jun 30 1:35 PM
TYPES: BEGIN OF lty_matnr,
matnr TYPE /sapapo/matnr,
END OF lty_matnr.
DATA: lt_matnr TYPE STANDARD TABLE OF lty_matnr WITH HEADER LINE,
ls_matnr TYPE lty_matnr.
Loop at lt_matnr. " Just Remove the Square Braces it will work"
ls_content_query-matnr_rng-high = lt_matnr-high.
ls_content_query-matnr_rng-low = lt_matnr-low.
ls_content_query-matnr_rng-sign = lt_matnr-sign.
ls_content_query-matnr_rng-option = lt_matnr-option.
append ls_content_query-matnr_rng.
Clear ls_content_query-matnr_rng.
Endloop.