‎2007 Dec 14 9:47 AM
Hi Folks,
I had declared a range for s_witht and wanna read the table tempx w.r.t to the belnr in printtab and range of values declared in s_witht.
loop at printtab.
READ TABLE TEMPX WITH KEY BELNR = PRINTTAB-BELNR
<b>WITHT IN S_WITHT</b>
MOVE TEMPX-WT_QBSHH TO PRINTTAB-EDUCS.
modify printtab.
endloop.
or
loop at printtab.
READ TABLE TEMPX WITH KEY BELNR = PRINTTAB-BELNR
if tempx-witht in s_witht
MOVE TEMPX-WT_QBSHH TO PRINTTAB-EDUCS.
endif.
modify printtab.
endloop.
But it is not reading the values in the range.Where am I going wrong.
Thanks,
K.Kiran.
‎2007 Dec 14 9:54 AM
Hi,
While selecting data from database table into intarnal table check slect options in where condition.
then do like this
loop at printtab.
READ TABLE TEMPX WITH KEY BELNR = PRINTTAB-BELNR
if sy-subrc eq 0.
MOVE TEMPX-WT_QBSHH TO PRINTTAB-EDUCS.
endif.
modify printtab.
endloop.
Regards,
Prashant
‎2007 Dec 14 9:54 AM
Hi Kiran,
Maybe you can try this:
IF tempx-witht <b>BETWEEN</b> s_witht-low <b>AND</b> s_witht-high.
Process
ENDIF.
I hope it helps you...
Thanks
William Wilstroth
‎2007 Dec 14 9:57 AM
hi Kiran,
by READ TABLE you can only use EQ (or =). IN, NE, etc are not allowed.
ec
‎2007 Dec 14 9:59 AM
Hi kiran,
"second condition looking OK.. try like this..
DATA : idx LIKE sy-tabix.
LOOP AT printtab.
idx = sy-tabix.
READ TABLE tempx WITH KEY belnr = printtab-belnr.
IF sy-subrc EQ = 0.
CHECK tempx-witht IN s_witht.
MOVE tempx-wt_qbshh TO printtab-educs.
MODIFY printtab INDEX idx.
ENDIF.
ENDLOOP.
‎2007 Dec 14 10:05 AM
Hi,
'Read' statement fetches a single record that mathces the key field specification.
You cannot pass a range for 'Read' Statement.
Here is your code...
loop at printtab.
READ TABLE TEMPX WITH KEY BELNR = PRINTTAB-BELNR
if tempx-witht in s_witht
MOVE TEMPX-WT_QBSHH TO PRINTTAB-EDUCS.
endif.
modify printtab.
endloop.
You can modify it as follows.
Instead you can get the range of values into an internal table , say it_range. i.e. it_range will have the range of values of s_witht.
Specify the read statement inside the loop of it_range.
loop at printtab.
loop at it_range into wa_range.
READ TABLE TEMPX WITH KEY BELNR = PRINTTAB-BELNR
witht = wa_range-witht.
MOVE TEMPX-WT_QBSHH TO PRINTTAB-EDUCS.
modify printtab.
endloop.
endloop.
Hope this would solve your purpose...
Message was edited by:
P Sreenivasulu
‎2007 Dec 14 10:06 AM
Hi,
loop at printtab.
READ TABLE TEMPX WITH KEY BELNR = PRINTTAB-BELNR.
if sy-subrc eq 0."Check the sy-subrc here
if tempx-witht in s_witht
MOVE TEMPX-WT_QBSHH TO PRINTTAB-EDUCS.
endif.
modify printtab.
endif.
endloop.
Another way is to try using loop.
loop at TEMPX where BELNR = PRINTTAB-BELNR
and WITHT IN S_WITHT.
...endloop.