Application Development 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: 

Selection screen for custom table

Former Member
0 Kudos
1,412

We have developed a custom table and user want to have a selection selection screen similar to SE16. There are 9 fields in the table and user can enter data to the selection screen with any combination. My question is how do I filter based on the user input ? DO I need to write multiple SQL for different combination of selection screen parameter within IF ELSEIF statement ? If so then there will be huge number of SQL within IF & ELSEIF statment for 9 selection parameter. Please suggest if you have any better ideas.

10 REPLIES 10

Former Member
0 Kudos
466

Hi,

You can use the SELECT-OPTIONS instead of parameter. Then you can have only one select statement.

shaik_sajid
Active Contributor
0 Kudos
466

hi

Use select-options .Through this you can use single select statement

Select * from <table> into table  itab where field1 in S_field1 .

Regards

Sajid

Former Member
0 Kudos
466

hi,

as avinash said u can use select options instead of parameters then u can use on select statement.

other wise u can create transaction varient transaction for se16 without intial screen. in this case u need not to write program. note: hear the user shuld had the authoriztion for that table to view through se16 transaction.

regards:

rajesh.k

venkat_o
Active Contributor
0 Kudos
466

Hello Bakshi, Try this way

REPORT  ztest_notepad.
TABLES :t100.
SELECT-OPTIONS :  s_sprsl FOR t100-sprsl,
                  s_arbgb FOR t100-arbgb,
                  s_msgnr FOR t100-msgnr,
                  s_text FOR t100-text.
DATA: it_t100 TYPE t100 OCCURS 0.
SELECT *
FROM t100
INTO TABLE it_t100
UP TO 100 ROWS   "Remove this
WHERE sprsl IN s_sprsl AND
      arbgb IN s_arbgb AND
      msgnr IN s_msgnr AND
      text  IN s_text.

DATA program TYPE sy-repid VALUE sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program = program
    i_structure_name   = 'T100'
  TABLES
    t_outtab           = it_t100.
Thanks Venkat.O

Former Member
0 Kudos
466

one more suggestion..

use selection-option with no extension no intervals so that, it just looks like a parameter...

0 Kudos
466

All of your ans are realy helpful. Could you please provide example for no extension and no interval so that it will look like parameter.

Edited by: J. Bakshi on Jul 14, 2009 8:44 AM

0 Kudos
466

I used select option insted of parameter with following code:

SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

SELECT-OPTIONS: P_PCBUS FOR MARA-ZZPC_BUSINESS,

P_PCBUS1 FOR MARA-ZZPC_BUS_SUB1,

P_PLNFMT FOR MARA-ZZPLNG_FORMAT,

P_PRDB FOR MARA-ZZPROD_BRAND,

P_SEASCD FOR MARA-ZZSEASON_CODE,

P_SNP FOR MARA-ZZSUP_NET_PATH,

P_MAT_DC FOR MARA-MATNR,

P_MAT_MG FOR MARA-MATNR NO-EXTENSION NO INTERVALS.

SELECTION-SCREEN: END OF BLOCK B2.

But even after using NO extension and no intervals, selection screen does not look like parameter. Each fields comes up with low and high value.

Any suggestion how to make it look like a paremetr screen ?

0 Kudos
466

It got resolved use following code and now it is showing up as parameter :

SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

SELECT-OPTIONS: P_PCBUS FOR MARA-ZZPC_BUSINESS NO-EXTENSION NO INTERVALS,

P_PCBUS1 FOR MARA-ZZPC_BUS_SUB1 NO-EXTENSION NO INTERVALS,

P_PLNFMT FOR MARA-ZZPLNG_FORMAT NO-EXTENSION NO INTERVALS,

P_PRDB FOR MARA-ZZPROD_BRAND NO-EXTENSION NO INTERVALS,

P_SEASCD FOR MARA-ZZSEASON_CODE NO-EXTENSION NO INTERVALS,

P_SNP FOR MARA-ZZSUP_NET_PATH NO-EXTENSION NO INTERVALS,

P_MAT_DC FOR MARA-MATNR NO-EXTENSION NO INTERVALS,

P_MAT_MG FOR MARA-MATNR NO-EXTENSION NO INTERVALS.

SELECTION-SCREEN: END OF BLOCK B2.

0 Kudos
466

Even after using select-option along with IN statement in where clause , it did not work.

I used following selection screen defination :

SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

SELECT-OPTIONS: P_PCBUS FOR MARA-ZZPC_BUSINESS NO-EXTENSION NO INTERVALS,

P_PCBUS1 FOR MARA-ZZPC_BUS_SUB1 NO-EXTENSION NO INTERVALS,

P_PLNFMT FOR MARA-ZZPLNG_FORMAT NO-EXTENSION NO INTERVALS,

P_PRDB FOR MARA-ZZPROD_BRAND NO-EXTENSION NO INTERVALS,

P_SEASCD FOR MARA-ZZSEASON_CODE NO-EXTENSION NO INTERVALS,

P_SNP FOR MARA-ZZSUP_NET_PATH NO-EXTENSION NO INTERVALS,

P_MAT_DC FOR MARA-MATNR NO-EXTENSION NO INTERVALS,

P_MAT_MG FOR MARA-MATNR NO-EXTENSION NO INTERVALS.

SELECTION-SCREEN: END OF BLOCK B2.

and SQL statement :

SELECT ZZPC_BUSINESS

FROM ZTB_RTL_TO_WHS

INTO TABLE TA_ZZPCBUS

WHERE ZZPC_BUSINESS = P_PCBUS

AND ZZPC_BUS_SUB1 IN P_PCBUS1

AND ZZPROD_BRAND IN P_PRDB

AND ZZPLNG_FORMAT IN P_PLNFMT

AND ZZSEASON_CODE IN P_SEASCD

AND ZZSUP_NET_PATH IN P_SNP

AND ZZD_MATNR IN P_MAT_DC

AND ZZM_MATNR IN P_MAT_MG.

While executing program, I only enterd value for the field P_PCBUS. Though record present for that value, I rcvd SY-SUBRC = 4.

ANy Idea?

Edited by: J. Bakshi on Jul 14, 2009 10:17 AM

former_member735409
Participant
0 Kudos
466

Use select option, why you want to go for parameter?