‎2007 Jul 24 6:00 PM
SELECT lifnr
matnr
kbetr
INTO CORRESPONDING FIELDS OF TABLE t_data
FROM zitdata
WHERE lifnr = p_lifnr.
LOOP AT t_data .
r_matnr-sign = 'I' .
r_matnr-option = 'EQ' .
r_matnr-low = t_data-matnr .
APPEND r_matnr .
ENDLOOP.
SELECT mblnr
matnr
menge
INTO TABLE data_menge
FROM mseg
FOR ALL ENTRIES IN lt_data
WHERE mblnr = lt_data-mblnr
AND matnr IN r_matnr
.
‎2007 Jul 24 6:51 PM
Hi,
All Material code selected from table zitdata is alocate in Range r_matnr. Thus, we can control value interval.
Exemple:
Select material code equal 100.
r_matnr-sign = 'I' .
r_matnr-option = 'EQ' .
r_matnr-low = 100.
Select material code betwen 200 and 300.
r_matnr-sign = 'I' .
r_matnr-option = 'BT' .
r_matnr-low = 200.
r_matnr-hight = 300.
Select material code less them 010.
r_matnr-sign = 'I' .
r_matnr-option = 'LT' .
r_matnr-low = 010.
Regards.
Marcelo Ramos
‎2007 Jul 24 6:08 PM
Basically you are getting material document line items from MSEG for all materials that are listed for a particular vendor in your custom table ZITDATA.
‎2007 Jul 24 6:08 PM
you are selecting lifnr, matnr, kbetr from the database table zitab into the internal table t_data based on the lifnr given in the selection scree.
you are intialising the values of r_matnr-sign, r_matnr, option, r_matnr-low.
then you are selecting mblnr, matnr, menge for all entries in lt_data into data_menge depending on the values of mblnr in the internal table lt_data and the values of matnr in r_matnr.
<b>if u giv the entire code explanation can be more specific.</b>
regards,
srinivas
<b>*reward for useful answers*</b>
‎2007 Jul 24 6:15 PM
Thanks Srinivas for ur reply , please tell me the use of ranges in this . if u want i can send u the entire code to ur mail
‎2007 Jul 24 6:51 PM
Hi,
All Material code selected from table zitdata is alocate in Range r_matnr. Thus, we can control value interval.
Exemple:
Select material code equal 100.
r_matnr-sign = 'I' .
r_matnr-option = 'EQ' .
r_matnr-low = 100.
Select material code betwen 200 and 300.
r_matnr-sign = 'I' .
r_matnr-option = 'BT' .
r_matnr-low = 200.
r_matnr-hight = 300.
Select material code less them 010.
r_matnr-sign = 'I' .
r_matnr-option = 'LT' .
r_matnr-low = 010.
Regards.
Marcelo Ramos
‎2007 Jul 25 4:28 AM
first the data fetch is made into an itab.
then the matnr from that itab is stored into ranges.
you can use this ranges in any select queries with in statement where ever u need to fetch data based on that matnr.
this avoids looping at t_data and passing each matnr.
in the second select it will only take the mblnr for the matnr in the ranges and the occurence of mblnr in lt_data.
this wiil improve the performance while fetching data from mseg because its a huge table.
‎2007 Jul 25 4:31 AM
you can declare ranges in two three ways.
ranges: r_matnr for marc-matnr,
r_dat for mkpf-budat.
r_matnr-option = 'EQ'.
r_matnr-sign = 'I'.
r_dat-option = 'BT',
r_dat-sign = 'I'.
while appending data to r_dat.u can appen it to low and high and specify "in" in select statements......it will take all the values between low and high.
earlier one is as the same...hope so u got the difference