2013 Sep 04 1:30 PM
Hi Experts,
I am new to ABAP. The dump shows that the mistake in the select statement, I checked few codes, I think it is right but still giving dump of dbif_rsql_invalid_rsql. Please guide me where I am lacking.
The requirement is that I need to get tcode field from bkpf table so I have connected it to bsak. Is the connection wrong?
select bukrs
lifnr
budat
wrbtr
belnr
shkzg
zuonr
umskz
sgtxt
gjahr
from bsak
into table it_bsak
where bukrs in s_bukrs and lifnr in s_lifnr and budat in s_date.
if not it_bsak is INITIAL.
select bukrs belnr tcode
from bkpf
INTO table it_bkpf
FOR ALL ENTRIES IN it_bsak
where bukrs = s_bukrs and belnr = it_bsak-belnr.
endif.
Regards
Mani
Hi Experts,
I am new to ABAP. The dump shows that the mistake in the select statement, I checked few codes, I think it is right but still giving dump of dbif_rsql_invalid_rsql. Please guide me where I am lacking.
The requirement is that I need to get tcode field from bkpf table so I have connected it to bsak. Is the connection wrong?
select bukrs
lifnr
budat
wrbtr
belnr
shkzg
zuonr
umskz
sgtxt
gjahr
from bsak
into table it_bsak
where bukrs in s_bukrs and lifnr in s_lifnr and budat in s_date.
if not it_bsak is INITIAL.
select bukrs belnr tcode
from bkpf
INTO table it_bkpf
FOR ALL ENTRIES IN it_bsak
where bukrs = s_bukrs and belnr = it_bsak-belnr.
endif.
Regards
Mani
2013 Sep 04 2:44 PM
Hi Mani,
in the dump, trans ST22, SAP put an arrow where the program dump. What is this line
maybe your table IT_BSAK didn't have the same number of columns ... try to replace : INTO TABLE IT_BSAK by INTO CORRESPONDING FIELDS OF TABLE IT_BSAK
regards
Fred
2013 Sep 04 2:49 PM
Please, post your DUMP report. Probably your query is resulting in too much records.
Dump is occurring at the first or the second select statement?
The WHERE clause of the BKPF selection is wrong on the BUKRS field. Change the '=' to 'IN' and test it again.
2013 Sep 04 2:57 PM
2013 Sep 04 3:27 PM
Hi,
the mismatch is in this code:
if not it_bsak is INITIAL.
select bukrs belnr tcode
from bkpf
INTO table it_bkpf
FOR ALL ENTRIES IN it_bsak
where bukrs = s_bukrs and belnr = it_bsak-belnr.
endif.
You try with this code:
if not it_bsak[] is INITIAL.
select bukrs belnr tcode
from bkpf
INTO table it_bkpf
FOR ALL ENTRIES IN it_bsak
where bukrs IN s_bukrs
and belnr = it_bsak-belnr
and gjahr = it_bsak-gjahr.
endif.
Regards
Ivan
2013 Sep 05 4:17 AM
Hi,
I appreciate your replies. Please check the following screenshot:
Please do let me know if any other screenshot is required?
Regards
Mani
2013 Sep 05 4:57 AM
Hi Mani,
After corrections as suggested by the experts above, if still it doesn't solve, please check the target locations (it_bsak/it_bkpf). I recently faced this error. If the dump is coming in the first query then check the structure of it_bsak and it the dump is coming in the second query then check structure of it_bkpf.
Please check the order of the fields in the structure with the select query and the data types of fields with the fields in the select query. Can you show us the structures and and the error analysis in the dump?
Regards
Purnand
2013 Sep 05 5:07 AM
Hi Mani,
Correct like this
select bukrs
lifnr
budat
wrbtr
belnr
shkzg
zuonr
umskz
sgtxt
gjahr
from bsak
into table it_bsak
where bukrs in s_bukrs and lifnr in s_lifnr and budat in s_date.
if not it_bsak is INITIAL.
select bukrs belnr tcode
from bkpf
INTO table it_bkpf
FOR ALL ENTRIES IN it_bsak
where bukrs = s_bukrs
where bukrs in s_bukrs
and belnr = it_bsak-belnr.
endif.
2013 Sep 05 5:11 AM
HI mani,
You have to change the '=' sign with IN in the second select statement. and also you have to add extra where claues in that statement , as the table bkpf also has the primary key gjahr so you have to add it.
SELECT bukrs belnr tcode
FROM bseg
INTO TABLE it_bkpf
FOR ALL ENTRIES IN it_bsak
WHERE bukrs IN s_bukrsAND
belnr EQ it_bkpf-belnr AND
gjahr EQ it_bkpf-gjahr.
Regards,
Sivaganesh
2013 Sep 05 7:44 AM
Hi mani,
Replace : INTO TABLE IT_BSAK by INTO CORRESPONDING FIELDS OF TABLE IT_BSAK in the first select query
and sort the table it_bsak
replace in second select query
INTO table it_bkpf by INTO CORRESPONDING FIELDS OF TABLE it_bkpf.
write like below
select bukrs
lifnr
budat
wrbtr
belnr
shkzg
zuonr
umskz
sgtxt
gjahr
from bsak
into corresponing fields of table it_bsak
where bukrs in s_bukrs and lifnr in s_lifnr and budat in s_date.
if not it_bsak is INITIAL.
sort it_bsak by bukrs.
select bukrs belnr tcode
from bkpf
INTO corresponing fields of table it_bkpf
FOR ALL ENTRIES IN it_bsak
where bukrs IN s_bukrs and belnr = it_bsak-belnr and gjahr = it_bsak-gjhar.
endif.
2013 Sep 05 8:05 AM
Thank you experts. I had written belnr type belnr instead of belnr type belnr_d. But there were one more mistake that I had written bukrs = s_bukrs instead of bukrs in s_bukrs.
I would like to thank all the experts above for taking time to read, understand and answer my query. I am very happy. This is a great website.
Cheers
Mani
2013 Sep 05 9:43 AM
Also :
Regards,
Raymond
2013 Sep 05 12:18 PM
Hi Raymond,
Added both the points. I am sure the select query is more strong now.
Thanking you
Mani
2013 Sep 05 8:09 AM
hi,
check the structure of the target field and also check the order of selected fields....
sharmistha
2013 Sep 05 8:19 AM
2013 Sep 05 12:38 PM
Hi Mani,
Please check carefully before posting thread in SCN. Since SAP is having 45 years of history almost all the solutions are available for the Queries.
You missed the basic thing that instead of using IN Operator you used = for S_BUKRS. so be cautious.
Welcome to SCN.
Thanks
Pavan.N
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |