‎2007 May 28 8:41 AM
hi all,
my query is like this, i am extracting some data from table bsid.
parameters:p_kunnr like bsid-kunnr
select kunnr zuonr xblnr from bsid into table itab where kunnr = p_kunnr.
its showing dump.error in select statement.
in table bsid suppose customer no is 1(input)
in table we can find 5 custome numbers with 1.
thanks in advance
venkat
‎2007 May 28 8:49 AM
DATA : BEGIN OF itab OCCURS 0,
kunnr LIKE bsid-kunnr,
zuonr LIKE bsid-zuonr,
xblnr LIKE bsid-xblnr,
END OF itab.
PARAMETER : p_kunnr LIKE bsid-kunnr.
SELECT kunnr zuonr xblnr
FROM bsid
INTO TABLE itab
WHERE kunnr = p_kunnr.
IF sy-subrc = 0.
WRITE : 'Success..!'.
ENDIF.this worked for me... check out if this is what u missed the itab declaration.
Regards
Gopi
‎2007 May 28 8:44 AM
Hi,
what is structure of itab,
try, into corressponding field of itab.
regards
deepak
‎2007 May 28 8:45 AM
Hi,
How did you declare the internal table itab..
try using 'into corresponding fields of'
select kunnr zuonr xblnr from bsid into into corresponding fields of table itab where kunnr = p_kunnr. (or)..
declare the internal table only with these three fields..
Regards,
Vidya.
‎2007 May 28 8:45 AM
Hi Venkat,
may be your itab is having different fields than your selction, check it or otherwise put the whole code here.
Reward points if useful.
Regards,
Atish
‎2007 May 28 8:45 AM
what is the structure of itab??
if there are other fields than mentioned in select statement in itab, then try this..
select kunnr zuonr xblnr from bsid into <b>CORRESPONDING FIELDS OF</b> table itab where kunnr = p_kunnr.
‎2007 May 28 8:46 AM
hi
how have you declared your itab? if your internal table declaration order and the order in which you select fields from the database are not of the same sequence, then you have to use "into corresponding fields of" addition in your select
select kunnr zuonr xblnr from bsid into corresponding fields of table itab where kunnr = p_kunnr.
if helpful, reward
Sathish. R
‎2007 May 28 8:47 AM
‎2007 May 28 8:48 AM
Hi
Check the sequence of the fields in Internal table and in the select Query
both should be same
may be you have declared wrongly, the sequence
see the sample select query
Select the Customer Open Items data from bsid
SELECT l~kunnr
l1~name1
b~waers
b~dmbtr
b~zfbdt
b~zbd1t
b~zbd2t
b~zbd3t
b~belnr
b~xblnr
b~shkzg
b~blart
INTO CORRESPONDING FIELDS OF TABLE int_bsid
FROM knb1 AS l INNER JOIN kna1 AS l1
ON lkunnr = l1kunnr
INNER JOIN bsid AS b
ON lkunnr = bkunnr AND
lbukrs = bbukrs
WHERE l~kunnr IN s_kunnr AND
l~bukrs = p_bukrs and
b~zfbdt le p_allgst.
Reward points if useful
Regards
Anji
‎2007 May 28 8:49 AM
DATA : BEGIN OF itab OCCURS 0,
kunnr LIKE bsid-kunnr,
zuonr LIKE bsid-zuonr,
xblnr LIKE bsid-xblnr,
END OF itab.
PARAMETER : p_kunnr LIKE bsid-kunnr.
SELECT kunnr zuonr xblnr
FROM bsid
INTO TABLE itab
WHERE kunnr = p_kunnr.
IF sy-subrc = 0.
WRITE : 'Success..!'.
ENDIF.this worked for me... check out if this is what u missed the itab declaration.
Regards
Gopi
‎2007 May 28 9:16 AM
hi all,
thanks for ur response
my requirement is like this,
i had to extract
input is kunnr(parameter)
kunnr,name1,name2,adrnr from kna1
and kunnr zuonr,bldat,xblnr,wrbtr from bsid
and bktxt from bkpf
output table
kunnr name1 name2 adrnr zuonr bldat xblnr wrbtr bktxt
‎2007 May 28 9:21 AM
Hi
<b>Select
akunnr aname1 aname2 aadrnr
bzuonr bbldat bxblnr bwrbtr
c~bktxt
Into table ITAB
from kna1 as a join bsid as b
on akunnr = bkunnr join bkpf as c
on bbelnr = cbelnr and
bgjahr = cgjahr and
bbukrs = cbukrs
where a~kunnr = p_kunnr.</b>
Reward points if useful
Regards
Anji
‎2007 May 28 9:24 AM
selct a~kunnr
a~zuonr
a~bldat
a~xblnr
a~wrbtr
b~name1
b~name2
b~adrnr
into corresponding fields of itab
from bsid as a inner join kna1 as b
on akunnr = bkunnr
where a~kunnr = p_kunnr.
regards,
Vidya.
‎2007 May 28 9:28 AM
declare the internal tables accordingly.
PARAMETER : p_kunnr LIKE bsid-kunnr.
SELECT kunnr belnr zuonr bldat xblnr wrbtr
FROM bsid
INTO TABLE itab
WHERE kunnr = p_kunnr.
SELECT kunnr name1 name2 adrn
FROM kna1
INTO TABLE it_kna1
FOR ALL ENTRIES IN it_bsid
WHERE kunnr = it_bsid-kunnr.
SELECT belnr bktxt
FROM bkpf
INTO TABLE it_bkpf
FOR ALL ENTRIES IN it_bsid
WHERE belnr = it_bsid-belnr.
LOOP AT it_bsid.
move-corresponding it_bsid into it_final.
READ TABLE it_kna1 WITH KEY kunnr = it_bsid-kunnr.
IF sy-subrc = 0.
MOVE it_kna1-name1 TO it_final-name1.
MOVE it_kna1-it_kna1-name2 TO it_final-name2.
MOVE adrnr TO it_final-adrnr.
ENDIF.
READ TABLE it_bkpf WITH KEY belnr = it_bsid-belnr.
IF sy-subrc = 0.
MOVE it_bkpf-bktxt TO it_final-bktxt.
ENDIF.
APPEND it_final.
ENDLOOP.Regards
Gopi
‎2007 May 28 9:36 AM
REPORT ZNN001_OTHERS.
data itab type STANDARD table OF bsid.
parameters:p_kunnr like bsid-kunnr.
select kunnr zuonr xblnr from bsid into corresponding fields of table itab where kunnr = p_kunnr.
REWARDS IF HELPFUL