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: 

create select-options using internal table

Former Member
0 Kudos

Hello,

I have number of table-fields in one internal table.

I need to create select-options on screen for each of the table field in that internal table.

Can anybody please provide a code for it ?

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try this sample code:

REPORT z_demo_jg1 LINE-COUNT 10(2) NO STANDARD PAGE HEADING.

DEFINE option.

select-options : s_&1 for w_itab-&1.

END-OF-DEFINITION.

TYPES: BEGIN OF ty_itab,

vbeln LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

werks LIKE vbap-werks,

END OF ty_itab.

DATA: t_itab TYPE TABLE OF ty_itab,

w_itab TYPE ty_itab.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

option : vbeln,posnr,werks.

SELECTION-SCREEN END OF BLOCK b1.

9 REPLIES 9

milusai
Participant
0 Kudos

select-options : s_field1 for table1-field1.

select-options : s_field2 for table2-field2.

select-options : s_field3 for table2-field3.

Former Member
0 Kudos

using ranges.u can achive.

loop the internal table.......

and pass the value in range option..

Regards

Anbu B

Former Member
0 Kudos

simply write like that.

select-options <name> for itab-<field name>.

thanks & regards

abhishek

Former Member
0 Kudos

hiii

still you are having problem to write code or its satisfy you

thanks & regards

abhishek

Former Member
0 Kudos

hi,

you can create in this way :

select-options: <name> for itab-<field name>.

example code:

TABLES: vbak.    " standard table
 
TYPE-POOLS: slis.
 
*-- Structure to hold data from table 
TYPES: BEGIN OF tp_itab1,
       vbeln LIKE vbap-vbeln,
       posnr LIKE vbap-posnr,
       werks LIKE vbap-werks,
       lgort LIKE vbap-lgort,
       END OF tp_itab1.
 
*-- Data Declaration
 
DATA: t_itab1 TYPE TABLE OF tp_itab1.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
 
*----------------------------------------------------------------------*
*                    Selection  Screen                                 *
*----------------------------------------------------------------------*
*--Sales document-block
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
                             s_posnr FOR vbap-posnr,
                             s_werks FOR vbap-werks,
                            s_lgort  FOR vbap-lgort.*
SELECTION-SCREEN END OF  BLOCK b1.

hope it will help you

regards

Rahul sharma

Edited by: RAHUL SHARMA on Sep 19, 2008 8:25 AM

Former Member
0 Kudos

Hey guys.

Thanks for your replies.

Actually problem is that, internal table may contain random number of table-fields , hence i can not hard code the select-options.

I want to create them dynamically according to number of table-fields present in internal table.

Thanks a lot.

Former Member
0 Kudos

Hi,

See the sample code.

TABLES:spfli.

TYPES: BEGIN OF ty_spfli,

carrid TYPE spfli-carrid,

connid TYPE spfli-connid,

cityfrom TYPE spfli-cityfrom,

cityto TYPE spfli-cityto,

END OF ty_spfli.

data: wa_spfli type ty_spfli.

data: it_spfli type STANDARD TABLE OF ty_spfli.

selection-screen begin of block b1 with frame.

select-options: s_carrid for wa_spfli-carrid,

s_connid for wa_spfli-connid,

s_cityfr for wa_spfli-cityfrom,

s_cityto for wa_spfli-cityto.

selection-screen end of block b1.

Regards,

Kumar

Former Member
0 Kudos

Try this sample code:

REPORT z_demo_jg1 LINE-COUNT 10(2) NO STANDARD PAGE HEADING.

DEFINE option.

select-options : s_&1 for w_itab-&1.

END-OF-DEFINITION.

TYPES: BEGIN OF ty_itab,

vbeln LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

werks LIKE vbap-werks,

END OF ty_itab.

DATA: t_itab TYPE TABLE OF ty_itab,

w_itab TYPE ty_itab.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

option : vbeln,posnr,werks.

SELECTION-SCREEN END OF BLOCK b1.

Former Member
0 Kudos

Thanks ..

Points assigned to everyone..!!!