‎2006 Aug 31 9:32 PM
Hi all,
The following is a piece of code i have in a program.
But I cant see any data is getting fetched into itab "i_vbak" although there is data for this.
I ran it in debug mode to see.
Anybody please suggest me what went wrong with this.
<b>tables: vbak,
vbap.
parameters: p_matnr like vbap-matnr obligatory,
p_charg like vbap-charg obligatory,
p_kunnr like vbak-kunnr.
select-options: s_audat FOR vbak-audat.
data: begin of i_vbak occurs 0,
vbeln like vbak-vbeln,
bstnk like vbak-bstnk,
end of i_vbak.
select vbakvbeln vbakbstnk
into table i_vbak
from vbak inner join
vbap
on vbakvbeln = vbapvbeln
where vbap~matnr = p_matnr
and vbap~charg = p_charg
and vbak~kunnr = p_kunnr
and vbak~audat IN s_audat.</b>
Thanks a lot,
Message was edited by: sam jose
‎2006 Aug 31 9:35 PM
Hi,
If the parameters are not mandatory..Then it will blank values in the table VBAP..
Use SELECT-OPTIONS p_matnr NO-EXTENSION NO INTERVALS..
This way it will allow only single value..
And modify the your query to
<b> vbap~matnr IN p_matnr</b> instead of "="
Thanks,
Naren
‎2006 Aug 31 9:38 PM
‎2006 Aug 31 9:35 PM
There does not seem anything wrong with the query just check if there are records for the particular selection in your vbak/vbap table.
Secondly, the problem can be related to format of the fields(basically the data content like leading zeroes etc).
Regards
Anurag
‎2006 Aug 31 9:39 PM
Anurag,
I have even checked it with the correct format of the data for selection-screen.
Thnx.
‎2006 Aug 31 9:42 PM
Sam,
Hmm..interesting, as there is nothing wrong with the querry. I would suggest to check with one where condition at a time and see if it is fetching data..by that you would be able to find the cause !!
I mean just use matnr first and if it does fetch data try with matnr and charg ...etc. I presume that you are feeling all your parameters as if you leave it blank it will try and check for blank data.
Message was edited by: Anurag Bankley
Message was edited by: Anurag Bankley
‎2006 Aug 31 9:37 PM
change the select to
select a~vbeln a~bstnk
into table i_vbak
from vbak as a
inner join vbap as b
on a~vbeln = b~vbeln
where b~matnr = p_matnr
and b~charg = p_charg
and a~kunnr = p_kunnr
and a~audat IN s_audat.
~Suresh
‎2006 Aug 31 9:43 PM
Hi,
How about customer..
<b>p_kunnr like vbak-kunnr</b>
Is customer also mandatory..
Thanks,
Naren
‎2006 Aug 31 9:46 PM
Nope.
<b>P_kunnr</b> and <b>s_audat</b> are not mandatory.
Thnx.
‎2006 Aug 31 9:47 PM
Hi Sam,
1) I doubt have you specified START-OF-SELECTION in your report.
If not have START-OF-SELECTION before your SELECT query.
2) Did you leave KUNNR field empty while running the report. If so, it wont fetch any data.Specify some value to KUNNR field.
Thanks,
Vinay
‎2006 Aug 31 9:49 PM
Hi,
That is the reason why you are not getting any records..
Since the customer is blank..it will look for records with blank values..
Instead use select-options for the customer as I mentioned above..
Please reward the points if it is helpful..
Thanks,
Naren
‎2006 Aug 31 9:57 PM
I hve specified "Start-of-selection" also in code.
Narendran,
Thanks for the response.
The user wants to get the data based on "MATNR" and "CHARG". He also wants to see the data by "KUNNR" sometimes. That's the reason I have the "P_KUNNR" on the selection-screen.
In that case how should design the selection-screen.
Plz advise.
Thnx.
‎2006 Aug 31 9:59 PM
The best is to define it as a select-option with no intervals.
and in select query use vbak~kunnr in s_kunnr.
OR
Define a range for customer
Range : r_kunnr for vbak~kunnr.
if p_kunnr ne space.
r_kunnr-low = p_kunnr.
r_kunnr-sign = 'I'
r_kunnr-option = 'EQ'.
append r_kunnr.
endif.
SELECT ...
where..
vbak~kunnr in r_kunnr.
Regards
Anurag
Message was edited by: Anurag Bankley
‎2006 Aug 31 9:58 PM
Hi,
Use SELECT-OPTIONS p_KUNNR for vbak-kunnr NO INTERVALS NO-EXTENSION ..
And change the query to IN P_KUNNR instead of = P_KUNNR..
Thanks,
Naren