Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

report on selection-screen fields

Former Member
0 Likes
3,184

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,981

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

12 REPLIES 12
Read only

Former Member
0 Likes
1,981

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

Read only

0 Likes
1,981

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

Read only

0 Likes
1,981

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.

Read only

0 Likes
1,981

Hi,

Take a look at the standard transaction VF05. This report is exactly what you want.

regards,

Advait

Read only

0 Likes
1,981

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...

Read only

Former Member
0 Likes
1,981

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.

Read only

former_member404244
Active Contributor
0 Likes
1,981

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

Read only

Former Member
0 Likes
1,981

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.

Read only

Former Member
0 Likes
1,982

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

Read only

0 Likes
1,981

only customer name is parameters field.

can u give an idea how to create a ranges table?..

Read only

0 Likes
1,981

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

Read only

0 Likes
1,981

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