08-30-2007 6:03 AM
Hi experts
I am using the following code for retriving the total sales order stock for the material. but it goes for dump, how to correct this query.
loop at itab1.
select matnr
kalab
KAINS
kaspe
from mska
into
(itab1-matnr , itab1-kalab , itab1-KAINS , itab1-kaspe)
where matnr = itab1-matnr.
modify itab1.
endselect.
endloop.
Pls advise me on the same.
Thanks in advance.
Regards
Rajaram
08-30-2007 6:10 AM
Hi
loop at itab1.
select matnr
kalab
KAINS
kaspe
from mska
into <b>ITAB!</b>
where matnr = <b>u can't pu itab1 value here put some value or selection screen parameters .</b>
modify itab1.
endselect.
endloop.
reward if usefull
08-30-2007 6:11 AM
hi,
try changing the modify statement to:
modify itab1 index sy-tabix.
regards,
Navneeth K.
08-30-2007 6:30 AM
problem is wid modify statement
use sy-tabix
or use
modify wid from addtion
08-30-2007 6:33 AM
your where condition is also not right
as u r fethchig data into itab1-matnr and in the next line u r comparing it
but itab1-matnr wil contain data after the append or modify statement
or tell us that is there any data in itab1-matnr?????
if yes then y r u modifying this in the select statement
chk ur where condtion it wil resolve ur prob
08-30-2007 6:29 AM
hi
good
the where condition that you r given in your select statement is not correct,go through the code and change that accordingly,
go through the dump details properly ,you can understand the detail error.
thanks
mrutyun^
08-30-2007 6:31 AM
Hi,
What is the dump? Please let us know.
It may be a performance issue. If possible take the table out of loop and join with previous table.
also you are using itab1-matnr in where clause as well as into clause this may be reason for dump.
if u can post the details about the dump, then it will be clear.
08-30-2007 6:50 AM
Try this.Reward poits if useful.
data : my_tabix type sy-tabix.
loop at itab1.
clear my_tabix.
my_tabix = sy-tabix.
select matnr
kalab
KAINS
kaspe
from mska
into
(itab1-matnr , itab1-kalab , itab1-KAINS , itab1-kaspe)
where matnr = itab1-matnr.
modify itab1 index my_tabix.
endselect.
endloop.
08-30-2007 6:51 AM
HI,
short dump may be of 2 reasons
1. the internal table fields order and fields in the select statement which u gave may be of different order.
2. ur selecting data from database table to internal and in where condition u gave internal table field. that internal table field is empty bcoz it doesnt have any data.
check that one also.
Select matnr
kalab
KAINS
kaspe
from mska
into
(itab1-matnr , itab1-kalab , itab1-KAINS , itab1-kaspe)
where matnr = itab1-matnr. // only this statement works if u have data in internal table other wise declare a parameter and compare with matnr in where copndition of select statement as
Select matnr
kalab
KAINS
kaspe
from mska
into
(itab1-matnr , itab1-kalab , itab1-KAINS , itab1-kaspe)
where matnr = p_matnr // parameter declared.
if helpful reward some points.
with regards,
Suresh Aluri.
08-30-2007 7:21 AM
select matnr
werks
lgort
charg
sobkz
vbeln
posnr
kalab
KAINS
kaspe
from mska
into corresponding fields of table i_mska
for all entries in itab1
where matnr = itab1-matnr.
Please look this query, i think ur first point may be the reason for my case.
this is the order am retriving data but in the table also same order, pls clarify why it goes to dump.
Regards
Rajaram
08-30-2007 7:26 AM
Hi ,
there are two problems in code.
1. u cannoot use itab1-matnr for select statement(but this is not the reason for dump.)
2. modify to be used needs index or key to be specified always. without that the program goes to dump.
give index or key with modify and the problem is solved.
PLEASE REWARD ME FOR SUCH CLEAR ANSWER IF HELPFUL
08-30-2007 7:32 AM
SELECT aufnr
baugr
matnr
meins
bdmng
FROM resb
INTO CORRESPONDING FIELDS OF TABLE itab1
FOR ALL ENTRIES IN itab
WHERE aufnr = itab-aufnr.
but this query is working fine, here i have used itab, then why can't we use itab1 in the first case.
how to use modify with index, should we put a loop , pls explain this.
Regards
Rajaram