‎2009 Jan 20 11:20 AM
hi,
the selection-screen has the fields invoice number,invoice date and customer name.
date is mandatory..now i have to fetch the data based on the selection.
if only date is selected,then i have to print the entrie data from that date.
how to write select statement for this??..
thanks
Sri
‎2009 Jan 20 11:35 AM
Hi Sri,
Hope you declared all the selction fields as PARAMETERS.
Build RANGES tables for Invoice number and Customer name if any value entered is entered on selection screen and at the same time build another ranges table for even Invoice date also with R_DATE-OPTION = EQ.
Incase Invoice number and Customer name is empty then build an Ranges table (R_date) for Invoice date with R_DATE-OPTION = GE..
Now, write the select query using the above ranges tables.
Regards,
Arun
‎2009 Jan 20 11:24 AM
select invoice number invoice date customer name
from table into table itab where date in s_dat
Edited by: Kalyan Chakravarthi on Jan 20, 2009 12:24 PM
Edited by: Kalyan Chakravarthi on Jan 20, 2009 12:28 PM
‎2009 Jan 20 11:32 AM
The selection-screen contains invoice number and date as select-options and customer name as parameter.date field is mandatory.
now how to display the data i.re. invoice number,invoice date,customer number,customer name, quantity,amount based on the selection of these three fields (here we may select or may not select the invoice number and customer name)?...
the tables used are vbrk,vbrp and kna1.
Edited by: Sri on Jan 20, 2009 12:33 PM
Edited by: Sri on Jan 20, 2009 12:36 PM
‎2009 Jan 20 11:40 AM
Hi,
use this code:
select invoiceno invoicedate customername amount quantity from <dbtable> into table <internaltable>
where date in s_date
and invoiceno in s_invoice
and cutomername eq p_customername.
Hope this helps u.
Thanks.
‎2009 Jan 20 11:42 AM
Hi,
Take a look at the standard transaction VF05. This report is exactly what you want.
regards,
Advait
‎2009 Jan 20 11:46 AM
select-options : s_vbeln for vbrk-vbeln,
s_date for vbrk-fkdat OBLIGATORY.
parameters: p_kunnr type kna1-kunnr.
START-OF-SELECTION.
select vbeln fkdat kunrg ... from vbrk
into table it_vbrk
where vbeln in s_vbeln
and fkdat in s_date
and kunrg = p_kunnr.
fetch the rest of the details from vbrp and kna1...
‎2009 Jan 20 11:24 AM
u mite have declared date parameter like dis:
PARAMETERS:p_date TYPE date OBLIGATORY.
if so...it ll automatically take care of the mandatory ....
ie if user dint put any input in dat...it ll giv an error message to enter all required fields.
‎2009 Jan 20 11:25 AM
Hi,
Declare everything as select options:
select-options : s_vbeln for vbrk-vbeln,
s_date for vbrk-fkdat,
s_kunnr for kna1-kunnr.
select <data> from table< db table> into table itab
where vbeln in s_vbeln
and date in s_date
and kunnr in s_kunnr.
Regards,
Nagaraj
‎2009 Jan 20 11:32 AM
Hi,
See the following sample prg:
TABLES: vttk.
SELECT-OPTIONS: date FOR vttk-erdat.
types: BEGIN OF x_it,
tknum TYPE vttk-tknum,
vbtyp TYPE vttk-vbtyp,
erdat TYPE vttk-erdat,
END OF x_it.
DATA: it TYPE STANDARD TABLE OF x_it,
wa like LINE OF it.
SELECT tknum vbtyp erdat FROM vttk
INTO TABLE it WHERE erdat in date.
LOOP AT it INTO wa .
WRITE:/ wa-tknum,
wa-vbtyp,
wa-erdat.
ENDLOOP.
Hope this helps u.
Thanks.
‎2009 Jan 20 11:35 AM
Hi Sri,
Hope you declared all the selction fields as PARAMETERS.
Build RANGES tables for Invoice number and Customer name if any value entered is entered on selection screen and at the same time build another ranges table for even Invoice date also with R_DATE-OPTION = EQ.
Incase Invoice number and Customer name is empty then build an Ranges table (R_date) for Invoice date with R_DATE-OPTION = GE..
Now, write the select query using the above ranges tables.
Regards,
Arun
‎2009 Jan 20 11:38 AM
only customer name is parameters field.
can u give an idea how to create a ranges table?..
‎2009 Jan 20 11:47 AM
HI Sri,
RANGES: r_kunnr FOR KNA1-KUNNR.
IF p_kunnr is not initial.
r_kunnr-option = 'EQ'.
r_kunnr-sign = 'I".
r_kunnr-low = p_kunnr.
APPEND r_kunnr.
endif.
Regards,
Arun
‎2009 Jan 20 11:49 AM
Hi,
PLEASE NOTE that it is preferable not to use parameters for KUNNR since it is not mandatory,
so when KUNNR is not filled the where statement
KUNNR = P_KUNNR will not return any record.
Better use the following:
select-options : s_vbeln for vbrk-vbeln,
s_date for vbrk-fkdat,
s_kunnr for kna1-kunnr NO INTERVALS NO-EXTENSION.
Select *
from TABLE
where vbeln in s_vbeln
and fkdat in s_date
and kunnr in s_kunnr.
Regards,
Dev.
Edited by: Dev Parbutteea on Jan 20, 2009 12:50 PM