09-19-2008 7:03 AM
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.
09-19-2008 7:32 AM
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.
09-19-2008 7:05 AM
select-options : s_field1 for table1-field1.
select-options : s_field2 for table2-field2.
select-options : s_field3 for table2-field3.
09-19-2008 7:06 AM
using ranges.u can achive.
loop the internal table.......
and pass the value in range option..
Regards
Anbu B
09-19-2008 7:09 AM
simply write like that.
select-options <name> for itab-<field name>.
thanks & regards
abhishek
09-19-2008 7:16 AM
hiii
still you are having problem to write code or its satisfy you
thanks & regards
abhishek
09-19-2008 7:18 AM
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
09-19-2008 7:25 AM
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.
09-19-2008 7:26 AM
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
09-19-2008 7:32 AM
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.
09-19-2008 7:48 AM